@ApiOperation(value = "菜单按钮导出模板下载", notes = "菜单按钮导出模板下载")
@SysLogAnnotation(module = "菜单按钮导出模板下载")
@ResponseBody
//@PreAuthorize("hasAuthority('upms:menu:download')")
@PostMapping(UpmsApi.MENU_DOWNLOAD)
public void menuDownload() throws IOException {
String fileName = URLEncoder.encode("菜单按钮导入模板.xlsx", "UTF-8");
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletResponse response = servletRequestAttributes.getResponse();
response.setCharacterEncoding("utf-8");
response.setContentType("application/vnd.ms-excel");
//-----------主要看这------------------//
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName);
IoUtils.copy(new ClassPathResource(URLDecoder.decode(fileName,"UTF-8")).getInputStream(), response.getOutputStream());
}