| | |
| | | LWhFormOutput lWhFormOutput = lWhFormOutputService.get(new LWhFormOutput(id)); |
| | | LWhFormOutputExtendVO lWhFormOutputExtendVO = new LWhFormOutputExtendVO(); |
| | | BeanUtils.copyProperties(lWhFormOutput, lWhFormOutputExtendVO); |
| | | lWhFormOutputExtendVO.setDoc(lWhFormOutput.getOutputDoc()); |
| | | |
| | | String sql = "SELECT bgt.id, CATEGORY_ID, CATEGORY_NAME, GOODS_NAME " |
| | | + "FROM l_wh_procure_model pm LEFT JOIN base_goods_models bgm ON bgm.id = pm.BASE_GOODS_MODELS_ID " |
| | |
| | | } |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, map); |
| | | downLoadExcel("111", response, workbook); |
| | | downLoadExcel("采购退货单", response, workbook); |
| | | |
| | | // try (OutputStream outputStream = response.getOutputStream()) { |
| | | // response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); |
| | | // response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("采购退货单1.xlsx", "utf-8")); |
| | | // workbook.write(outputStream); |
| | | // workbook.close(); |
| | | // } |
| | | } |
| | | |
| | | private void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) throws IOException { |
| | | private void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) { |
| | | try (OutputStream out = response.getOutputStream()) { |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setHeader("content-Type", "application/vnd.ms-excel"); |
| | |
| | | response.setHeader("Content-Length", String.valueOf(baos.size())); |
| | | out.write(baos.toByteArray()); |
| | | } catch (Exception e) { |
| | | try { |
| | | throw new Exception(e.getMessage()); |
| | | } catch (Exception e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | logger.error("导出文件失败", e); |
| | | } |
| | | } |
| | | |