Commit ae9bfa35 authored by 竹天卫's avatar 竹天卫

导出优化

parent 529867a9
...@@ -292,7 +292,7 @@ public class SampleServiceImpl extends ServiceImpl<SampleMapper, Sample> impleme ...@@ -292,7 +292,7 @@ public class SampleServiceImpl extends ServiceImpl<SampleMapper, Sample> impleme
Map<String, Object> map = new HashMap<>(3); Map<String, Object> map = new HashMap<>(3);
map.put("start", start); map.put("start", start);
map.put("end", end); map.put("end", end);
map.put("name", sampleName); map.put("sampleName", sampleName);
map.put("cementCode", cementCode); map.put("cementCode", cementCode);
List<SampleWord> list = sampleMapper.exportWordList(map); List<SampleWord> list = sampleMapper.exportWordList(map);
......
...@@ -47,7 +47,7 @@ public class ExcelUtil { ...@@ -47,7 +47,7 @@ public class ExcelUtil {
byteArrayOutputStream = new ByteArrayOutputStream(); byteArrayOutputStream = new ByteArrayOutputStream();
workbook.write(byteArrayOutputStream); workbook.write(byteArrayOutputStream);
String suffix = ".xls"; String suffix = ".xlsx";
response.setContentType("application/vnd.ms-excel;charset=utf-8"); response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", response.setHeader("Content-Disposition",
"attachment;filename=" + new String((fileName + suffix).getBytes(), "iso-8859-1")); "attachment;filename=" + new String((fileName + suffix).getBytes(), "iso-8859-1"));
...@@ -84,7 +84,7 @@ public class ExcelUtil { ...@@ -84,7 +84,7 @@ public class ExcelUtil {
byteArrayOutputStream = new ByteArrayOutputStream(); byteArrayOutputStream = new ByteArrayOutputStream();
workbook.write(byteArrayOutputStream); workbook.write(byteArrayOutputStream);
String suffix = ".xls"; String suffix = ".xlsx";
response.setContentType("application/vnd.ms-excel;charset=utf-8"); response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", response.setHeader("Content-Disposition",
"attachment;filename=" + new String((fileName + suffix).getBytes(), "iso-8859-1")); "attachment;filename=" + new String((fileName + suffix).getBytes(), "iso-8859-1"));
...@@ -120,7 +120,7 @@ public class ExcelUtil { ...@@ -120,7 +120,7 @@ public class ExcelUtil {
byteArrayOutputStream = new ByteArrayOutputStream(); byteArrayOutputStream = new ByteArrayOutputStream();
workbook.write(byteArrayOutputStream); workbook.write(byteArrayOutputStream);
String suffix = ".xls"; String suffix = ".xlsx";
response.setContentType("application/vnd.ms-excel;charset=utf-8"); response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", response.setHeader("Content-Disposition",
"attachment;filename=" + new String((fileName + suffix).getBytes(), "iso-8859-1")); "attachment;filename=" + new String((fileName + suffix).getBytes(), "iso-8859-1"));
...@@ -464,7 +464,6 @@ public class ExcelUtil { ...@@ -464,7 +464,6 @@ public class ExcelUtil {
@SuppressWarnings("resource") @SuppressWarnings("resource")
public static List<Map<Integer, String>> readData(FileInputStream fis) throws Exception { public static List<Map<Integer, String>> readData(FileInputStream fis) throws Exception {
XSSFWorkbook hwb = new XSSFWorkbook(fis); XSSFWorkbook hwb = new XSSFWorkbook(fis);
List<Map<Integer, String>> usermap = new ArrayList<>(); List<Map<Integer, String>> usermap = new ArrayList<>();
// 获取第一个sheet页 // 获取第一个sheet页
XSSFSheet sheetAt = hwb.getSheetAt(0); XSSFSheet sheetAt = hwb.getSheetAt(0);
...@@ -507,16 +506,6 @@ public class ExcelUtil { ...@@ -507,16 +506,6 @@ public class ExcelUtil {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
//指定数据存放的位置 //指定数据存放的位置
OutputStream outputStream = new FileOutputStream("D:\\test.xlsx"); OutputStream outputStream = new FileOutputStream("D:\\test.xlsx");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment