谐波报告删除多余代码

This commit is contained in:
wr
2023-04-19 14:11:26 +08:00
parent 90c83a0c6b
commit 92aceff1e3
2 changed files with 3 additions and 31 deletions

View File

@@ -19,7 +19,7 @@ public class WordUtil2 {
// 日志记录
private static final Logger logger = LoggerFactory.getLogger(WordUtil2.class);
public void getWord(String path, Map<String, Object> params, String fileName, HttpServletResponse response, HttpSession session)
public void getWord(String path, Map<String, Object> params, String fileName, HttpServletResponse response)
throws Exception {
path = ClearPathUtil.cleanString(path);
File file = new File(path);
@@ -38,43 +38,15 @@ public class WordUtil2 {
inStream.close();
}
}
// //读取配置文件
// Properties pros = PubUtils.readProperties(getClass().getClassLoader(), "java.properties");
// String tmpPath = pros.get("TMP_PATH").toString() +File.separator+ "offlinereoprt";
// tmpPath= ClearPathUtil.cleanString(tmpPath);
// OutputStream os = null;
// File tmpfile = new File(tmpPath);
// if(!tmpfile.exists()){
// tmpfile.mkdir();
// }
// tmpPath = tmpPath +File.separator+ fileName;
// tmpPath= ClearPathUtil.cleanString(tmpPath);
// File tmp = new File(tmpPath);
// if(tmp.exists()){
// tmp.delete();
// }
// PubUtils.createFile(tmpPath);
try {
// os = new FileOutputStream(tmpPath);
// if (doc != null) {
// doc.write(os);
// }
ServletOutputStream outputStream = response.getOutputStream();
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
response.setContentType("application/octet-stream;charset=UTF-8");
doc.write(outputStream);
outputStream.close();
// session.setAttribute("tmpPath", tmpPath);
// session.setAttribute("fileName", fileName);
} catch (Exception e) {
session.setAttribute("tmpPath", "");
session.setAttribute("fileName", "");
logger.error("输出稳态报告异常,原因为:" + e.toString());
} finally {
// if (os != null) {
// os.close();
// }
if (doc != null) {
doc.close();
}