| | |
| | | private InsOrderMapper insOrderMapper; |
| | | |
| | | @Resource |
| | | private StandardMethodListMapper standardMethodListMapper; |
| | | |
| | | @Resource |
| | | private InsOrderStateMapper insOrderStateMapper; |
| | | |
| | | @Resource |
| | |
| | | } catch (Exception e) { |
| | | throw new ErrorException("找不到批准人的签名"); |
| | | } |
| | | //获取场所的报告专用章 |
| | | /* String sealUrl; |
| | | try { |
| | | String laboratory = insOrderMapper.selectById(insReport.getInsOrderId()).getLaboratory(); |
| | | sealUrl = insReportMapper.getLaboratoryByName(laboratory); |
| | | } catch (Exception e) { |
| | | throw new ErrorException("找不到报告专用章"); |
| | | } |
| | | if (sealUrl == null) throw new ErrorException("找不到报告专用章");*/ |
| | | //系统生成报告地址 |
| | | String url = insReport.getUrl(); |
| | | //手动上传报告地址 |
| | |
| | | public String wordToPdf(String wordPath, String pdfPath, String sealUrl) { |
| | | FileOutputStream os = null; |
| | | try { |
| | | //凭证 不然切换后有水印 |
| | | // InputStream inputStream = this.getClass().getResourceAsStream("/lib/license.xml"); |
| | | /*String url; |
| | | try { |
| | | InputStream inputStream = this.getClass().getResourceAsStream("/lib/license.xml"); |
| | | File file = File.createTempFile("temp", ".tmp"); |
| | | OutputStream outputStream = new FileOutputStream(file); |
| | | IOUtils.copy(inputStream, outputStream); |
| | | url = file.getAbsolutePath(); |
| | | } catch (FileNotFoundException e) { |
| | | throw new ErrorException("找不到模板文件"); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | }*/ |
| | | InputStream is = new ClassPathResource("/lib/license.xml").getInputStream(); |
| | | License license = new License(); |
| | | license.setLicense(is); |
| | |
| | | os = new FileOutputStream(file); |
| | | //要转换的word文件 |
| | | com.aspose.words.Document doc = new com.aspose.words.Document(wordPath); |
| | | TableCollection tables = doc.getFirstSection().getBody().getTables(); |
| | | for (Table table : tables) { |
| | | RowCollection rows = table.getRows(); |
| | | table.setAllowAutoFit(false); |
| | | for (Row row : rows) { |
| | | CellCollection cells = row.getCells(); |
| | | for (Cell cell : cells) { |
| | | CellFormat cellFormat = cell.getCellFormat(); |
| | | cellFormat.setFitText(false); //设置自适应关闭 |
| | | cellFormat.setWrapText(true); // 设置自动换行 |
| | | } |
| | | } |
| | | } |
| | | doc.save(os, SaveFormat.PDF); |
| | | |
| | | //添加骑缝章 |
| | | stamperCheckMarkPDF(pdfPath.replace(".pdf", "-1.pdf"), pdfPath, imgUrl + "/" + sealUrl); |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |