谐波报告删除多余代码
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class ExportModelController extends BaseController {
|
||||
|
||||
@PostMapping("/exportModel")
|
||||
@ApiOperation("word报告")
|
||||
public String exportworld(HttpSession session, HttpServletResponse response,
|
||||
public String exportworld(HttpServletResponse response,
|
||||
String startTime, String endTime, Integer type, String lineIndex,
|
||||
String name, String reportNumber, String crmName,
|
||||
MultipartFile file) throws IOException {
|
||||
@@ -1195,7 +1195,7 @@ public class ExportModelController extends BaseController {
|
||||
|
||||
WordUtil2 oRTF = new WordUtil2();
|
||||
try {
|
||||
oRTF.getWord(rtfPath, reportmap, name + formatter.format(currentTime) + ".docx", response, session);
|
||||
oRTF.getWord(rtfPath, reportmap, name + formatter.format(currentTime) + ".docx", response);
|
||||
} catch (Exception e) {
|
||||
log.error("获取报告发生异常,异常是" + e.getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user