diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/saleorder/SaleOrderServiceImpl.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/saleorder/SaleOrderServiceImpl.java index 584d50f..1d7633e 100644 --- a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/saleorder/SaleOrderServiceImpl.java +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/saleorder/SaleOrderServiceImpl.java @@ -69,6 +69,7 @@ import cn.hangtag.module.system.service.mail.MailSendService; import cn.hangtag.module.system.service.user.AdminUserService; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; import cn.hutool.core.date.DateField; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; @@ -719,34 +720,37 @@ public class SaleOrderServiceImpl implements SaleOrderService { SaleContractSaveReqVO saleContractVO = toSaleContractVO(saleOrder, entrys); SaleContractDO saleContract = BeanUtils.toBean(saleContractVO, SaleContractDO.class); List saleContractEntrys = BeanUtils.toBean(saleContractVO.getSaleContractEntrys(), SaleContractEntryDO.class); - String htmlContent = generateHtmlContent(saleContract, saleContractEntrys); + List> split = ListUtil.split(saleContractEntrys, 6); + int i = 1; + for (List saleContractEntryDOS : split) { + String htmlContent = generateHtmlContent(saleContract, saleContractEntryDOS); - //docker生成路径 - String pathUrl = System.getProperty("user.dir") + "/pdffile"; - String fileName = StrUtil.format(pathUrl + "/SaleContract_{}", saleOrder.getBillno()); - //主宿机生成路径 - String fileName2 = StrUtil.format(pdfPath + "/SaleContract_{}", saleOrder.getBillno()); + //docker生成路径 + String pathUrl = System.getProperty("user.dir") + "/pdffile"; + String fileName = StrUtil.format(pathUrl + "/SaleContract_{}", saleOrder.getBillno()+"_"+i); + //主宿机生成路径 + String fileName2 = StrUtil.format(pdfPath + "/SaleContract_{}", saleOrder.getBillno()+"_"+i); - String templatePath = fileName + ".html"; - String pdfPath = fileName + ".pdf"; - String templatePath2 = fileName2 + ".html"; - String pdfPath2 = fileName2 + ".pdf"; - FileUtil.writeString(htmlContent, templatePath, "UTF-8"); - - log.info("已生成HTML文件:" + templatePath); - //请求wkapp - JSONObject params = new JSONObject(); - params.put("input_html_path", "file://" + templatePath2); - params.put("output_pdf_path", pdfPath2); - log.info("请求wkapp接口url:" + wkappUrl + "/exehtmltopdf"); - String result = HttpUtil.post(wkappUrl + "/exehtmltopdf", params, 5 * 60 * 1000); - log.info("请求wkapp接口返回结果:" + result); - //WKHtmlToPdfUtil.convert(templatePath, pdfPath); - File file = FileUtil.file(pdfPath); - files.add(file); - delFiles.add(pdfPath); - delFiles.add(templatePath); + String templatePath = fileName + ".html"; + String pdfPath = fileName + ".pdf"; + String templatePath2 = fileName2 + ".html"; + String pdfPath2 = fileName2 + ".pdf"; + FileUtil.writeString(htmlContent, templatePath, "UTF-8"); + log.info("已生成HTML文件:" + templatePath); + //请求wkapp + JSONObject params = new JSONObject(); + params.put("input_html_path", "file://" + templatePath2); + params.put("output_pdf_path", pdfPath2); + log.info("请求wkapp接口url:" + wkappUrl + "/exehtmltopdf"); + String result = HttpUtil.post(wkappUrl + "/exehtmltopdf", params, 5 * 60 * 1000); + log.info("请求wkapp接口返回结果:" + result); + //WKHtmlToPdfUtil.convert(templatePath, pdfPath); + File file = FileUtil.file(pdfPath); + files.add(file); + delFiles.add(pdfPath); + delFiles.add(templatePath); + } } String pathUrl = System.getProperty("user.dir") + "/pdffile"; String zipFileName = StrUtil.format(pathUrl + "/SaleContract_{}", new Date().getTime()); diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/resources/templates/pdf_template.html b/hangtag-module-oms/hangtag-module-oms-biz/src/main/resources/templates/pdf_template.html index abbf3f1..8925aa2 100644 --- a/hangtag-module-oms/hangtag-module-oms-biz/src/main/resources/templates/pdf_template.html +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/resources/templates/pdf_template.html @@ -240,6 +240,29 @@ 跨越多列的标题 + + + + 1 + Doe + 12344 + Doe + Doe + Doe + 2024-01-12 + + + + 跨越多列的标题 + + + + 跨越多列的标题 + + + + 跨越多列的标题 +