@RequestMapping("/uploadInfos") public String uploadInfos(HttpServletRequest request) throws Exception { UploadFile uploadFile = FileUpDownUtils.getUploadFile(request); byte[] fileData = FileUpDownUtils.getFileContent(uploadFile.getFile()); String result = physicalReportManager.importInfo(fileData, FrameworkContextUtils.getCurrentLoginName()); request.setAttribute("result", result); return getFileBasePath() + "importResult"; }
/** * @Title: uploadPhysicalReport @Description: 上传体检报告 * * @param request * @return * @throws Exception * @throws * @author 陈传洞 */ @RequestMapping("/uploadPhysicalReport") public String uploadPhysicalReport(HttpServletRequest request) throws Exception { // 上传结果 String resMsg = ""; // 卡号 String cardNum = request.getParameter("cardNum"); String subOrderId = request.getParameter("subOrderId"); if (StringUtils.isNotBlank(cardNum) && StringUtils.isNotBlank(subOrderId)) { UploadFile uploadFile = FileUpDownUtils.getUploadFile(request); byte[] reportFileData = FileUpDownUtils.getFileContent(uploadFile.getFile()); PhysicalReportInfo physicalReportInfo = physicalReportManager.uploadPhysicalReport( reportFileData, cardNum, uploadFile.getFileName(), Long.valueOf(subOrderId)); if (physicalReportInfo.getObjectId() != null) { resMsg = "上传体检报告成功!"; } } if (resMsg.length() == 0) { resMsg = "上传体检报告失败!"; } request.setAttribute("resMsg", resMsg); return getFileBasePath() + "importPhysicalReportResult"; }
/** * 导入的模板 * * @param request * @param response * @param companyId * @return * @throws Exception */ @RequestMapping("/exportTemplate") public String exportTemplate(HttpServletRequest request, HttpServletResponse response) throws Exception { HSSFWorkbook wb = new HSSFWorkbook(); // excel文件对象 HSSFSheet sheet = wb.createSheet("体检报告物流信息导入模板"); CellStyle style = getStyle(wb); CellRangeAddress range = new CellRangeAddress(0, 2, 0, 9); sheet.addMergedRegion(range); Row row0 = sheet.createRow(0); Cell cell00 = row0.createCell(0, Cell.CELL_TYPE_STRING); cell00.setCellStyle(style); cell00.setCellValue("说明:请正确填写如下信息,如‘HR订单账号’‘兑换子订单号’‘操作时间(2015/5/20)’"); sheet.autoSizeColumn(0); Row row1 = sheet.createRow(3); /* Cell cell0 = row1.createCell(0, Cell.CELL_TYPE_STRING); cell0.setCellStyle(style); cell0.setCellValue("物流面单号"); sheet.autoSizeColumn(0);*/ Cell cell1 = row1.createCell(0, Cell.CELL_TYPE_STRING); cell1.setCellStyle(style); cell1.setCellValue("总订单号"); sheet.autoSizeColumn(0); Cell cell2 = row1.createCell(1, Cell.CELL_TYPE_STRING); cell2.setCellStyle(style); cell2.setCellValue("兑换子订单号*"); sheet.autoSizeColumn(1); Cell cell3 = row1.createCell(2, Cell.CELL_TYPE_STRING); cell3.setCellStyle(style); cell3.setCellValue("物流公司编号*"); sheet.autoSizeColumn(2); Cell cell4 = row1.createCell(3, Cell.CELL_TYPE_STRING); cell4.setCellStyle(style); cell4.setCellValue("物流编号*"); sheet.autoSizeColumn(3); Cell cell6 = row1.createCell(4, Cell.CELL_TYPE_STRING); cell6.setCellStyle(style); cell6.setCellValue("更新人"); sheet.autoSizeColumn(4); Cell cell7 = row1.createCell(5, Cell.CELL_TYPE_STRING); cell7.setCellStyle(style); cell7.setCellValue("更新时间"); sheet.autoSizeColumn(5); Cell cell8 = row1.createCell(6, Cell.CELL_TYPE_STRING); cell8.setCellStyle(style); cell8.setCellValue("操作人"); sheet.autoSizeColumn(6); Cell cell9 = row1.createCell(7, Cell.CELL_TYPE_STRING); cell9.setCellStyle(style); cell9.setCellValue("导入时间"); sheet.autoSizeColumn(7); String fileName = FileUpDownUtils.encodeDownloadFileName(request, "体检物流信息导入模板" + ".xls"); FileUpDownUtils.setDownloadResponseHeaders(response, fileName); wb.write(response.getOutputStream()); return null; }