|
@@ -2034,6 +2034,43 @@ public class ExcelTabController extends BladeController {
|
|
|
return pdfUrl;
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/downBussPdf")
|
|
|
+ @ApiOperationSupport(order = 32)
|
|
|
+ @ApiOperation(value = "下载pdf数据")
|
|
|
+ @ApiImplicitParam(name = "id", value = "fileId")
|
|
|
+ public void downBussPdf(String id,HttpServletResponse response) throws Exception {
|
|
|
+
|
|
|
+ //获取节点下的所有表单,和附件,如果表单全是隐藏的,并且没有附件,则提示暂无数据
|
|
|
+ String sql = "select name,pdf_url,e_visa_pdf_url,node_pdf_url from u_information_query where id = " + id;
|
|
|
+ List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
|
|
|
+ if (maps.isEmpty()) {
|
|
|
+ throw new ServiceException("暂无PDF数据");
|
|
|
+ } else {
|
|
|
+ Map<String, Object> stringObjectMap = maps.get(0);
|
|
|
+ String pdfUrl = stringObjectMap.get("pdf_url") == null ? "" : stringObjectMap.get("pdf_url") + "";
|
|
|
+ String fileName = stringObjectMap.get("name") == null ? "找不到文件题名" : stringObjectMap.get("name") + "";
|
|
|
+ if (Func.isNotEmpty(stringObjectMap.get("node_pdf_url"))) {
|
|
|
+ pdfUrl = stringObjectMap.get("node_pdf_url") == null ? "" : stringObjectMap.get("node_pdf_url") + "";
|
|
|
+ } else if (Func.isNotEmpty(stringObjectMap.get("e_visa_pdf_url"))) {
|
|
|
+ //优先使用电签的pdf
|
|
|
+ pdfUrl = stringObjectMap.get("e_visa_pdf_url") == null ? "" : stringObjectMap.get("e_visa_pdf_url") + "";
|
|
|
+ }
|
|
|
+ if (pdfUrl.isEmpty()) {
|
|
|
+ throw new ServiceException("暂无PDF数据");
|
|
|
+ }
|
|
|
+ fileName = URLEncoder.encode(fileName, Charsets.UTF_8.name());
|
|
|
+ InputStream redio = CommonUtil.getOSSInputStream(pdfUrl);
|
|
|
+ byte[] buffer = IoUtil.readToByteArray(redio);
|
|
|
+ OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
|
|
|
+ response.setContentType("application/pdf");
|
|
|
+ response.setCharacterEncoding(org.apache.commons.codec.Charsets.UTF_8.name());
|
|
|
+ response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".pdf");
|
|
|
+ toClient.write(buffer);
|
|
|
+ toClient.flush();
|
|
|
+ toClient.close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 用户端删除复制信息表
|