11package com .doodl6 .springboot .web .controller ;
22
3- import com . alibaba .excel .EasyExcel ;
4- import com . alibaba .excel .ExcelReader ;
5- import com . alibaba .excel .metadata .Head ;
6- import com . alibaba .excel .read .builder .ExcelReaderSheetBuilder ;
7- import com . alibaba .excel .read .metadata .property .ExcelReadHeadProperty ;
3+ import cn . idev .excel .ExcelReader ;
4+ import cn . idev .excel .FastExcel ;
5+ import cn . idev .excel .metadata .Head ;
6+ import cn . idev .excel .read .builder .ExcelReaderSheetBuilder ;
7+ import cn . idev .excel .read .metadata .property .ExcelReadHeadProperty ;
88import com .doodl6 .springboot .common .excel .ExcelVersion ;
99import com .doodl6 .springboot .common .web .response .BaseResponse ;
1010import com .doodl6 .springboot .web .dto .ExcelData ;
@@ -60,7 +60,7 @@ public void down(HttpServletResponse response) {
6060 response .setContentType ("application/octet-stream" );
6161 // 设定Http头部
6262 response .setHeader ("Content-Disposition" , "attachment;fileName=" + URLEncoder .encode (fileName , StandardCharsets .UTF_8 ));
63- EasyExcel .write (response .getOutputStream (), ExcelData .class ).sheet ("人员数据" ).doWrite (dataList );
63+ FastExcel .write (response .getOutputStream (), ExcelData .class ).sheet ("人员数据" ).doWrite (dataList );
6464 } catch (Exception e ) {
6565 throw new IllegalStateException ("下载出现异常" , e );
6666 }
@@ -72,7 +72,7 @@ public void down(HttpServletResponse response) {
7272 @ Operation (summary = "上传文件" )
7373 @ PostMapping ("upload" )
7474 public BaseResponse <List <ExcelData >> upload (@ RequestParam MultipartFile file ) throws IOException {
75- ExcelReader excelReader = EasyExcel .read (file .getInputStream ()).head (ExcelData .class ).build ();
75+ ExcelReader excelReader = FastExcel .read (file .getInputStream ()).head (ExcelData .class ).build ();
7676 List <ExcelData > dataList = new ExcelReaderSheetBuilder (excelReader ).sheetNo (0 ).headRowNumber (1 ).doReadSync ();
7777 ExcelReadHeadProperty headProperty = excelReader .analysisContext ().currentReadHolder ().excelReadHeadProperty ();
7878 Set <String > headSet = headProperty .getHeadMap ().values ().stream ().map (Head ::getHeadNameList ).map (strings -> strings .get (0 )).collect (Collectors .toSet ());
0 commit comments