修复 文件导出

This commit is contained in:
yf 2025-01-20 10:18:46 +08:00
parent 70e2e167a7
commit bd2c1ccd6b
1 changed files with 15 additions and 3 deletions

View File

@ -1240,10 +1240,21 @@ public class SaleOrderServiceImpl implements SaleOrderService {
String name = DateUtil.format(LocalDateTime.now(), "yyyyMMdd")
+"-"+IdUtil.simpleUUID().substring(0, 4);
String ouput = StrUtil.format(targetPath + "/{}_{}.pdf",(s+"_"+orderQty),name);
String templatePath2 = StrUtil.format(targetPath + "/{}_{}.html",(s+"_"+orderQty),name);
File file2 = new File(templatePath2);
if(!file2.exists()){
try {
FileUtil.touch(templatePath2);
} catch (Exception e) {
e.printStackTrace();
}
}
String htmlText = HttpUtil.get(sourceFile);
System.out.println("htmlText:"+htmlText);
FileUtil.writeString(htmlText, templatePath2, "UTF-8");
//请求wkapp
JSONObject params = new JSONObject();
params.put("input_html_path", sourceFile);
params.put("input_html_path", "file://" + templatePath2);
params.put("output_pdf_path", ouput);
System.out.println("params"+params);
log.info("稿件导出 请求wkapp接口url" + wkappUrl + "/exehtmltopdf");
@ -1253,7 +1264,8 @@ public class SaleOrderServiceImpl implements SaleOrderService {
File file = FileUtil.file(ouput);
System.out.println("ouput:"+ouput);
files.add(file);
delFiles.add(ouput);
// delFiles.add(ouput);
// delFiles.add(templatePath2);
}
}
if(FuncUtil.isEmpty(files)){