Commit 0b398542743b7868b44816d9caa835b387e09633
1 parent
a0fcfb90
模板下载动态赋值单位下拉选
Showing
1 changed file
with
6 additions
and
4 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/costfee/CostFeeController.java
| ... | ... | @@ -72,6 +72,7 @@ public class CostFeeController{ |
| 72 | 72 | */ |
| 73 | 73 | @GetMapping("/get-import-template") |
| 74 | 74 | @Operation(summary = "获得导入用户模板") |
| 75 | + @PermitAll | |
| 75 | 76 | public void importTemplate(HttpServletResponse response, |
| 76 | 77 | @RequestParam("templateName") String templateName) throws IOException { |
| 77 | 78 | // 参数校验 |
| ... | ... | @@ -112,10 +113,11 @@ public class CostFeeController{ |
| 112 | 113 | |
| 113 | 114 | // 设置下载响应头 |
| 114 | 115 | response.reset(); |
| 115 | - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); | |
| 116 | - response.setCharacterEncoding("UTF-8"); | |
| 117 | - String encodedName = URLEncoder.encode(downloadFileName, "UTF-8"); | |
| 118 | - response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''" + encodedName); | |
| 116 | + response.setContentType(EXCEL_MIME_TYPE); | |
| 117 | + // response.setCharacterEncoding("UTF-8"); | |
| 118 | + String encodedName = URLEncoder.encode(downloadFileName, "UTF-8").replaceAll("\\+", "%20"); | |
| 119 | + response.setHeader("Content-Disposition", "attachment;filename=" + encodedName); | |
| 120 | + response.setHeader("Cache-Control", "no-store"); // 禁止缓存 | |
| 119 | 121 | |
| 120 | 122 | try (InputStream in = resource.getInputStream(); |
| 121 | 123 | XSSFWorkbook workbook = new XSSFWorkbook(in); | ... | ... |