6
异常代码
//数据库中获取数据
List<QryOrdListbyDayInfo> dataList = data(qryOrdListbyDayReq);
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
//获取年月日作为文件名
String dateName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
String filename = URLEncoder.encode(dateName, "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + filename + ".xlsx");
EasyExcel.write(response.getOutputStream(), QryOrdListbyDayInfo.class).sheet("sheet").doWrite(dataList);
异常提示 使用 postman 调用可以保存为正常的 .xlsx 文件,前台 vue post 调用返回乱码,且不能弹窗下载