|
|
@ -15,6 +15,7 @@ import com.yxt.anrui.base.api.commoncontract.flowable.CommonContractNodeVo; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.flowable.CommonContractTaskQuery; |
|
|
|
import com.yxt.anrui.base.biz.basemodelszconfig.BaseModelSzconfigService; |
|
|
|
import com.yxt.anrui.base.biz.basetrailer.BaseTrailerService; |
|
|
|
import com.yxt.anrui.base.biz.basevehicle.BaseVehicleService; |
|
|
|
import com.yxt.anrui.base.biz.basevehiclebrand.BaseVehicleBrandService; |
|
|
|
import com.yxt.anrui.base.biz.basevehiclemodel.BaseVehicleModelService; |
|
|
|
import com.yxt.anrui.base.biz.commonappendix.CommonAppendixService; |
|
|
@ -26,11 +27,14 @@ import com.yxt.anrui.buscenter.api.busdepositfictitious.BusDepositFictitiousFeig |
|
|
|
import com.yxt.anrui.buscenter.api.busdepositvehicle.BusDepositVehicleFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrderFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.app.order.*; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.app.vin.VinListsVo; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomer.CrmCustomerFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomerfile.CrmCustomerFileFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerFileDDto; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempVo; |
|
|
|
import com.yxt.anrui.fin.api.fincompanyinvoicing.FinCompanyInvoicingDetailsVo; |
|
|
|
import com.yxt.anrui.fin.api.fincompanyinvoicing.FinCompanyInvoicingFeign; |
|
|
|
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.FinUncollectedReceivablesDetailedFeign; |
|
|
|
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.UnCollectionDto; |
|
|
|
import com.yxt.anrui.flowable.api.flow.FlowableFeign; |
|
|
@ -76,6 +80,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import java.io.File; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.MessageFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
@ -150,6 +155,10 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
private FlowTaskFeign flowTaskFeign; |
|
|
|
@Autowired |
|
|
|
private FinUncollectedReceivablesDetailedFeign finUncollectedDetailedFeign; |
|
|
|
@Autowired |
|
|
|
private FinCompanyInvoicingFeign finCompanyInvoicingFeign; |
|
|
|
@Autowired |
|
|
|
private BaseVehicleService baseVehicleService; |
|
|
|
|
|
|
|
private QueryWrapper<CommonContract> createQueryWrapper(CommonContractQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
@ -749,20 +758,15 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
return url; |
|
|
|
}*/ |
|
|
|
private String genCarSaleContract(PrintConfirmDto dto, Map<String, Object> map, AppOrderDetailsVo appOrderDetailsVo) { |
|
|
|
// File file = null;
|
|
|
|
|
|
|
|
String ftl = ""; |
|
|
|
if ("现车".equals(appOrderDetailsVo.getOrderType())) { |
|
|
|
//获取模板
|
|
|
|
// file = new File(getClass().getClassLoader().getResource("ftl/existingvehicles.ftl").getFile());
|
|
|
|
ftl = "existingvehicles"; |
|
|
|
} else { |
|
|
|
//获取模板
|
|
|
|
ftl = "orderacar"; |
|
|
|
// file = new File(getClass().getClassLoader().getResource("ftl/orderacar.ftl").getFile());
|
|
|
|
} |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/" + ftl + ".ftl"); |
|
|
|
// String dir = getClassLoader().getResource("ftl").getPath();
|
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
@ -775,7 +779,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成文件名
|
|
|
|
String pdfName = "合同_"+dateStr + seconds + ".pdf"; |
|
|
|
String pdfName = "新车买卖合同_" + dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
return pdfName; |
|
|
|
} |
|
|
@ -812,7 +816,6 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
}*/ |
|
|
|
private String genCarSaleContractBlank(PrintConfirmDto dto, Map<String, Object> map, AppOrderDetailsVo appOrderDetailsVo) { |
|
|
|
String url = ""; |
|
|
|
// File file = null;
|
|
|
|
map.put("totalPrice", ""); |
|
|
|
map.put("priceRemarks", ""); |
|
|
|
map.put("depositTotal", ""); |
|
|
@ -823,13 +826,10 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
if ("现车".equals(appOrderDetailsVo.getOrderType())) { |
|
|
|
//获取模板
|
|
|
|
ftl = "existingvehicles_black"; |
|
|
|
// file = new File(getClass().getClassLoader().getResource("ftl/existingvehicles_black.ftl").getFile());
|
|
|
|
} else { |
|
|
|
// 订车获取模板
|
|
|
|
ftl = "orderacar_black"; |
|
|
|
// file = new File(getClass().getClassLoader().getResource("ftl/orderacar_black.ftl").getFile());
|
|
|
|
} |
|
|
|
// String dir = getClassLoader().getResource("ftl").getPath();
|
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/" + ftl + ".ftl"); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
@ -843,10 +843,212 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成合同文件名
|
|
|
|
String pdfName = "空白合同_"+dateStr + seconds + ".pdf"; |
|
|
|
String pdfName = "新车买卖空白合同_" + dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
url = pdfName; |
|
|
|
} |
|
|
|
return url; |
|
|
|
} |
|
|
|
|
|
|
|
private String getReceiveCar(Map<String, Object> map, AppOrderDetailsVo appOrderDetailsVo) { |
|
|
|
String url = ""; |
|
|
|
//查询销售订单的现车
|
|
|
|
AppOrderModelInfoVo orderModelInfoVo = appOrderDetailsVo.getModelInfo(); |
|
|
|
List<String> stringList = orderModelInfoVo.getVinList(); |
|
|
|
/*if (stringList.size() > 0) { |
|
|
|
map.put("vinNo", String.join(",", stringList)); |
|
|
|
}*/ |
|
|
|
String ftl = "receiveCar"; |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/" + ftl + ".ftl"); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String typeName = dateStr + seconds + ".doc"; |
|
|
|
File file = new File(targetPath + ftl + seconds + ".ftl"); |
|
|
|
File dir = new File(targetPath); |
|
|
|
WordConvertUtils.inputStreamToFile(inputStream, file); |
|
|
|
WordConvertUtils.creatWord1(map, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成合同文件名
|
|
|
|
String pdfName = "接收车辆委托书_" + dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
url = pdfName; |
|
|
|
return url; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 客户开票申请信息 |
|
|
|
* |
|
|
|
* @param map |
|
|
|
* @param appOrderDetailsVo |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private String getInvoicMessage(Map<String, Object> map, AppOrderDetailsVo appOrderDetailsVo) { |
|
|
|
String url = ""; |
|
|
|
//根据分公司sid查询分公司开票申请
|
|
|
|
String invoicName = ""; |
|
|
|
ResultBean<FinCompanyInvoicingDetailsVo> invoicingDetailsVoResultBean = finCompanyInvoicingFeign.fetchDetailsByUseOrgSid(appOrderDetailsVo.getUseOrgSid()); |
|
|
|
if (invoicingDetailsVoResultBean.getData() != null) { |
|
|
|
map.put("createOrgName", invoicingDetailsVoResultBean.getData().getUseOrgName()); |
|
|
|
invoicName = invoicingDetailsVoResultBean.getData().getName(); |
|
|
|
} |
|
|
|
//查询销售订单的现车
|
|
|
|
AppOrderModelInfoVo orderModelInfoVo = appOrderDetailsVo.getModelInfo(); |
|
|
|
AppOrderPriceInfoVo priceInfo = appOrderDetailsVo.getPriceInfo(); |
|
|
|
List<String> stringList = orderModelInfoVo.getVinList(); |
|
|
|
List<InvoicMessageContractVo> invoicMessageContractVos = new ArrayList<>(); |
|
|
|
if (stringList.size() > 0) { |
|
|
|
for (int i = 0; i < stringList.size(); i++) { |
|
|
|
InvoicMessageContractVo vo = new InvoicMessageContractVo(); |
|
|
|
vo.setVinNo(stringList.get(i)); |
|
|
|
vo.setType(appOrderDetailsVo.getInvoiceType()); |
|
|
|
vo.setInvoicMoney(priceInfo.getSingleFinalPrice()); |
|
|
|
vo.setInvoicName(invoicName); |
|
|
|
invoicMessageContractVos.add(vo); |
|
|
|
} |
|
|
|
} |
|
|
|
map.put("invoicList", invoicMessageContractVos); |
|
|
|
String ftl = "invoicApply"; |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/" + ftl + ".ftl"); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String typeName = dateStr + seconds + ".doc"; |
|
|
|
File file = new File(targetPath + ftl + seconds + ".ftl"); |
|
|
|
File dir = new File(targetPath); |
|
|
|
WordConvertUtils.inputStreamToFile(inputStream, file); |
|
|
|
WordConvertUtils.creatWord1(map, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成合同文件名
|
|
|
|
String pdfName = "开票申请书_" + dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
url = pdfName; |
|
|
|
return url; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 款项确认-车款 |
|
|
|
* |
|
|
|
* @param map |
|
|
|
* @param appOrderDetailsVo |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private String getCarFin(Map<String, Object> map, AppOrderDetailsVo appOrderDetailsVo) { |
|
|
|
String url = ""; |
|
|
|
//查询销售订单的现车
|
|
|
|
/*AppOrderModelInfoVo orderModelInfoVo = appOrderDetailsVo.getModelInfo(); |
|
|
|
AppOrderPriceInfoVo priceInfo = appOrderDetailsVo.getPriceInfo(); |
|
|
|
AppOrderDepositInfoVo depositInfo = appOrderDetailsVo.getDepositInfo(); |
|
|
|
String singleFinalPrice = priceInfo.getSingleFinalPrice(); |
|
|
|
String deposit = depositInfo.getDeposit(); |
|
|
|
if (new BigDecimal(singleFinalPrice).compareTo(new BigDecimal(deposit)) != 0) { |
|
|
|
//单台成交价-单台订金 = 单台车款
|
|
|
|
BigDecimal money = new BigDecimal(singleFinalPrice).subtract(new BigDecimal(deposit)).multiply(new BigDecimal(priceInfo.getNumber())); |
|
|
|
map.put("money", money); |
|
|
|
map.put("moneyDx", TransformMoney.transform(TransformMoney.getDecimalStr(Double.valueOf(money.toString()).doubleValue()))); |
|
|
|
} |
|
|
|
List<String> stringList = orderModelInfoVo.getVinList(); |
|
|
|
if (stringList.size() > 0) { |
|
|
|
map.put("vinNo", String.join(",", stringList)); |
|
|
|
}*/ |
|
|
|
//车款:money,大写:moneyDx
|
|
|
|
String ftl = "carFin"; |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/" + ftl + ".ftl"); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String typeName = dateStr + seconds + ".doc"; |
|
|
|
File file = new File(targetPath + ftl + seconds + ".ftl"); |
|
|
|
File dir = new File(targetPath); |
|
|
|
WordConvertUtils.inputStreamToFile(inputStream, file); |
|
|
|
WordConvertUtils.creatWord1(map, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成合同文件名
|
|
|
|
String pdfName = "款项确认书_车款_" + dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
url = pdfName; |
|
|
|
return url; |
|
|
|
} |
|
|
|
|
|
|
|
private String getMoneyFin(Map<String, Object> map, AppOrderDetailsVo appOrderDetailsVo) { |
|
|
|
String url = ""; |
|
|
|
//查询销售订单的现车
|
|
|
|
/* AppOrderModelInfoVo orderModelInfoVo = appOrderDetailsVo.getModelInfo(); |
|
|
|
AppOrderPriceInfoVo priceInfo = appOrderDetailsVo.getPriceInfo(); |
|
|
|
AppOrderDepositInfoVo depositInfo = appOrderDetailsVo.getDepositInfo(); |
|
|
|
String singleFinalPrice = priceInfo.getSingleFinalPrice(); |
|
|
|
String deposit = depositInfo.getDeposit(); |
|
|
|
map.put("money", new BigDecimal(singleFinalPrice).multiply(new BigDecimal(priceInfo.getNumber()))); |
|
|
|
map.put("moneyDx", TransformMoney.transform(TransformMoney.getDecimalStr(Double.valueOf(new BigDecimal(singleFinalPrice).multiply(new BigDecimal(priceInfo.getNumber())).toString()).doubleValue()))); |
|
|
|
map.put("moneyXx", new BigDecimal(deposit).multiply(new BigDecimal(priceInfo.getNumber())));*/ |
|
|
|
//车款:money,大写:moneyDx
|
|
|
|
String ftl = "moneyFin"; |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/" + ftl + ".ftl"); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String typeName = dateStr + seconds + ".doc"; |
|
|
|
File file = new File(targetPath + ftl + seconds + ".ftl"); |
|
|
|
File dir = new File(targetPath); |
|
|
|
WordConvertUtils.inputStreamToFile(inputStream, file); |
|
|
|
WordConvertUtils.creatWord1(map, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成合同文件名
|
|
|
|
String pdfName = "款项确认书_订金_" + dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
url = pdfName; |
|
|
|
return url; |
|
|
|
} |
|
|
|
|
|
|
|
private String getCarContract(Map<String, Object> map, AppOrderDetailsVo appOrderDetailsVo) { |
|
|
|
String url = ""; |
|
|
|
// map.put("createDate", DateUtil.today());
|
|
|
|
//查询销售订单的现车
|
|
|
|
AppOrderModelInfoVo orderModelInfoVo = appOrderDetailsVo.getModelInfo(); |
|
|
|
List<CarContractListVo> carContractListVos = new ArrayList<>(); |
|
|
|
List<VinListsVo> vinNoList = orderModelInfoVo.getVinListsVos(); |
|
|
|
if (vinNoList.size() > 0) { |
|
|
|
for (int i = 0; i < vinNoList.size(); i++) { |
|
|
|
CarContractListVo carContractListVo = new CarContractListVo(); |
|
|
|
/*carContractListVo.setBrand(orderModelInfoVo.getBrand()); |
|
|
|
carContractListVo.setVinNo(vinNoList.get(i).getVinNo()); |
|
|
|
String vinSid = vinNoList.get(i).getVinSid(); |
|
|
|
if (StringUtils.isNotBlank(vinSid)) { |
|
|
|
//根据车辆sid查询车辆信息获取发动机号
|
|
|
|
BaseVehicleSelectVo baseVehicleSelectVo = baseVehicleService.details(vinSid); |
|
|
|
if (baseVehicleSelectVo != null) { |
|
|
|
carContractListVo.setEnginNo(baseVehicleSelectVo.getEngineNo()); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
carContractListVos.add(carContractListVo); |
|
|
|
} |
|
|
|
} |
|
|
|
map.put("carLists", carContractListVos); |
|
|
|
String ftl = "carContract"; |
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/" + ftl + ".ftl"); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String typeName = dateStr + seconds + ".doc"; |
|
|
|
File file = new File(targetPath + ftl + seconds + ".ftl"); |
|
|
|
File dir = new File(targetPath); |
|
|
|
WordConvertUtils.inputStreamToFile(inputStream, file); |
|
|
|
WordConvertUtils.creatWord1(map, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成合同文件名
|
|
|
|
String pdfName = "车辆登记合同_" + dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
url = pdfName; |
|
|
|
return url; |
|
|
|
} |
|
|
|
|
|
|
@ -1094,6 +1296,11 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
*/ |
|
|
|
public AppCommonContractInitVo getContractInfo(String contractSid, String userSid) { |
|
|
|
AppCommonContractInitVo vo = baseMapper.getContractInfo(contractSid); |
|
|
|
ResultBean<AppOrderDetailsVo> busSalesOrderFeignSaleOrderDetails = busSalesOrderFeign.getSaleOrderDetails(vo.getBusSid()); |
|
|
|
if (busSalesOrderFeignSaleOrderDetails.getSuccess()) { |
|
|
|
AppOrderDetailsVo appOrderDetailsVo = busSalesOrderFeignSaleOrderDetails.getData(); |
|
|
|
vo.setBuyTypeKey(appOrderDetailsVo.getPayTypeKey()); |
|
|
|
} |
|
|
|
String urlPrefix = fileUploadComponent.getUrlPrefix(); |
|
|
|
if (StringUtils.isNotBlank(vo.getAppdixUrl())) { |
|
|
|
String[] split1 = vo.getAppdixUrl().split(","); |
|
|
@ -1154,9 +1361,9 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
AppUserOrgInfoVo data = sysUserFeign.getUserOrgInfoByUserSid(dto.getUserSid()).getData(); |
|
|
|
CommonContract commonContract = fetchBySid(dto.getContractSid()); |
|
|
|
commonContract.setStaffSid(dto.getUserSid()); |
|
|
|
commonContract.setStaffName(data.getStaffName()); |
|
|
|
commonContract.setOrgSid(data.getOrgSid()); |
|
|
|
// commonContract.setStaffSid(dto.getUserSid());
|
|
|
|
// commonContract.setStaffName(data.getStaffName());
|
|
|
|
// commonContract.setOrgSid(data.getOrgSid());
|
|
|
|
String s1 = ""; |
|
|
|
String s2 = ""; |
|
|
|
String s3 = ""; |
|
|
@ -1383,14 +1590,22 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
//车辆交付地点
|
|
|
|
String address = priceInfo.getAddress(); |
|
|
|
//组装到文档相对应的字段中
|
|
|
|
map.put("createOrgName", createOrgName); |
|
|
|
ResultBean<FinCompanyInvoicingDetailsVo> invoicingDetailsVoResultBean = finCompanyInvoicingFeign.fetchDetailsByUseOrgSid(appOrderDetailsVo.getUseOrgSid()); |
|
|
|
if (invoicingDetailsVoResultBean.getData() != null) { |
|
|
|
map.put("createOrgName", invoicingDetailsVoResultBean.getData().getUseOrgName()); |
|
|
|
}else{ |
|
|
|
return rb.setMsg("请先完善公司开票信息"); |
|
|
|
} |
|
|
|
// 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); |
|
|
|
if(appOrderDetailsVo.getInsuranceState()){ |
|
|
|
map.put("insuranceInfo", insuranceInfo); |
|
|
|
} |
|
|
|
map.put("totalPrice", totalPrice); |
|
|
|
map.put("priceRemarks", priceRemarks); |
|
|
|
map.put("depositTotal", depositTotal); |
|
|
@ -1405,7 +1620,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
ExecutorService pool = new ThreadPoolExecutor(2, 100, |
|
|
|
0L, TimeUnit.MILLISECONDS, |
|
|
|
new LinkedBlockingQueue<Runnable>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); |
|
|
|
/* Future<String> future1 = pool.submit(() -> { |
|
|
|
Future<String> future1 = pool.submit(() -> { |
|
|
|
return genCarSaleContract(dto, map, appOrderDetailsVo); |
|
|
|
}); |
|
|
|
PrintConfirmVo printConfirmVo = null; |
|
|
@ -1433,12 +1648,75 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
printConfirmVo.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + future2.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
url = url + "," + future2.get(); |
|
|
|
}*/ |
|
|
|
} |
|
|
|
//接收车辆委托书
|
|
|
|
Future<String> future4 = pool.submit(() -> { |
|
|
|
return getReceiveCar(map, appOrderDetailsVo); |
|
|
|
}); |
|
|
|
Future<String> future5 = pool.submit(() -> { |
|
|
|
return getInvoicMessage(map, appOrderDetailsVo); |
|
|
|
}); |
|
|
|
String singleFinalPriceOne = priceInfo.getSingleFinalPrice(); |
|
|
|
String depositOne = depositInfo.getDeposit(); |
|
|
|
//单台成交价与单台订金相等
|
|
|
|
Future<String> future6 = null; |
|
|
|
if (new BigDecimal(singleFinalPriceOne).compareTo(new BigDecimal(depositOne)) != 0) { |
|
|
|
future6 = pool.submit(() -> { |
|
|
|
return getCarFin(map, appOrderDetailsVo); |
|
|
|
}); |
|
|
|
} |
|
|
|
Future<String> future7 = pool.submit(() -> { |
|
|
|
return getMoneyFin(map, appOrderDetailsVo); |
|
|
|
}); |
|
|
|
Future<String> future8 = null; |
|
|
|
if (!"02".equals(appOrderDetailsVo.getInvoiceType())) { |
|
|
|
future8 = pool.submit(() -> { |
|
|
|
return getCarContract(map, appOrderDetailsVo); |
|
|
|
}); |
|
|
|
} |
|
|
|
List<File> filesList = new ArrayList<>(); |
|
|
|
//合并pdf文件
|
|
|
|
if (future8 != null) { |
|
|
|
if (StringUtils.isNotBlank(future8.get())) { |
|
|
|
File file = new File(docPdfComponent.getUploadTemplateUrl() + future8.get()); |
|
|
|
filesList.add(file); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(future4.get())) { |
|
|
|
File file = new File(docPdfComponent.getUploadTemplateUrl() + future4.get()); |
|
|
|
filesList.add(file); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(future5.get())) { |
|
|
|
File file = new File(docPdfComponent.getUploadTemplateUrl() + future5.get()); |
|
|
|
filesList.add(file); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(future6.get())) { |
|
|
|
File file = new File(docPdfComponent.getUploadTemplateUrl() + future6.get()); |
|
|
|
filesList.add(file); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(future7.get())) { |
|
|
|
File file = new File(docPdfComponent.getUploadTemplateUrl() + future7.get()); |
|
|
|
filesList.add(file); |
|
|
|
} |
|
|
|
String urlAll = ""; |
|
|
|
if (filesList.size() > 0) { |
|
|
|
String typeName = ContractTemplateEnum.CONTRACTALL.getName() + "_" + DateUtil.format(new Date(), "yyyMMdd") + System.currentTimeMillis() + ".pdf"; |
|
|
|
File allFile = WordConvertUtils.mulFile2One(filesList, docPdfComponent.getUploadTemplateUrl() + typeName); |
|
|
|
System.out.println("-========" + docPdfComponent.getUploadTemplateUrl() + typeName); |
|
|
|
urlAll = typeName; |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(urlAll)) { |
|
|
|
printConfirmVo = new PrintConfirmVo(); |
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CONTRACTALL.getName())); |
|
|
|
printConfirmVo.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + urlAll); |
|
|
|
list.add(printConfirmVo); |
|
|
|
} |
|
|
|
//生成合同数据
|
|
|
|
//根据销售订单sid查询合同表中是否存在
|
|
|
|
CommonContractBuscenterVo commonContractBuscenterVo = baseMapper.selectByBusSid(dto.getBusSid()); |
|
|
|
if (commonContractBuscenterVo == null) { |
|
|
|
String finalUrl = url; |
|
|
|
String finalUrlAll = urlAll; |
|
|
|
Future<String> future3 = pool.submit(() -> { |
|
|
|
//新增合同信息
|
|
|
|
CommonContract commonContract = new CommonContract(); |
|
|
@ -1455,7 +1733,8 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
//客户sid
|
|
|
|
commonContract.setCustomerSid(appOrderDetailsVo.getCustomerSid()); |
|
|
|
//业务员sid、业务员
|
|
|
|
commonContract.setStaffSid(appOrderDetailsVo.getUserSid()); |
|
|
|
commonContract.setStaffSid(appOrderDetailsVo.getStaffSid()); |
|
|
|
commonContract.setCreateBySid(appOrderDetailsVo.getUserSid()); |
|
|
|
commonContract.setStaffName(appOrderDetailsVo.getSellerName()); |
|
|
|
//分公司sid
|
|
|
|
commonContract.setOrgSid(appOrderDetailsVo.getOrgSid()); |
|
|
@ -1466,7 +1745,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
commonContract.setPartyB(customerName); |
|
|
|
//签订日期、签订地点
|
|
|
|
commonContract.setCreateDate(new Date()); |
|
|
|
commonContract.setAddress(""); |
|
|
|
commonContract.setAddress(address); |
|
|
|
//订金
|
|
|
|
commonContract.setDeposit(new BigDecimal(depositTotal)); |
|
|
|
//合同金额
|
|
|
@ -1487,6 +1766,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
commonContract.setCommonContractUrl(finalUrl); |
|
|
|
commonContract.setCustomerType(appOrderDetailsVo.getCustomerType()); |
|
|
|
commonContract.setCustomerTypeKey(appOrderDetailsVo.getCustomerKey()); |
|
|
|
commonContract.setContractUrlAll(finalUrlAll); |
|
|
|
save(commonContract); |
|
|
|
if (list.size() > 0) { |
|
|
|
//添加合同下载路径
|
|
|
@ -1520,8 +1800,8 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
//单台成交价与单台订金相等
|
|
|
|
if (new BigDecimal(singleFinalPrice).compareTo(new BigDecimal(deposit)) != 0) {//推送车款
|
|
|
|
String money = new BigDecimal(singleFinalPrice).subtract(new BigDecimal(deposit)).toString(); |
|
|
|
if ("现车".equals(appOrderDetailsVo.getOrderType())) { |
|
|
|
List<String> vinList = appOrderModelInfoVo.getVinList(); |
|
|
|
// if ("现车".equals(appOrderDetailsVo.getOrderType())) {
|
|
|
|
List<VinListsVo> vinList = appOrderModelInfoVo.getVinListsVos(); |
|
|
|
for (int i = 0; i < vinList.size(); i++) { |
|
|
|
UnCollectionDto unCollectionDto = new UnCollectionDto(); |
|
|
|
//合同sid
|
|
|
@ -1541,13 +1821,16 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
unCollectionDto.setReceivablesName("车款"); |
|
|
|
unCollectionDto.setCustomerPhone(appOrderDetailsVo.getPhone()); |
|
|
|
unCollectionDto.setUseOrgSid(appOrderDetailsVo.getUseOrgSid()); |
|
|
|
unCollectionDto.setVinNo(vinList.get(i).toString()); |
|
|
|
unCollectionDto.setVinNo(vinList.get(i).getVinNo()); |
|
|
|
unCollectionDto.setCurrentReceivableMoney(money); |
|
|
|
unCollectionDto.setUserSid(dto.getUserSid()); |
|
|
|
unCollectionDto.setReveivableMoney(money); |
|
|
|
unCollectionDto.setBusVinSid(vinList.get(i).getSid()); |
|
|
|
unCollectionDto.setPayType(appOrderDetailsVo.getPayType()); |
|
|
|
unCollectionDto.setPayTypeKey(appOrderDetailsVo.getPayTypeKey()); |
|
|
|
finUncollectedDetailedFeign.saveUnCollection(unCollectionDto); |
|
|
|
} |
|
|
|
} else { |
|
|
|
/* } else { |
|
|
|
int qualiy = Integer.valueOf(appOrderModelInfoVo.getTotal()).intValue(); |
|
|
|
for (int i = 0; i < qualiy; i++) { |
|
|
|
UnCollectionDto unCollectionDto = new UnCollectionDto(); |
|
|
@ -1573,12 +1856,12 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
unCollectionDto.setReveivableMoney(money); |
|
|
|
finUncollectedDetailedFeign.saveUnCollection(unCollectionDto); |
|
|
|
} |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
} |
|
|
|
//添加推送至款项确认的应收未收明细中
|
|
|
|
if ("现车".equals(appOrderDetailsVo.getOrderType())) { |
|
|
|
List<String> vinList = appOrderModelInfoVo.getVinList(); |
|
|
|
/* if ("现车".equals(appOrderDetailsVo.getOrderType())) {*/ |
|
|
|
List<VinListsVo> vinList = appOrderModelInfoVo.getVinListsVos(); |
|
|
|
for (int i = 0; i < vinList.size(); i++) { |
|
|
|
UnCollectionDto unCollectionDto = new UnCollectionDto(); |
|
|
|
//合同sid
|
|
|
@ -1598,13 +1881,16 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
unCollectionDto.setReceivablesName("订金"); |
|
|
|
unCollectionDto.setCustomerPhone(appOrderDetailsVo.getPhone()); |
|
|
|
unCollectionDto.setUseOrgSid(appOrderDetailsVo.getUseOrgSid()); |
|
|
|
unCollectionDto.setVinNo(vinList.get(i).toString()); |
|
|
|
unCollectionDto.setVinNo(vinList.get(i).getVinNo()); |
|
|
|
unCollectionDto.setCurrentReceivableMoney(depositInfo.getDeposit()); |
|
|
|
unCollectionDto.setUserSid(dto.getUserSid()); |
|
|
|
unCollectionDto.setReveivableMoney(depositInfo.getDeposit()); |
|
|
|
unCollectionDto.setBusVinSid(vinList.get(i).getSid()); |
|
|
|
unCollectionDto.setPayType(appOrderDetailsVo.getPayType()); |
|
|
|
unCollectionDto.setPayTypeKey(appOrderDetailsVo.getPayTypeKey()); |
|
|
|
finUncollectedDetailedFeign.saveUnCollection(unCollectionDto); |
|
|
|
} |
|
|
|
} else { |
|
|
|
/*} else { |
|
|
|
int qualiy = Integer.valueOf(appOrderModelInfoVo.getTotal()).intValue(); |
|
|
|
for (int i = 0; i < qualiy; i++) { |
|
|
|
UnCollectionDto unCollectionDto = new UnCollectionDto(); |
|
|
@ -1630,7 +1916,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
unCollectionDto.setReveivableMoney(depositInfo.getDeposit()); |
|
|
|
finUncollectedDetailedFeign.saveUnCollection(unCollectionDto); |
|
|
|
} |
|
|
|
} |
|
|
|
}*/ |
|
|
|
return commonContract.getSid(); |
|
|
|
}); |
|
|
|
} |
|
|
@ -1794,7 +2080,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
ResultBean<List<LatestTaskVo>> listResultBean = flowTaskFeign.getLatestTasks(procId); |
|
|
|
String nextNodeUserSids = listResultBean.getData().get(0).getASSIGNEE_(); |
|
|
|
List<String> receiveSidList = Arrays.asList(nextNodeUserSids.split(",")); |
|
|
|
if (receiveSidList.size() == 1 && receiveSidList.get(0).equals(commonContract.getStaffSid())) { |
|
|
|
if (receiveSidList.size() == 1 && receiveSidList.get(0).equals(commonContract.getCreateBySid())) { |
|
|
|
messageFlowableQuery.setMsgContent("您提交的" + messageFlowableQuery.getModuleName() + "已被驳回,请重新提交"); |
|
|
|
} else { |
|
|
|
messageFlowableQuery.setMsgContent(commonContract.getStaffName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|