fix(文档拆分): 78367
This commit is contained in:
+7
-6
@@ -793,13 +793,14 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
|
|||||||
sheet.addMergedRegion(region);
|
sheet.addMergedRegion(region);
|
||||||
|
|
||||||
// excel临时保存到本地并在同级创建文件夹
|
// excel临时保存到本地并在同级创建文件夹
|
||||||
generateExcel(workbook, fileName);
|
String replacePath = exportExcelTempPath.replace("exportExcelTemp", "拆分导入模版下载");
|
||||||
|
generateExcel(workbook, fileName, replacePath);
|
||||||
|
|
||||||
// 生成zip文件返回文件流
|
// 生成zip文件返回文件流
|
||||||
ZipUtil.toZip(exportExcelTempPath, response.getOutputStream(), response, true);
|
ZipUtil.toZip(replacePath, response.getOutputStream(), response, true);
|
||||||
|
|
||||||
//删除指定文件夹
|
//删除指定文件夹
|
||||||
FileUtils.deleteFolders(exportExcelTempPath);
|
FileUtils.deleteFolders(replacePath);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
throw new JeroBootException("下载文件失败!");
|
throw new JeroBootException("下载文件失败!");
|
||||||
}
|
}
|
||||||
@@ -833,14 +834,14 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private void generateExcel(Workbook workbook, String fileName) throws IOException {
|
private void generateExcel(Workbook workbook, String fileName, String replacePath) throws IOException {
|
||||||
File saveFile = new File(exportExcelTempPath);
|
File saveFile = new File(replacePath);
|
||||||
// 导出路径 没有则创建
|
// 导出路径 没有则创建
|
||||||
if (!saveFile.exists()) {
|
if (!saveFile.exists()) {
|
||||||
saveFile.mkdirs();
|
saveFile.mkdirs();
|
||||||
}
|
}
|
||||||
// 生成excel文件路径
|
// 生成excel文件路径
|
||||||
String excelPath = exportExcelTempPath + File.separator + fileName;
|
String excelPath = replacePath + File.separator + fileName;
|
||||||
// 写出excel文件
|
// 写出excel文件
|
||||||
try (FileOutputStream fos = new FileOutputStream(excelPath)){
|
try (FileOutputStream fos = new FileOutputStream(excelPath)){
|
||||||
workbook.write(fos);
|
workbook.write(fos);
|
||||||
|
|||||||
Reference in New Issue
Block a user