修复 只导出html

This commit is contained in:
yf 2025-01-20 10:52:16 +08:00
parent e01f3c9918
commit 7bbd610392
1 changed files with 3 additions and 23 deletions

View File

@ -1225,9 +1225,6 @@ public class SaleOrderServiceImpl implements SaleOrderService {
System.out.println("创建目录:"+pathUrl);
file1.mkdirs();
}
// 主机地址
String targetPath = pdfPath + "/dsf";
targetPath = targetPath.replaceAll("//", "/");
List<File> files = new ArrayList<>();
List<String> delFiles = new ArrayList<>();
for (SaleOrderSkuDO skuDO : skuDOS) {
@ -1247,28 +1244,11 @@ public class SaleOrderServiceImpl implements SaleOrderService {
e.printStackTrace();
}
//宿主机pdf生成路径
String ouput = StrUtil.format(targetPath + "/{}_{}.pdf",(s+"_"+orderQty),name);
// 宿主机html地址
String inputPath = StrUtil.format(targetPath + "/{}_{}.html",(s+"_"+orderQty),name);
String htmlText = HttpUtil.get(sourceFile);
FileUtil.writeString(htmlText, templatePath2, "UTF-8");
//请求wkapp
JSONObject params = new JSONObject();
params.put("input_html_path", inputPath);
params.put("output_pdf_path", ouput);
System.out.println("params"+params);
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(ouput);
System.out.println("ouput:"+ouput);
File file = FileUtil.file(templatePath2);
files.add(file);
// delFiles.add(ouput);
// delFiles.add(templatePath2);
delFiles.add(templatePath2);
}
}
if(FuncUtil.isEmpty(files)){
@ -1276,7 +1256,7 @@ public class SaleOrderServiceImpl implements SaleOrderService {
}
System.out.println("files:"+files);
String zipFileName = StrUtil.format(targetPath + "/订单稿件_{}.zip", new Date().getTime());
String zipFileName = StrUtil.format(pathUrl + "/订单稿件_{}.zip", new Date().getTime());
// 压缩到的位置
File zipFile = new File(zipFileName);