This commit is contained in:
qq787203167
2022-03-31 11:50:29 +08:00
2 changed files with 14 additions and 6 deletions
@@ -2923,7 +2923,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
public void exportTemplate(Map<String, Object> map, HttpServletResponse response, HttpServletRequest request) {
OutputStream os = null;
HSSFWorkbook workbook = new HSSFWorkbook();
String fileOriName = "导入模板";
String fileOriName = "文档库导入模板.xls";
String filePath = uploadpath + File.separator + fileOriName;
try {
List<String> list = getWorkbookTitle((String) map.get("cut"));
@@ -2933,7 +2933,6 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
nowFile.delete();
}
nowFile.mkdirs();
String fileName = "导入模板.xls";
HSSFSheet sheet = workbook.createSheet("文档库导入模板");
sheet.setDefaultColumnWidth(16);//列宽
HSSFCellStyle cellStyle = workbook.createCellStyle();
@@ -2967,7 +2966,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
}
response.setHeader("Content-Disposition",
"attachment; filename=\"" + fileOriName + ".xlsx");
"attachment; filename=\"" + fileOriName + ".xls");
response.setContentType("application/force-download");
response.flushBuffer();
os = response.getOutputStream();
@@ -3419,7 +3418,13 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
}
// 校验头部是否符合模板
String fields = list.get(0);
String substring = headerSb.substring(0, headerSb.length() - 1);
//判断结尾为逗号,则减1个字符
String substring = headerSb.toString();
if (substring.endsWith(",") || substring.endsWith("")){
substring = headerSb.substring(0, headerSb.length() - 1);
}
String excelHeader = substring.toString();
if (!fields.equals(excelHeader)) {
workbook.close();
@@ -3722,7 +3727,10 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
}
}
if (ObjectUtils.isNotEmpty(sb)) {
String substring = sb.substring(0, sb.length() - 1);
String substring = sb.toString();
if (substring.endsWith(",") || substring.endsWith("")){
substring = substring.substring(0, substring.length() - 1);
}
value = substring;
}
}
@@ -162,7 +162,7 @@
},
//下载模板
handleModule() {
downloadFile('document/bussDocumentLibraryEO/exportTemplate', '文档库.xls', {})
downloadFile('document/bussDocumentLibraryEO/exportTemplate', '文档库导入模板.xls', {})
},
//批量删除
handleDel() {