直接上代码
//关键代码 CommonsMultipartFile cFile = (CommonsMultipartFile) file; DiskFileItem fileItem = (DiskFileItem) cFile.getFileItem(); InputStream inputStream = fileItem.getInputStream(); ImportParams params = new ImportParams(); //直接转实体 List<YourEntity> entities = ExcelImportUtil.importExcel(inputStream, YourEntity.class, params);