private String handleDownload( Handle0773QueryResult result, List<ReplacementCardItemResult> changeItems) throws Exception { QueryDocumentContext document = new QueryDocumentContext(); String outputDir = QueryMethodUtils.generateOutputDir(getQueryCondition()); getLog().debug("查询任务的输入出目录是" + outputDir); getQueryCondition() .setPdfFile(outputDir + File.separator + getQueryCondition().getSlbhao() + ".pdf"); PDFMaker pdfMaker = new PdfMaker0773(getQueryCondition(), document); List<ReplacementCardItemResult> pageItem = new ArrayList<ReplacementCardItemResult>(); int itemNum = QueryConfUtils.getActiveConfig().getInt(QueryConstants.HANDLE_LINE_PER_PAGE, 35); int pageNum = 0; for (ReplacementCardItemResult item : changeItems) { pageItem.add(item); if (pageItem.size() != 0 && pageItem.size() % itemNum == 0) { pageNum++; Page<ReplacementCardItemResult> page = new Page<ReplacementCardItemResult>(); PageHeader header = getHeader(result.getKEHUZH(), result.getGERZWM()); header.setPageCount("" + pageNum); page.setHeader(header); header.setGuiyuan(getQueryCondition().getJio1gy()); page.setPageItem(pageItem); page.getHeader().setTips(result.getRemark()); try { pdfMaker.write(page); } catch (NeedNewDocumentException nDocEx) { getLog().info("需要创建新文档"); createNewDocument(getQueryCondition()); } page = null; } } if (pageItem.size() != 0) { pageNum++; Page<ReplacementCardItemResult> page = new Page<ReplacementCardItemResult>(); PageHeader header = getHeader(result.getKEHUZH(), result.getGERZWM()); header.setPageCount("" + pageNum); page.setHeader(header); page.setPageItem(pageItem); page.getHeader().setTips(result.getRemark()); try { pdfMaker.write(page); } catch (NeedNewDocumentException nDocEx) { getLog().info("需要创建新文档"); pdfMaker = new PdfMaker0773(getQueryCondition(), document); } page = null; } pdfMaker.endHtml(); pdfMaker.makePdf(); getQueryCondition().setPdfFile(document.getCurrentPDF().getFileName()); return getQueryCondition().getPdfFile(); }
public TxtMaker(PybjyEO record) { try { String outputDir = QueryMethodUtils.generateOutputDir(record); log.debug("查询任务的输入出目录是" + outputDir); File dirFile = new File(outputDir); dirFile.mkdirs(); txtFile = new File(outputDir, record.getSlbhao() + TXT_SUFFIX); printer = new PrintStream(new FileOutputStream(txtFile), false, DEFAULT_CHARSET); } catch (Exception e) { log.error(e.getMessage(), e); } log.info("开始为受理编码" + record.getSlbhao() + "构造TxtMaker,文件路径为:" + txtFile.getAbsolutePath()); }