/**
* 导出模板
*/
@GetMapping("export/template")
@ApiOperationSupport(order = 16)
@ApiOperation(value = "导出模板")
public void exportTemplate(HttpServletResponse response) {
List<JointExcel> list = new ArrayList<>();
ClassPathResource classPathResource = new ClassPathResource("templates/Joint-import.xlsx");
try {
response.setContentType("application/vnd.ms-excel");
String fileName = URLEncoder.encode("法兰节点模板", "UTF-8");
response.setHeader("Content-disposition", "attachment;filename="+fileName+".xlsx");
InputStream is = classPathResource.getInputStream();
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(is).build();
WriteSheet writeSheet = EasyExcel.writerSheet(0).head(JointExcel.class).build();
excelWriter.write(list, writeSheet);
excelWriter.finish();
}catch (IOException e){
e.printStackTrace();
}
}