Преглед изворни кода

提交注册返回认证路径接口/认证成功回调接口

zhangding пре 4 година
родитељ
комит
f72b931617

+ 3 - 1
suishenbang-api/src/main/resources/application-dev.yml

@@ -118,4 +118,6 @@ esign:
 #  企业认证成功回调url
   organNotifyUrl: http://fanfanweb.iask.in/api/eSign/updateCustomersIsAuthentication
 #  签署成功回调url
-  signSuccessUrl: http://fanfanweb.iask.in/api/eSign/updateOrderFile
+  signSuccessUrl: http://fanfanweb.iask.in/api/eSign/updateOrderFile
+#  下载后的PDF路径
+  fileUrl: D:/szsm/uploadPath

+ 1 - 5
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/EsignController.java

@@ -83,10 +83,8 @@ public class EsignController extends ApiBaseController {
         /*首先根据订单id-orderId查询订单是否已被签署*/
         OrderFile orderFlag = orderFileService.selectOrderFileById(orderId);
         if (orderFlag==null) {
-
             /*1、根据传入订单id,查询订单相关信息生成PDF,调用e签宝上传方法返回文件fileId*/
-            String upload = eSignService.upload(orderId);
-            String fileId = "f6ada0144a464d7bb90224104d1c4ca3";
+            String fileId = eSignService.upload(orderId);
             /*2、调用E签宝接口一步发起流程,得到返回的流程id*/
             String flowId = signService.oneStepFlow(businessScene, fileId, fileName, signerAccountId, authorizedAccountId);
             /*3、调用E签宝获取签署地址*/
@@ -105,8 +103,6 @@ public class EsignController extends ApiBaseController {
         }
     }
 
-
-
     /**
      * 经销商通过签署地址签署后,回调此方法,通过flowId得到签署后的文件下载地址并保存url
      */

+ 6 - 0
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/config/ESignConfig.java

@@ -26,6 +26,8 @@ public class ESignConfig {
 
     @Value(value = "${esign.signSuccessUrl:none}")
     private String signSuccessUrl ;
+    @Value(value = "${esign.fileUrl:none}")
+    private String fileUrl;
     @Bean
     public ESignToken eSignTokenUtil(){
         ESignToken eSignToken =  new ESignToken();
@@ -60,4 +62,8 @@ public class ESignConfig {
     public String getSignSuccessUrl() {
         return signSuccessUrl;
     }
+
+    public String getFileUrl(){
+        return fileUrl;
+    }
 }

+ 7 - 4
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/impl/ESignServiceImpl.java

@@ -5,6 +5,7 @@ import com.dgtly.system.domain.CustomersExt;
 import com.dgtly.system.domain.SysUser;
 import com.dgtly.system.service.ICustomersExtService;
 import com.dgtly.system.service.ISysUserService;
+import com.dgtly.wxportal.config.ESignConfig;
 import com.dgtly.wxportal.service.ESignService;
 import com.dgtly.wxportal.utils.ESign.ESignHttpUtil;
 import com.dgtly.wxportal.utils.ESign.ESignUploadUtil;
@@ -38,6 +39,8 @@ public class ESignServiceImpl implements ESignService {
     private ISysUserService userService;
     @Autowired
     private ICustomersExtService customersExtService;
+    @Autowired
+    private ESignConfig eSignConfig;
 
     @Override
     public String upload(String orderId) {
@@ -55,7 +58,7 @@ public class ESignServiceImpl implements ESignService {
         //上传文件
         String res = eSignHttpUtil.upLoadFile(uploadUrl,filePath,md5,contentTtpe,fileLength);
 
-        return res;
+        return fileId;
     }
 
     @Override
@@ -169,7 +172,7 @@ public class ESignServiceImpl implements ESignService {
             Document document = new Document(PageSize.A4);// 建立一个Document对象
 
             // 2.建立一个书写器(Writer)与document对象关联
-            String uploadPath = "D:/szsm/uploadPath";
+            String uploadPath = eSignConfig.getFileUrl() ;
             File file = new File(uploadPath+File.separator+"PDFDemo.pdf");
             fileUrl = uploadPath+"/PDFDemo.pdf";
             file.createNewFile();
@@ -180,14 +183,14 @@ public class ESignServiceImpl implements ESignService {
 
             // 3.打开文档
             document.open();
-            document.addTitle("E    签   宝   租  铺  合  同 ");// 标题
+            document.addTitle("    签   宝   租  铺  合  同 ");// 标题
             document.addAuthor("");// 作者
             document.addSubject("");// 主题
             document.addKeywords("");// 关键字
             document.addCreator("");// 创建者
 
             // 4.向文档中添加内容
-            PDFUtil.generatePDF(document);
+            PDFUtil.generateEPDF(document,"11");
 
             // 5.关闭文档
             document.close();

+ 19 - 21
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/utils/pdf/PDFUtil.java

@@ -1,9 +1,11 @@
 package com.dgtly.wxportal.utils.pdf;
 
+import com.dgtly.wxportal.config.ESignConfig;
 import com.itextpdf.text.*;
 import com.itextpdf.text.pdf.*;
 import com.itextpdf.text.pdf.draw.DottedLineSeparator;
 import com.itextpdf.text.pdf.draw.LineSeparator;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -159,9 +161,13 @@ public class PDFUtil {
      * image.scalePercent(40);//依照比例缩放
      */
 
+
+
     // main测试
         public static void main(String[] args) throws Exception {
+
             try {
+
                 // 1.新建document对象
                 Document document = new Document(PageSize.A4);// 建立一个Document对象
 
@@ -227,6 +233,16 @@ public class PDFUtil {
         paragraph.setSpacingBefore(5f); //设置段落上空白
         paragraph.setSpacingAfter(10f); //设置段落下空白
         document.add(paragraph);
+
+        Paragraph paragraph2 = new Paragraph("发呢五分范文芳你得请我的飒",textfont);
+        paragraph2.setAlignment(1); //设置文字居中 0靠左   1,居中     2,靠右
+        paragraph2.setIndentationLeft(12); //设置左缩进
+        paragraph2.setIndentationRight(12); //设置右缩进
+        paragraph2.setFirstLineIndent(24); //设置首行缩进
+        paragraph2.setLeading(10f); //行间距
+        paragraph2.setSpacingBefore(5f); //设置段落上空白
+        paragraph2.setSpacingAfter(5f); //设置段落下空白
+        document.add(paragraph2);
         // 直线
         Paragraph p1 = new Paragraph();
         p1.add(new Chunk(new LineSeparator()));
@@ -234,7 +250,7 @@ public class PDFUtil {
         Paragraph paragraph1 = new Paragraph("客户名称: " +name+"", textfont);
         paragraph1.setLeading(20f); //行间距
         paragraph1.setSpacingBefore(5f); //设置段落上空白
-        paragraph1.setSpacingAfter(10f); //设置段落下空白
+        paragraph1.setSpacingAfter(5f); //设置段落下空白
         document.add(paragraph1);
         // 点线
         Paragraph p2 = new Paragraph();
@@ -281,25 +297,7 @@ public class PDFUtil {
         table.addCell(createCell("2020-08-13", textfont));
             document.add(table);
 
-        table = createTable(new float[] { 80, 80, 80, 80, 80, 80 ,80});
-        table.addCell(createCell("明细名称", keyfont, Element.ALIGN_CENTER));
-        table.addCell(createCell("采购数量", keyfont, Element.ALIGN_CENTER));
-        table.addCell(createCell("单位", keyfont, Element.ALIGN_CENTER));
-        table.addCell(createCell("预估单价", keyfont, Element.ALIGN_CENTER));
-        table.addCell(createCell("金额小计", keyfont, Element.ALIGN_CENTER));
-        table.addCell(createCell("规格", keyfont, Element.ALIGN_CENTER));
-        table.addCell(createCell("采购时间", keyfont, Element.ALIGN_CENTER));
-
-        table.addCell(createCell("笔记本", textfont));
-        table.addCell(createCell("5", textfont));
-        table.addCell(createCell("台", textfont));
-        table.addCell(createCell("2490", textfont));
-        table.addCell(createCell("12450", textfont));
-        table.addCell(createCell("适配", textfont));
-        table.addCell(createCell("2020-08-13",textfont));
-
-//      document.add(table);
-        document.add(p1);
+
 
         paragraph = new Paragraph("中标供应商信息", titlefont);
         paragraph.setAlignment(0); //设置文字居中 0靠左   1,居中     2,靠右
@@ -309,7 +307,7 @@ public class PDFUtil {
         paragraph.setLeading(20f); //行间距
         paragraph.setSpacingBefore(5f); //设置段落上空白
         paragraph.setSpacingAfter(10f); //设置段落下空白
-//            document.add(paragraph);
+            document.add(paragraph);
 
 
     }