This commit is contained in:
wangzhijiang
2022-07-12 18:53:33 +08:00
parent d6519656c1
commit 195a581f94
@@ -156,8 +156,8 @@ public class LawsOpinionAssessmentResultEOServiceImpl extends ServiceImpl<LawsOp
@Override
public void exportXls(HttpServletResponse response, HttpServletRequest request, LawsOpinionAssessmentResultEO lawsOpinionAssessmentResultEO, Map<String,Object> params) {
Integer pageNo = (Integer) params.get("pageNo");
Integer pageSize = (Integer) params.get("pageSize");
Integer pageNo = Integer.parseInt(params.get("pageNo").toString());
Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
String exportAll = (String)params.get("exportAll");
String ids = (String)params.get("ids");
String cut = (String)params.get("cut");
@@ -191,6 +191,8 @@ public class LawsOpinionAssessmentResultEOServiceImpl extends ServiceImpl<LawsOp
OutputStream os = null;
HSSFWorkbook workbook = new HSSFWorkbook();
String path = uploadpath + "/tempZip/evaluationResults/" + System.currentTimeMillis();
try {
response.setHeader("Content-Disposition",
"attachment; filename=" + fileName);
@@ -227,12 +229,13 @@ public class LawsOpinionAssessmentResultEOServiceImpl extends ServiceImpl<LawsOp
dataRow.createCell(5).setCellValue(submitTimeStr);
}
}
if ("excel".equals(exportType)) {
os = response.getOutputStream();
workbook.write(os);
os.flush();
}else {
String path = uploadpath + "/tempZip/evaluationResults";
File fileTemp = new File(path);
if (fileTemp.exists()) {
fileTemp.delete();
@@ -282,6 +285,7 @@ public class LawsOpinionAssessmentResultEOServiceImpl extends ServiceImpl<LawsOp
}
os.flush();
fis.close();
excelOS.close();
}
}catch (IOException ex){
@@ -292,9 +296,9 @@ public class LawsOpinionAssessmentResultEOServiceImpl extends ServiceImpl<LawsOp
}
}finally {
IOUtils.closeQuietly(os);
File file = new File(uploadpath + "/tempZip/evaluationResults");
File file = new File(path);
FileUtil.deleteContents(file);
File fileTemp = new File(uploadpath + "/tempZip/evaluationResults.zip");
File fileTemp = new File(path + ".zip");
FileUtil.deleteContents(fileTemp);
}
}