| | |
| | | @ApiOperation(value = "导出报废单", notes = "导出报废单") |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "报废单id", dataType = "Long", paramType = "query")}) |
| | | @GetMapping("/deptList/export") |
| | | public void export(Long id, HttpServletResponse response) throws Exception { |
| | | public ResponseValue<String> export(Long id, HttpServletResponse response) throws Exception { |
| | | if (id == null) { |
| | | throw new RuntimeException("报废单id为空"); |
| | | } |
| | |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(exportParams, map); |
| | | // 设置响应头 |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("部门报废单.xlsx", "utf-8")); |
| | | try (OutputStream outputStream = response.getOutputStream()) { |
| | | workbook.write(outputStream); |
| | | workbook.close(); |
| | | } |
| | | // response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); |
| | | // response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("部门报废单.xlsx", "utf-8")); |
| | | // try (OutputStream outputStream = response.getOutputStream()) { |
| | | // workbook.write(outputStream); |
| | | // workbook.close(); |
| | | // } |
| | | String filePath = downLoadExcel("采购入库单", workbook); |
| | | return ResponseValue.success("导出成功", filePath); |
| | | |
| | | } |
| | | |
| | | @GetMapping("/deptListByModel") |