1、Controller
//导入excel
@RequestMapping(value = "/import", method=RequestMethod.POST)
public JsonDto importExcel(@RequestParam(value="file",required = false) MultipartFile file,
HttpServletRequest request,
HttpServletResponse response){
return functionProjectRelationService.importExcelFile(file);
}
2、Service
public JsonDto importExcelFile(MultipartFile file) {
JsonDto jsonDto = new JsonDto();
try{
int successNum = 0;
int failureNum = 0;
ImportExcel ei = new ImportExcel(file, 0, 0);
Listlist = ei.getDataList(User.class);
logger.info("导入" + list.size() + "条数据");
jsonDto.setSuccess(Boolean.TRUE);
jsonDto.setErrcode("200");
jsonDto.setErrmsg("上传成功");
jsonDto