|
|
@ -3,6 +3,7 @@ package com.yxt.anrui.base.biz.commoncontract; |
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
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.commonappendix.CommonAppendix; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.*; |
|
|
|
import com.yxt.anrui.base.biz.basemodelszconfig.BaseModelSzconfigService; |
|
|
@ -11,14 +12,17 @@ import com.yxt.anrui.base.biz.basevehiclebrand.BaseVehicleBrandService; |
|
|
|
import com.yxt.anrui.base.biz.basevehiclemodel.BaseVehicleModelService; |
|
|
|
import com.yxt.anrui.base.biz.commonappendix.CommonAppendixService; |
|
|
|
import com.yxt.anrui.buscenter.api.busdeposit.BusDepositFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.busdepositfictitious.BusDepositFictitiousDetailsVo; |
|
|
|
import com.yxt.anrui.buscenter.api.busdepositfictitious.BusDepositFictitiousFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.busdepositvehicle.BusDepositVehicleFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.busorder.BusOrderVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrderFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.app.order.*; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomer.CrmCustomerFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomerfile.CrmCustomerFileFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempVo; |
|
|
|
import com.yxt.anrui.flowable.api.sysformlink.SysFormLinkFeign; |
|
|
|
import com.yxt.anrui.flowable.api.sysformlink.SysFormStateVo; |
|
|
|
import com.yxt.anrui.flowable.api.utils.ProcDefEnum; |
|
|
|
import com.yxt.anrui.portal.api.dictcommon.DictCommonFeign; |
|
|
|
import com.yxt.anrui.portal.api.dictcommon.DictCommonVo; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationFeign; |
|
|
@ -32,20 +36,23 @@ 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.DateUtils; |
|
|
|
import com.yxt.common.base.utils.MoneyToChineseUtils; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.tomcat.util.threads.ThreadPoolExecutor; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.MessageFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -113,6 +120,10 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
private BaseTrailerService baseTrailerService; |
|
|
|
@Autowired |
|
|
|
private BusSalesOrderFeign busSalesOrderFeign; |
|
|
|
@Autowired |
|
|
|
private CrmCustomerTempFeign crmCustomerTempFeign; |
|
|
|
@Autowired |
|
|
|
private BusDepositFictitiousFeign busDepositFictitiousFeign; |
|
|
|
|
|
|
|
private QueryWrapper<CommonContract> createQueryWrapper(CommonContractQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
@ -571,151 +582,142 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
/*public ResultBean<List<PrintConfirmVo>> printConfirm(PrintConfirmDto dto) { |
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
// 合同信息
|
|
|
|
CommonContract contract = fetchBySid(dto.getSid()); |
|
|
|
// CommonContract contract = new CommonContract();//fetchBySid(dto.getSid());
|
|
|
|
map.put("partyA", contract.getPartyA()); // 甲方
|
|
|
|
map.put("partyB", contract.getPartyB()); // 乙方
|
|
|
|
map.put("contractNo", contract.getContractNo()); // 合同编号
|
|
|
|
map.put("createDate", contract.getCreateDate()); // 签订时间
|
|
|
|
// 客户信息;
|
|
|
|
|
|
|
|
BusOrderVo order = busOrderFeign.fetchSid(dto.getBusSid()).getData(); |
|
|
|
map.put("customerName", order.getCustomerName()); // 联系电话
|
|
|
|
map.put("mobile", order.getMobile()); // 联系电话
|
|
|
|
map.put("IDNumber", order.getIDNumber()); // 身份证号
|
|
|
|
// 车型、主车信息
|
|
|
|
ResultBean<AppBusOrderModelVo> model = busOrderModelFeign.getAppBusOrderModelInfoBySid(dto.getBusSid()); |
|
|
|
map.put("modelName", model.getData().getModelName()); // 车型
|
|
|
|
map.put("modelConfig", model.getData().getModelotherConfig()); // 配置(只有订车有) ?待确认
|
|
|
|
map.put("mainVehicleNum", model.getData().getQuantity()); // 主车数量
|
|
|
|
map.put("mainVehicleSinglePrice", model.getData().getSingle_price()); // 单台成交价
|
|
|
|
ResultBean<String> vinNo = busOrderVehicleFeign.getVehicleVINNoByOrderSid(dto.getBusSid()); |
|
|
|
map.put("VINNo", vinNo.getData()); // 车架号
|
|
|
|
// 上装信息
|
|
|
|
AppBaseModelSzconfigDetailsVo szconfig = baseModelSzconfigService.getAppBaseModelSzconfigDetailsVo(model.getData().getSid()); |
|
|
|
map.put("topName", szconfig.getTopName()); // 上装
|
|
|
|
// 挂车信息
|
|
|
|
AppBaseTrailerDetailsVo trailer = baseTrailerService.getAppBaseTrailerDetailsVo(model.getData().getSid()); |
|
|
|
map.put("trailerName", trailer.getOtherConfig()); // 挂车
|
|
|
|
map.put("trailerNum", model.getData().getQuantity()); // 挂车数量 ?待确认
|
|
|
|
map.put("trailerSinglePrice", StringUtils.isBlank(trailer.getTrailerPrince()) ? "" : trailer.getTrailerPrince()); // 挂车单台成交价 ?待确认
|
|
|
|
// 优惠说明信息
|
|
|
|
ResultBean<List<AppBusOrderDiscountListVo>> discountList = busOrderDiscountFeign.getAppDiscountListVoByOrderSid(order.getOrderSid()); |
|
|
|
map.put("discountDetail", ""); // 优惠说明 ?待确认
|
|
|
|
if (discountList.getSuccess()) { |
|
|
|
map.put("discountDetail", discountList.getData().get(0).getDetail()); // 优惠说明 ?待确认
|
|
|
|
} |
|
|
|
// 保险说明信息
|
|
|
|
map.put("insuranceDetail", "首次在本店投保,第二、三年继续在本店续保。(不在公司投保的,不显示)"); // 保险说明 ?待确认
|
|
|
|
// 车辆交付地点
|
|
|
|
map.put("deliveryPlace", model.getData().getExpected_takecar_location()); |
|
|
|
|
|
|
|
List<PrintConfirmVo> list = new ArrayList<>(); |
|
|
|
try { |
|
|
|
ExecutorService executor = Executors.newFixedThreadPool(5); |
|
|
|
Future<String> future1 = executor.submit(() -> { |
|
|
|
return genCarSaleContract(dto, map, order); |
|
|
|
}); |
|
|
|
Future<String> future2 = executor.submit(() -> { |
|
|
|
return genVehicleRegistration(dto, map); |
|
|
|
}); |
|
|
|
Future<String> future3 = executor.submit(() -> { |
|
|
|
// 客户开票申请书(暂时先不考虑)
|
|
|
|
if (dto.getIsAdvanceInvoice() == 1) { |
|
|
|
return genAdvanceInvoice(dto, map); |
|
|
|
} else { |
|
|
|
return ""; |
|
|
|
} |
|
|
|
}); |
|
|
|
Future<String> future4 = executor.submit(() -> { |
|
|
|
// 委托提车授权书
|
|
|
|
if (dto.getIsEntrustVehicle() == 1) { |
|
|
|
return genEntrustVehicle(dto, map); |
|
|
|
} else { |
|
|
|
return ""; |
|
|
|
} |
|
|
|
}); |
|
|
|
Future<String> future5 = executor.submit(() -> { |
|
|
|
return genCarSaleContractBlank(dto, map, order); |
|
|
|
}); |
|
|
|
|
|
|
|
future1.get(); |
|
|
|
future2.get(); |
|
|
|
future3.get(); |
|
|
|
future4.get(); |
|
|
|
future5.get(); |
|
|
|
PrintConfirmVo printConfirmVo = null; |
|
|
|
if (StringUtils.isNotBlank(future1.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
// 待确认:现车或订车
|
|
|
|
// 现车
|
|
|
|
// printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTNEW.getName()));
|
|
|
|
// 订车
|
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTBOOK.getName())); |
|
|
|
printConfirmVo.setDownloadUrl(future1.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(future2.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.VEHICLEREGISTRATION.getName())); |
|
|
|
printConfirmVo.setDownloadUrl(future2.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(future3.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CUSTOMERINVOICINGAPPLICATION.getName())); |
|
|
|
printConfirmVo.setDownloadUrl(future3.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(future4.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.ENTRUSTPICKUPAUTHORIZATION.getName())); |
|
|
|
printConfirmVo.setDownloadUrl(future4.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(future5.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
// 待确认:现车或订车
|
|
|
|
// 现车
|
|
|
|
// printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTNEWBLANK.getName()));
|
|
|
|
// 订车
|
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTBOOKBLANK.getName())); |
|
|
|
printConfirmVo.setDownloadUrl(future5.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return new ResultBean().fail().setMsg("生成文件失败"); |
|
|
|
} |
|
|
|
return new ResultBean().success().setData(list); |
|
|
|
}*/ |
|
|
|
/**public ResultBean<List<PrintConfirmVo>> printConfirm(PrintConfirmDto dto) { |
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
// 合同信息
|
|
|
|
CommonContract contract = fetchBySid(dto.getSid()); |
|
|
|
// CommonContract contract = new CommonContract();//fetchBySid(dto.getSid());
|
|
|
|
map.put("partyA", contract.getPartyA()); // 甲方
|
|
|
|
map.put("partyB", contract.getPartyB()); // 乙方
|
|
|
|
map.put("contractNo", contract.getContractNo()); // 合同编号
|
|
|
|
map.put("createDate", contract.getCreateDate()); // 签订时间
|
|
|
|
// 客户信息;
|
|
|
|
|
|
|
|
BusOrderVo order = busOrderFeign.fetchSid(dto.getBusSid()).getData(); |
|
|
|
map.put("customerName", order.getCustomerName()); // 联系电话
|
|
|
|
map.put("mobile", order.getMobile()); // 联系电话
|
|
|
|
map.put("IDNumber", order.getIDNumber()); // 身份证号
|
|
|
|
// 车型、主车信息
|
|
|
|
ResultBean<AppBusOrderModelVo> model = busOrderModelFeign.getAppBusOrderModelInfoBySid(dto.getBusSid()); |
|
|
|
map.put("modelName", model.getData().getModelName()); // 车型
|
|
|
|
map.put("modelConfig", model.getData().getModelotherConfig()); // 配置(只有订车有) ?待确认
|
|
|
|
map.put("mainVehicleNum", model.getData().getQuantity()); // 主车数量
|
|
|
|
map.put("mainVehicleSinglePrice", model.getData().getSingle_price()); // 单台成交价
|
|
|
|
ResultBean<String> vinNo = busOrderVehicleFeign.getVehicleVINNoByOrderSid(dto.getBusSid()); |
|
|
|
map.put("VINNo", vinNo.getData()); // 车架号
|
|
|
|
// 上装信息
|
|
|
|
AppBaseModelSzconfigDetailsVo szconfig = baseModelSzconfigService.getAppBaseModelSzconfigDetailsVo(model.getData().getSid()); |
|
|
|
map.put("topName", szconfig.getTopName()); // 上装
|
|
|
|
// 挂车信息
|
|
|
|
AppBaseTrailerDetailsVo trailer = baseTrailerService.getAppBaseTrailerDetailsVo(model.getData().getSid()); |
|
|
|
map.put("trailerName", trailer.getOtherConfig()); // 挂车
|
|
|
|
map.put("trailerNum", model.getData().getQuantity()); // 挂车数量 ?待确认
|
|
|
|
map.put("trailerSinglePrice", StringUtils.isBlank(trailer.getTrailerPrince()) ? "" : trailer.getTrailerPrince()); // 挂车单台成交价 ?待确认
|
|
|
|
// 优惠说明信息
|
|
|
|
ResultBean<List<AppBusOrderDiscountListVo>> discountList = busOrderDiscountFeign.getAppDiscountListVoByOrderSid(order.getOrderSid()); |
|
|
|
map.put("discountDetail", ""); // 优惠说明 ?待确认
|
|
|
|
if (discountList.getSuccess()) { |
|
|
|
map.put("discountDetail", discountList.getData().get(0).getDetail()); // 优惠说明 ?待确认
|
|
|
|
} |
|
|
|
// 保险说明信息
|
|
|
|
map.put("insuranceDetail", "首次在本店投保,第二、三年继续在本店续保。(不在公司投保的,不显示)"); // 保险说明 ?待确认
|
|
|
|
// 车辆交付地点
|
|
|
|
map.put("deliveryPlace", model.getData().getExpected_takecar_location()); |
|
|
|
|
|
|
|
List<PrintConfirmVo> list = new ArrayList<>(); |
|
|
|
try { |
|
|
|
ExecutorService executor = Executors.newFixedThreadPool(5); |
|
|
|
Future<String> future1 = executor.submit(() -> { |
|
|
|
return genCarSaleContract(dto, map, order); |
|
|
|
}); |
|
|
|
Future<String> future2 = executor.submit(() -> { |
|
|
|
return genVehicleRegistration(dto, map); |
|
|
|
}); |
|
|
|
Future<String> future3 = executor.submit(() -> { |
|
|
|
// 客户开票申请书(暂时先不考虑)
|
|
|
|
if (dto.getIsAdvanceInvoice() == 1) { |
|
|
|
return genAdvanceInvoice(dto, map); |
|
|
|
} else { |
|
|
|
return ""; |
|
|
|
} |
|
|
|
}); |
|
|
|
Future<String> future4 = executor.submit(() -> { |
|
|
|
// 委托提车授权书
|
|
|
|
if (dto.getIsEntrustVehicle() == 1) { |
|
|
|
return genEntrustVehicle(dto, map); |
|
|
|
} else { |
|
|
|
return ""; |
|
|
|
} |
|
|
|
}); |
|
|
|
Future<String> future5 = executor.submit(() -> { |
|
|
|
return genCarSaleContractBlank(dto, map, order); |
|
|
|
}); |
|
|
|
|
|
|
|
future1.get(); |
|
|
|
future2.get(); |
|
|
|
future3.get(); |
|
|
|
future4.get(); |
|
|
|
future5.get(); |
|
|
|
PrintConfirmVo printConfirmVo = null; |
|
|
|
if (StringUtils.isNotBlank(future1.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
// 待确认:现车或订车
|
|
|
|
// 现车
|
|
|
|
// printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTNEW.getName()));
|
|
|
|
// 订车
|
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTBOOK.getName())); |
|
|
|
printConfirmVo.setDownloadUrl(future1.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(future2.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.VEHICLEREGISTRATION.getName())); |
|
|
|
printConfirmVo.setDownloadUrl(future2.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(future3.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CUSTOMERINVOICINGAPPLICATION.getName())); |
|
|
|
printConfirmVo.setDownloadUrl(future3.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(future4.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.ENTRUSTPICKUPAUTHORIZATION.getName())); |
|
|
|
printConfirmVo.setDownloadUrl(future4.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(future5.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
// 待确认:现车或订车
|
|
|
|
// 现车
|
|
|
|
// printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTNEWBLANK.getName()));
|
|
|
|
// 订车
|
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTBOOKBLANK.getName())); |
|
|
|
printConfirmVo.setDownloadUrl(future5.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return new ResultBean().fail().setMsg("生成文件失败"); |
|
|
|
} |
|
|
|
return new ResultBean().success().setData(list); |
|
|
|
}**/ |
|
|
|
|
|
|
|
/** |
|
|
|
* 生成 新车买卖合同(现车或订车) pdf |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
*/ |
|
|
|
private String genCarSaleContract(PrintConfirmDto dto, Map<String, Object> map, BusOrderVo order) { |
|
|
|
private String genCarSaleContract(PrintConfirmDto dto, Map<String, Object> map, AppOrderDetailsVo appOrderDetailsVo) { |
|
|
|
String url = ""; |
|
|
|
// 车辆税信息
|
|
|
|
map.put("taxSum", "1111"); // 车辆含税 ?待确认
|
|
|
|
map.put("taxSumUpper", "壹仟壹佰壹拾壹"); // 车辆含税(大写) ?待确认
|
|
|
|
// 乙方缴纳订金
|
|
|
|
map.put("deposit", order.getDeposit()); // 订金
|
|
|
|
map.put("useDeposit", "true"); // 判断是否展示括号中的内容 ?待确认:用本人交纳的虚拟订金的,需要显示订金后面括弧 中的说明
|
|
|
|
map.put("date", order.getCreateDate()); // 订金缴纳日期 ?待确认
|
|
|
|
map.put("deposit1", ""); // 总订金 ?待确认
|
|
|
|
map.put("deposit2", ""); // 用于缴纳的订金 ?待确认
|
|
|
|
|
|
|
|
// 目标路径 ? 待确认:如何区分现车和订车
|
|
|
|
// 现车
|
|
|
|
// String typeName = ContractTemplateEnum.CARSALECONTRACTNEW.getName();
|
|
|
|
// 订车
|
|
|
|
String typeName = ContractTemplateEnum.CARSALECONTRACTBOOK.getName(); |
|
|
|
String docName = typeName + "(" + order.getCustomerName() + ").doc"; |
|
|
|
String typeName = ""; |
|
|
|
if ("现车".equals(appOrderDetailsVo.getOrderType())) { |
|
|
|
typeName = ContractTemplateEnum.CARSALECONTRACTNEW.getName(); |
|
|
|
} else { |
|
|
|
typeName = ContractTemplateEnum.CARSALECONTRACTBOOK.getName(); |
|
|
|
} |
|
|
|
String docName = typeName + "(" + appOrderDetailsVo.getName() + ").doc"; |
|
|
|
Map<String, String> resultMap = docPdfComponent.createDocToPdf(map, typeName, docName); |
|
|
|
url = resultMap.get("prefixTemplateUrl"); |
|
|
|
return url; |
|
|
@ -726,25 +728,28 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @param map |
|
|
|
* @param order |
|
|
|
* @param appOrderDetailsVo |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private String genCarSaleContractBlank(PrintConfirmDto dto, Map<String, Object> map, BusOrderVo order) { |
|
|
|
private String genCarSaleContractBlank(PrintConfirmDto dto, Map<String, Object> map, AppOrderDetailsVo appOrderDetailsVo) { |
|
|
|
String url = ""; |
|
|
|
String typeName = ""; |
|
|
|
String docName = ""; |
|
|
|
map.put("totalPrice", ""); |
|
|
|
map.put("priceRemarks", ""); |
|
|
|
map.put("depositTotal", ""); |
|
|
|
// 涉及高低开票的,需要打印两套合同,一套按照成交价打印(记账用),一套为价格空白的合同(开票用)
|
|
|
|
// 合同金额 ? 待确定
|
|
|
|
BigDecimal contractAmount = order.getContractAmount(); |
|
|
|
if (contractAmount == null) { |
|
|
|
// 待确定 ? 现车或订车
|
|
|
|
if (dto.getIsDiscount() == 1) { |
|
|
|
// 现车
|
|
|
|
typeName = ContractTemplateEnum.CARSALECONTRACTNEWBLANK.getName(); |
|
|
|
// 订车
|
|
|
|
typeName = ContractTemplateEnum.CARSALECONTRACTBOOKBLANK.getName(); |
|
|
|
docName = typeName + "(" + order.getCustomerName() + ").doc"; |
|
|
|
if ("现车".equals(appOrderDetailsVo.getOrderType())) { |
|
|
|
typeName = ContractTemplateEnum.CARSALECONTRACTNEWBLANK.getName(); |
|
|
|
} else { |
|
|
|
// 订车
|
|
|
|
typeName = ContractTemplateEnum.CARSALECONTRACTBOOKBLANK.getName(); |
|
|
|
} |
|
|
|
docName = typeName + "(" + appOrderDetailsVo.getName() + ").doc"; |
|
|
|
Map<String, String> map2 = docPdfComponent.createDocToPdf(map, typeName, docName); |
|
|
|
url += ", " + map2.get("prefixTemplateUrl"); |
|
|
|
url += map2.get("prefixTemplateUrl"); |
|
|
|
} |
|
|
|
return url; |
|
|
|
} |
|
|
@ -922,7 +927,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
String path = ""; |
|
|
|
List<String> commonContractVos = new ArrayList<>(); |
|
|
|
List<String> sceneSignUrlList = new ArrayList<>(); |
|
|
|
if (StringUtils.isNotBlank(appdixUrl)){ |
|
|
|
if (StringUtils.isNotBlank(appdixUrl)) { |
|
|
|
String[] appdixUrls = appdixUrl.split(","); |
|
|
|
for (String url : appdixUrls) { |
|
|
|
String urlPrefix = fileUploadComponent.getUrlPrefix(); |
|
|
@ -930,14 +935,14 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
commonContractVos.add(path); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(sceneSignUrl)){ |
|
|
|
String[] sceneSignUrls = sceneSignUrl.split(","); |
|
|
|
for (String signUrl : sceneSignUrls) { |
|
|
|
String urlPrefix = fileUploadComponent.getUrlPrefix(); |
|
|
|
path = urlPrefix + signUrl; |
|
|
|
sceneSignUrlList.add(path); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(sceneSignUrl)) { |
|
|
|
String[] sceneSignUrls = sceneSignUrl.split(","); |
|
|
|
for (String signUrl : sceneSignUrls) { |
|
|
|
String urlPrefix = fileUploadComponent.getUrlPrefix(); |
|
|
|
path = urlPrefix + signUrl; |
|
|
|
sceneSignUrlList.add(path); |
|
|
|
} |
|
|
|
} |
|
|
|
commonContractVo.setCommonAppendixVos(commonContractVos); |
|
|
|
commonContractVo.setSceneSignUrlList(sceneSignUrlList); |
|
|
|
return rb.success().setData(commonContractVo); |
|
|
@ -1094,4 +1099,130 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<List<PrintConfirmVo>> printConfirm(PrintConfirmDto dto) { |
|
|
|
ResultBean<List<PrintConfirmVo>> rb = ResultBean.fireFail(); |
|
|
|
List<PrintConfirmVo> list = new ArrayList<>(); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
String sid = dto.getBusSid(); |
|
|
|
//查询销售订单的信息
|
|
|
|
ResultBean<AppOrderDetailsVo> resultBean = busSalesOrderFeign.getSaleOrderDetails(sid); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
AppOrderDetailsVo appOrderDetailsVo = resultBean.getData(); |
|
|
|
//甲方
|
|
|
|
String createOrgName = appOrderDetailsVo.getSalesOrg(); |
|
|
|
//乙方
|
|
|
|
String customerName = appOrderDetailsVo.getName(); |
|
|
|
//联系电话
|
|
|
|
String mobile = appOrderDetailsVo.getPhone(); |
|
|
|
//身份证号
|
|
|
|
//根据客户sid查询客户的身份证号
|
|
|
|
sid = appOrderDetailsVo.getCustomerSid(); |
|
|
|
ResultBean<CrmCustomerTempVo> crmResultBean = crmCustomerTempFeign.fetchSid(sid); |
|
|
|
if (!crmResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(crmResultBean.getMsg()); |
|
|
|
} |
|
|
|
CrmCustomerTempVo crmCustomerTempVo = crmResultBean.getData(); |
|
|
|
//身份证号
|
|
|
|
String idNo = crmCustomerTempVo.getIDNumber(); |
|
|
|
//查询销售订单的车型信息
|
|
|
|
AppOrderModelInfoVo appOrderModelInfoVo = appOrderDetailsVo.getModelInfo(); |
|
|
|
//车型
|
|
|
|
String modelName = "车型:" + appOrderModelInfoVo.getModelName() + "。"; |
|
|
|
//配置
|
|
|
|
String modelConfig = "配置:" + appOrderModelInfoVo.getConfig() + "。"; |
|
|
|
//上装
|
|
|
|
if (appOrderDetailsVo.getTopInfo() != null) { |
|
|
|
AppOrderTopInfoVo topInfo = appOrderDetailsVo.getTopInfo(); |
|
|
|
String topName = topInfo.getTopName(); |
|
|
|
topName = "上装:" + topName + "。"; |
|
|
|
map.put("topName", topName); |
|
|
|
} |
|
|
|
AppOrderPriceInfoVo priceInfo = appOrderDetailsVo.getPriceInfo(); |
|
|
|
//查询台数
|
|
|
|
String num = priceInfo.getNumber(); |
|
|
|
//单台成交价
|
|
|
|
String transactionPrice = priceInfo.getTransactionPrice(); |
|
|
|
String remarks = "主车" + num + "台,单台成交价:" + transactionPrice + "元。"; |
|
|
|
//优惠说明
|
|
|
|
//ToDo:
|
|
|
|
//保险说明
|
|
|
|
String insuranceInfo = "保险说明:" + appOrderDetailsVo.getInsuranceInfo() + "。"; |
|
|
|
//车价合计
|
|
|
|
String totalPrice = priceInfo.getTotalPrice(); |
|
|
|
//车价合计大写
|
|
|
|
String priceRemarks = MoneyToChineseUtils.convert(Double.valueOf(totalPrice).doubleValue()); |
|
|
|
//交纳订金
|
|
|
|
AppOrderDepositInfoVo depositInfo = appOrderDetailsVo.getDepositInfo(); |
|
|
|
String depositTotal = depositInfo.getDepositTotal(); |
|
|
|
if ("02".equals(depositInfo.getDepositTypeKey())) { |
|
|
|
ResultBean<List<BusDepositFictitiousDetailsVo>> listResultBean = busDepositFictitiousFeign.detailsList(depositInfo.getSid()); |
|
|
|
List<BusDepositFictitiousDetailsVo> listResultBeanData = listResultBean.getData(); |
|
|
|
listResultBeanData.removeAll(Collections.singleton(null)); |
|
|
|
if (!listResultBeanData.isEmpty()) { |
|
|
|
String depositRemarks = "(其中乙方在"; |
|
|
|
for (BusDepositFictitiousDetailsVo v : listResultBeanData) { |
|
|
|
String b = v.getPaymentDate() + "转入甲方的" + v.getDeposit() + "元中的" + v.getPrice() + "元用于本次订金,"; |
|
|
|
depositRemarks = depositRemarks + b; |
|
|
|
} |
|
|
|
depositRemarks = depositRemarks + ")"; |
|
|
|
map.put("depositRemarks", depositRemarks); |
|
|
|
} |
|
|
|
} |
|
|
|
//车辆交付地点
|
|
|
|
String address = priceInfo.getAddress(); |
|
|
|
//组装到文档相对应的字段中
|
|
|
|
map.put("createOrgName", createOrgName); |
|
|
|
map.put("customerName", customerName); |
|
|
|
map.put("mobile", mobile); |
|
|
|
map.put("idNo", idNo); |
|
|
|
map.put("modelName", modelName); |
|
|
|
map.put("modelConfig", modelConfig); |
|
|
|
map.put("remarks", remarks); |
|
|
|
map.put("insuranceInfo", insuranceInfo); |
|
|
|
map.put("totalPrice", totalPrice); |
|
|
|
map.put("priceRemarks", priceRemarks); |
|
|
|
map.put("depositTotal", depositTotal); |
|
|
|
map.put("address", address); |
|
|
|
try { |
|
|
|
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() |
|
|
|
.setNameFormat("demo-pool-%d").build(); |
|
|
|
ExecutorService pool = new ThreadPoolExecutor(2, 100, |
|
|
|
0L, TimeUnit.MILLISECONDS, |
|
|
|
new LinkedBlockingQueue<Runnable>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); |
|
|
|
Future<String> future1 = pool.submit(() -> { |
|
|
|
return genCarSaleContract(dto, map, appOrderDetailsVo); |
|
|
|
}); |
|
|
|
PrintConfirmVo printConfirmVo = null; |
|
|
|
if (StringUtils.isNotBlank(future1.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
if ("现车".equals(appOrderDetailsVo.getOrderType())) { |
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTNEW.getName())); |
|
|
|
} else { |
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTBOOK.getName())); |
|
|
|
} |
|
|
|
printConfirmVo.setDownloadUrl(future1.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
Future<String> future2 = pool.submit(() -> { |
|
|
|
return genCarSaleContractBlank(dto, map, appOrderDetailsVo); |
|
|
|
}); |
|
|
|
if (StringUtils.isNotBlank(future2.get())) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
if ("现车".equals(appOrderDetailsVo.getOrderType())) { |
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTNEWBLANK.getName())); |
|
|
|
} else { |
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTBOOKBLANK.getName())); |
|
|
|
} |
|
|
|
printConfirmVo.setDownloadUrl(future2.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return rb.setMsg("生成文件失败"); |
|
|
|
} |
|
|
|
|
|
|
|
return rb.success().setData(list); |
|
|
|
} |
|
|
|
} |