fix(88615): 标准拆分--编辑--导出文件打不开

This commit is contained in:
yjz
2024-08-15 09:24:14 +08:00
parent b81242833d
commit 6f0c983046
@@ -4087,13 +4087,20 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
}
try{
//创建临时文件夹
String fileNowPath = uploadpath + "/tempZip/" + UUID.randomUUID().toString().replace("-","") + File.separator + fileOriName;
String tempPath = "";
if (fileOriName.length() > 10){
int index = fileOriName.lastIndexOf(".");
tempPath = fileOriName.substring(0, 50) + fileOriName.substring(index);
}
// String fileNowPath = uploadpath + "/tempZip/" + UUID.randomUUID().toString().replace("-","") + File.separator + fileOriName;
String fileNowPath = uploadpath + "/tempZip/" + UUID.randomUUID().toString().replace("-","") + File.separator + tempPath;
File nowFile = new File(fileNowPath);
if (nowFile.exists()){
nowFile.delete();
}
nowFile.mkdirs();
String fileName = fileOriName.replace(".zip", "") + ".xls";
// String fileName = fileOriName.replace(".zip", "") + ".xls";
String fileName = tempPath.replace(".zip", "") + ".xls";
// 设置表格相关属性
HSSFSheet sheetItems = workbook.createSheet("条文内容");
String[] headers = getWorkbookTitleForExport(cut); // 获取表头
@@ -4362,7 +4369,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
String repFileName = fileName.replaceAll("/","_");
excelOS = new FileOutputStream(fileNowPath + File.separator + repFileName);
response.setHeader("Content-Disposition",
"attachment; filename=\""+ ReadExcel.encodeFileName(fileOriName+".zip", request) +"\"");
"attachment; filename=\""+ ReadExcel.encodeFileName(tempPath+".zip", request) +"\"");
response.setContentType("application/force-download");
response.flushBuffer();
os = response.getOutputStream();