Commit 43543c34 authored by litengwei's avatar litengwei

中心检测问题处理

parent 08481913
......@@ -180,13 +180,8 @@ public class TaskController extends AbstractBaseController{
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
Source source = new StreamSource(inputStream);
try {
ClassPathResource classPathResource = new ClassPathResource("temp/template.xsl");
InputStream stream = classPathResource.getInputStream();
Source template = new StreamSource(stream);
//String html = "D://10.html";
Date date = new Date();
Source source = new StreamSource(inputStream);
String path = request.getSession().getServletContext().getRealPath("/");
String dir = path.substring(0, path.indexOf(File.separator)+1) + "print";
String html = path.substring(0, path.indexOf(File.separator)+1) + "print"+File.separator+"task_" + date.getTime() + ".html";
......@@ -194,6 +189,14 @@ public class TaskController extends AbstractBaseController{
if (!dirFile.exists()) {
dirFile.mkdirs();
}
File htmlFile = new File(html);
try (
FileInputStream fis = new FileInputStream(htmlFile);
){
ClassPathResource classPathResource = new ClassPathResource("temp/template.xsl");
InputStream stream = classPathResource.getInputStream();
Source template = new StreamSource(stream);
//String html = "D://10.html";
Result result=new StreamResult(html);
TransformerFactory transformerFactory = TransformerFactory.newInstance();
......@@ -202,8 +205,6 @@ public class TaskController extends AbstractBaseController{
Transformer transformer = transformerFactory.newTransformer(template);
transformer.transform(source, result);
File htmlFile = new File(html);
FileInputStream fis = new FileInputStream(htmlFile);
String data = IOUtils.toString(fis, "utf-8");
fis.close();
if (htmlFile.exists()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment