|
|
@ -58,6 +58,7 @@ 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.base.utils.WordConvertUtils; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
@ -79,6 +80,8 @@ import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import static cn.hutool.core.util.ClassLoaderUtil.getClassLoader; |
|
|
|
|
|
|
|
/** |
|
|
|
* Project: anrui-base(安瑞基础) <br/> |
|
|
|
* File: CommonContractService.java <br/> |
|
|
@ -733,7 +736,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
*/ |
|
|
|
private String genCarSaleContract(PrintConfirmDto dto, Map<String, Object> map, AppOrderDetailsVo appOrderDetailsVo) { |
|
|
|
/* private String genCarSaleContract(PrintConfirmDto dto, Map<String, Object> map, AppOrderDetailsVo appOrderDetailsVo) { |
|
|
|
String url = ""; |
|
|
|
String typeName = ""; |
|
|
|
if ("现车".equals(appOrderDetailsVo.getOrderType())) { |
|
|
@ -745,6 +748,29 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
Map<String, String> resultMap = docPdfComponent.createDocToPdf(map, typeName, docName); |
|
|
|
url = resultMap.get("prefixTemplateUrl"); |
|
|
|
return url; |
|
|
|
}*/ |
|
|
|
private String genCarSaleContract(PrintConfirmDto dto, Map<String, Object> map, AppOrderDetailsVo appOrderDetailsVo) { |
|
|
|
File file = null; |
|
|
|
if ("现车".equals(appOrderDetailsVo.getOrderType())) { |
|
|
|
//获取模板
|
|
|
|
file = new File(getClass().getClassLoader().getResource("ftl/existingvehicles.ftl").getFile()); |
|
|
|
} else { |
|
|
|
//获取模板
|
|
|
|
file = new File(getClass().getClassLoader().getResource("ftl/orderacar.ftl").getFile()); |
|
|
|
} |
|
|
|
String dir = getClassLoader().getResource("ftl").getPath(); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String typeName = dateStr + seconds + ".doc"; |
|
|
|
WordConvertUtils.creatWord(map, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成出门证文件名
|
|
|
|
String pdfName = dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
return pdfName; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -755,7 +781,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
* @param appOrderDetailsVo |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private String genCarSaleContractBlank(PrintConfirmDto dto, Map<String, Object> map, AppOrderDetailsVo appOrderDetailsVo) { |
|
|
|
/*private String genCarSaleContractBlank(PrintConfirmDto dto, Map<String, Object> map, AppOrderDetailsVo appOrderDetailsVo) { |
|
|
|
String url = ""; |
|
|
|
String typeName = ""; |
|
|
|
String docName = ""; |
|
|
@ -776,6 +802,38 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
url += map2.get("prefixTemplateUrl"); |
|
|
|
} |
|
|
|
return url; |
|
|
|
}*/ |
|
|
|
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", ""); |
|
|
|
// 涉及高低开票的,需要打印两套合同,一套按照成交价打印(记账用),一套为价格空白的合同(开票用)
|
|
|
|
if ("1".equals(dto.getDiscountKey())) { |
|
|
|
// 现车
|
|
|
|
if ("现车".equals(appOrderDetailsVo.getOrderType())) { |
|
|
|
//获取模板
|
|
|
|
file = new File(getClass().getClassLoader().getResource("ftl/existingvehicles_black.ftl").getFile()); |
|
|
|
} else { |
|
|
|
// 订车获取模板
|
|
|
|
file = new File(getClass().getClassLoader().getResource("ftl/orderacar_black.ftl").getFile()); |
|
|
|
} |
|
|
|
String dir = getClassLoader().getResource("ftl").getPath(); |
|
|
|
//生成word文件名
|
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String typeName = dateStr + seconds + ".doc"; |
|
|
|
WordConvertUtils.creatWord(map, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
//生成合同文件名
|
|
|
|
String pdfName = dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
url = pdfName; |
|
|
|
} |
|
|
|
return url; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -1337,13 +1395,9 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
} else { |
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTBOOK.getName())); |
|
|
|
} |
|
|
|
printConfirmVo.setDownloadUrl(future1.get()); |
|
|
|
printConfirmVo.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + future1.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
if (StringUtils.isNotBlank(future1.get())) { |
|
|
|
if (future1.get().contains(docPdfComponent.getPrefixTemplateUrl())) { |
|
|
|
url = future1.get().replace(docPdfComponent.getPrefixTemplateUrl(), ""); |
|
|
|
} |
|
|
|
} |
|
|
|
url = future1.get(); |
|
|
|
} |
|
|
|
Future<String> future2 = pool.submit(() -> { |
|
|
|
return genCarSaleContractBlank(dto, map, appOrderDetailsVo); |
|
|
@ -1355,13 +1409,9 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
} else { |
|
|
|
printConfirmVo.setName(MessageFormat.format("《{0}》", ContractTemplateEnum.CARSALECONTRACTBOOKBLANK.getName())); |
|
|
|
} |
|
|
|
printConfirmVo.setDownloadUrl(future2.get()); |
|
|
|
printConfirmVo.setDownloadUrl(docPdfComponent.getPrefixTemplateUrl() + future2.get()); |
|
|
|
list.add(printConfirmVo); |
|
|
|
if (StringUtils.isNotBlank(future2.get())) { |
|
|
|
if (future2.get().contains(docPdfComponent.getPrefixTemplateUrl())) { |
|
|
|
url = url + "," + future2.get().replace(docPdfComponent.getPrefixTemplateUrl(), ""); |
|
|
|
} |
|
|
|
} |
|
|
|
url = url + "," + future2.get(); |
|
|
|
} |
|
|
|
//生成合同数据
|
|
|
|
//根据销售订单sid查询合同表中是否存在
|
|
|
@ -1493,9 +1543,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
unCollectionDto.setCurrentReceivableMoney(depositInfo.getDeposit()); |
|
|
|
finUncollectedDetailedFeign.saveUnCollection(unCollectionDto); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return commonContract.getSid(); |
|
|
|
}); |
|
|
|
} |
|
|
|