销售订单增加导出PI功能

This commit is contained in:
Mrking 2024-11-02 15:56:37 +08:00
parent a1f6556df5
commit b3b8f40d03
3 changed files with 24 additions and 4 deletions

View File

@ -88,6 +88,10 @@ public class SaleOrderRespVO {
@ExcelProperty("货币")
private String currency;
@Schema(description = "邮箱")
@ExcelProperty("邮箱")
private String emails;
@Schema(description = "发票备注")
@ExcelProperty("发票备注")
private String invoiceRemarks;

View File

@ -22,7 +22,8 @@ public interface SaleOrderConvert {
// @Mapping(target = "id", ignore = true),
@Mapping(source = "invoiceCode", target = "invoiceCode"),
@Mapping(source = "invoiceName", target = "invoiceName"),
@Mapping(source = "address", target = "address")
@Mapping(source = "address", target = "address"),
@Mapping(source = "emails", target = "emails")
})
SaleOrderRespVO convert(SaleOrderDO bean);

View File

@ -329,13 +329,28 @@ public class SaleOrderServiceImpl implements SaleOrderService {
Long saleContractId = generateSaleContract(saleOrder,entrys);
String htmlContent = generateHtmlContent(saleContractId);
String fileName = StrUtil.format(pdfPath+"/SaleContract_{}",
new Date().getTime());
//docker生成路径
String pathUrl = System.getProperty("user.dir") + "/pdffile";
String fileName = StrUtil.format(pathUrl+"/SaleContract_{}", saleOrder.getBillno());
//主宿机生成路径
String fileName2 = StrUtil.format(pdfPath+"/SaleContract_{}", saleOrder.getBillno());
String templatePath = fileName + ".html";
String pdfPath = fileName + ".pdf";
String templatePath2 = fileName2 + ".html";
String pdfPath2 = fileName2 + ".pdf";
FileUtil.writeString(htmlContent,templatePath, "UTF-8");
WKHtmlToPdfUtil.convert(templatePath, pdfPath);
log.info("已生成HTML文件"+templatePath);
//请求wkapp
JSONObject params2 = new JSONObject();
params2.put("input_html_path","file://"+templatePath2);
params2.put("output_pdf_path",pdfPath2);
log.info("请求wkapp接口url"+wkappUrl+"/exehtmltopdf");
String result = HttpUtil.post(wkappUrl + "/exehtmltopdf", params2, 5 * 60 * 1000);
log.info("请求wkapp接口返回结果"+result);
//发送消息
String emails = saleOrder.getEmails();