소스 검색

新授权书

njs 2 년 전
부모
커밋
3af68104d9

+ 2 - 0
suishenbang-system/src/main/java/com/dgtly/system/domain/PosBeanInfo.java

@@ -40,6 +40,8 @@ public class PosBeanInfo {
 		this.posY = posY;
 	}
 
+
+
 	public PosBeanInfo(String posPage, Float posX, Float posY) {
 		this.posPage = posPage;
 		this.posX = posX;

+ 4 - 2
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/EsignController.java

@@ -244,13 +244,15 @@ public class EsignController extends ApiBaseController {
                 orderFile.setbId(bId);
                 orderFile.setTypes(1);
                 orderFile.setEntrustName(entrustName);
-                orderFile.setRun_time(runTime);
+                //截取-之前区间字符串
+                String startTime =runTime.substring(0,16);
+                orderFile.setRun_time(startTime);
                 ESignUpPDFModal fileModal = eSignService.uploadDriver(orderFile);
                 /*1、根据传入订单id,查询订单相关信息生成PDF,调用e签宝上传方法返回文件fileId*/
                 Object fileId = fileModal.getFileId();
                 logger.info("签署授权返回文件id:{}",fileId);
                 /*2、调用E签宝接口一步发起流程,得到返回的流程id*/
-                String flowId = signService.oneStepFlow(businessScene, fileId.toString(),fileModal.getX(),fileModal.getY(), fileName, signerAccountId, authorizedAccountId,redirectUrl);
+                String flowId = signService.oneStepFlowDriver(businessScene, fileId.toString(),fileModal.getX(),fileModal.getY(),fileModal.getX2(),fileModal.getY2(), fileName, signerAccountId, authorizedAccountId,redirectUrl);
                 logger.info("签署授权一步发起完成流程id:{}",flowId);
                 orderFile.setFlowId(flowId);
                 orderFileService.insertOrderFile(orderFile);

+ 19 - 0
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/domain/ESignUpPDFModal.java

@@ -14,6 +14,9 @@ public class ESignUpPDFModal {
      private String fileId;
      private float X;
      private float Y;
+     //第二个盖章位置
+     private float X2;
+     private float Y2;
      private String page;
 
     public String getFilePath() {
@@ -48,6 +51,22 @@ public class ESignUpPDFModal {
         Y = y;
     }
 
+    public float getX2() {
+        return X2;
+    }
+
+    public void setX2(float x2) {
+        X2 = x2;
+    }
+
+    public float getY2() {
+        return Y2;
+    }
+
+    public void setY2(float y2) {
+        Y2 = y2;
+    }
+
     public String getPage() {
         return page;
     }

+ 9 - 1
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/IEsignSignService.java

@@ -8,6 +8,14 @@ import com.dgtly.wxportal.domain.OrderFile;
  * @date:2020/10/13 10:29
  */
 public interface IEsignSignService {
+    /**
+     * @description: 司机授权书
+     * @param: [businessScene, fileId, posX, posY, posX2, posY2, fileName, signerAccountId, authorizedAccountId, redirectUrl]
+     * @return: java.lang.String
+     * @author: njs     
+     * @date: 2023/3/1 10:32
+     */
+    public String oneStepFlowDriver(String businessScene, String fileId,float posX,float posY,float posX2,float posY2, String fileName, String signerAccountId, String authorizedAccountId,String redirectUrl);
     /**
      * @description: 一步发起签署
      * @param: [accountId]
@@ -15,7 +23,7 @@ public interface IEsignSignService {
      * @author: qxm
      * @date: 2020/10/12 16:05
      */
-    public String oneStepFlow(String businessScene, String fileId,float posX,float posY, String fileName, String signerAccountId, String authorizedAccountId,String redirectUrl);
+    public String oneStepFlow(String businessScene, String fileId,float posX,float posY,String fileName, String signerAccountId, String authorizedAccountId,String redirectUrl);
 
     /**
      * @description: 开启签署流程

+ 8 - 2
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/impl/ESignServiceImpl.java

@@ -91,6 +91,7 @@ public class ESignServiceImpl implements ESignService {
         receivingNote.setCarNumber(orderFile.getCarNumber());
         receivingNote.setDeliveryNumber(orderFile.getDeliveryNumber());
         receivingNote.setEntrustName(orderFile.getEntrustName());
+        receivingNote.setBelongTo(orderFile.getChainsCode());
 
         Map<String,Object> map = new HashMap<>();
         //创建PDF
@@ -348,13 +349,18 @@ public class ESignServiceImpl implements ESignService {
             log.error("生成PDF出错:",e);
         }
         //计算宽高
-        Float fosX = 520F;
-        Float fosY = 495F;
+        Float fosX = 430F;
+        Float fosY = 465F;
 //        for (int i =0;i<size;i++){
 //           fosY = fosY-11f;
 //        }
         res.setX(fosX);
         res.setY(fosY);
+        //第二个盖章位置
+        Float fosX2 = 100F;
+        Float fosY2 = 400F;
+        res.setX2(fosX2);
+        res.setY2(fosY2);
         res.setFilePath(fileUrl);
         return res;
     }

+ 77 - 7
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/impl/EsignSignServiceImpl.java

@@ -51,19 +51,40 @@ public class EsignSignServiceImpl implements IEsignSignService {
     private String cloudPath;
     //完成收货回调
     private String confirmUrl="order/order/deliver-quantity-confirm/confirmCollect";
+
+
+
+   /**
+    * @description: 司机授权书
+    * @param: [businessScene, fileId, posX, posY, posX2, posY2, fileName, signerAccountId, authorizedAccountId, redirectUrl]
+    * @return: java.lang.String
+    * @author: njs
+    * @date: 2023/2/28 16:10
+    */
+    @Override
+    public String oneStepFlowDriver(String businessScene, String fileId, float posX, float posY, float posX2, float posY2, String fileName, String signerAccountId, String authorizedAccountId, String redirectUrl) {
+        JSONObject json = buildParamDriver(businessScene, fileId,posX,posY,posX2,posY2, fileName, signerAccountId,authorizedAccountId,redirectUrl);
+        JSONObject jsonObject = eSignHttpUtil.doPostGetJson(ESignUrl.CreateFlowOneStepUrl,json);
+        JSONObject result = (JSONObject)jsonObject.get("data");
+        return result.get("flowId").toString();
+    }
     /**
+     * @param businessScene
+     * @param fileId
+     * @param posX
+     * @param posY
+     * @param fileName
+     * @param signerAccountId
+     * @param authorizedAccountId
+     * @param redirectUrl
      * @description: 一步发起签署
-     * @param: [copierAccountId, fileId, fileName, signerAccountId]
-     * copierAccountId 抄送人id
-     * fileId 文档id
-     * fileName 文件名称
-     * signerAccountId 签署操作人个人账号标识,即操作本次签署的个人注:平台用户自动签署时,该参数需要传入签署主体账号id
+     * @param: [accountId]
      * @return: java.lang.String
      * @author: qxm
-     * @date: 2020/10/13 9:15
+     * @date: 2020/10/12 16:05
      */
     @Override
-    public String oneStepFlow(String businessScene, String fileId,float posX,float posY, String fileName, String signerAccountId,String authorizedAccountId,String redirectUrl) {
+    public String oneStepFlow(String businessScene, String fileId, float posX, float posY, String fileName, String signerAccountId, String authorizedAccountId, String redirectUrl) {
         JSONObject json = buildParam(businessScene, fileId,posX,posY, fileName, signerAccountId,authorizedAccountId,redirectUrl);
         JSONObject jsonObject = eSignHttpUtil.doPostGetJson(ESignUrl.CreateFlowOneStepUrl,json);
         JSONObject result = (JSONObject)jsonObject.get("data");
@@ -251,9 +272,58 @@ public class EsignSignServiceImpl implements IEsignSignService {
         // 平台方
         PosBeanInfo posBean1 = new PosBeanInfo("1", posX, posY); // 签署位置
         SignfieldInfo signfield1 = new SignfieldInfo(true, fileId, null, null, null, posBean1, null); // 签署区(签署主体是公司)
+
+//        SignfieldInfo signfield1 = new SignfieldInfo(false, fileId, null, null, null, posBean1, null); // 签署区(个人签署)
+        List<SignfieldInfo> signfields = new ArrayList<>();
+        signfields.add(signfield1);
+//        SignerAccount signAccount = new SignerAccount(signerAccountId, signerAccountId);//签署方账号
+        SignerAccount signAccount = new SignerAccount(authorizedAccountId);//签署方账号
+        Signer signer1 = new Signer(false, 1, signAccount, signfields, null); // 签署方
+        // 用户方
+//        PosBeanInfo posBean2 = new PosBeanInfo("1", 200F, 100F); // 签署位置
+//        SignfieldInfo signfield2 = new SignfieldInfo(false, null, fileId, null, null, null, posBean2, null); // 签署区
+//        List<SignfieldInfo> signfields1 = new ArrayList<>();
+//        signfields1.add(signfield2);
+//        Signer signer2 = new Signer(false, 1, signAccount, signfields1, null); //用户方
+        List<Signer> signers = new ArrayList<>();//Lists.newArrayList(signer1, signer2);
+        signers.add(signer1);
+//        signers.add(signer2);
+
+        //拼接参数
+        return buildOneStepFlowParam(attachments, copiers, docs, flowInfo, signers);
+    }
+
+    private  JSONObject buildParamDriver(String businessScene, String fileId,float posX,float posY,float posX2,float posY2, String fileName, String signerAccountId,String authorizedAccountId,String redirectUrl) {
+        // 附件信息列表 这里模拟没有附件的情况
+        List<Attachment> attachments = new ArrayList<>();
+
+        // 抄送人列表 这里模拟有一个抄送人
+        Copier copier = new Copier(signerAccountId, 0, null);
+        List<Copier> copiers = new ArrayList<>(); // Lists.newArrayList() 是guava 的写法
+        copiers.add(copier);
+
+        // 待签文件列表,这里模拟只有一个待签文件
+        Doc doc = new Doc(fileId, fileName);
+
+        List<Doc> docs = new ArrayList<>();//Lists.newArrayList(doc);
+        docs.add(doc);
+
+        // 流程配置,可以不配置,使用默认配置
+        String noticeDeveloperUrl = eSignConfig.getSignSuccessUrl();//回调通知URL
+        FlowConfigInfo flowConfigInfo = new FlowConfigInfo(noticeDeveloperUrl, "1,2", null, null);
+        FlowInfo flowInfo = new FlowInfo(true,true,businessScene,flowConfigInfo);
+
+        // 签署方信息
+        // 平台方
+        PosBeanInfo posBean1 = new PosBeanInfo("1", posX, posY); // 签署位置
+        PosBeanInfo posBean2 = new PosBeanInfo("1", posX2, posY2); // 签署位置
+        SignfieldInfo signfield1 = new SignfieldInfo(true, fileId, null, null, null, posBean1, null); // 签署区(签署主体是公司)
+        SignfieldInfo signfield2 = new SignfieldInfo(true, fileId, null, null, null, posBean2, null); // 签署区(签署主体是公司)
+
 //        SignfieldInfo signfield1 = new SignfieldInfo(false, fileId, null, null, null, posBean1, null); // 签署区(个人签署)
         List<SignfieldInfo> signfields = new ArrayList<>();
         signfields.add(signfield1);
+        signfields.add(signfield2);
 //        SignerAccount signAccount = new SignerAccount(signerAccountId, signerAccountId);//签署方账号
         SignerAccount signAccount = new SignerAccount(authorizedAccountId);//签署方账号
         Signer signer1 = new Signer(false, 1, signAccount, signfields, null); // 签署方

+ 37 - 53
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/utils/pdf/PDFSelfUtil.java

@@ -187,15 +187,21 @@ public class PDFSelfUtil {
 
                 // 3.打开文档
                 document.open();
-                document.addTitle("随  身  邦  收  货  单");// 标题
+                document.addTitle("随  身  邦  授  权  单");// 标题
                 document.addAuthor("");// 作者
                 document.addSubject("");// 主题
                 document.addKeywords("");// 关键字
                 document.addCreator("");// 创建者
-
-
+                OrderSelfNote note=new OrderSelfNote();
+                note.setBeentrustName("小鱼");
+                note.setOrderCreationTime("2023-01-25 22:12");
+                note.setEntrustName("南安市天华装饰材料有限公司");
+                note.setbId("310112199009133333");
+                note.setDeliveryNumber("6107014416, 6106986125");
+                note.setCarNumber("沪A66666");
+                note.setBelongTo("0110053958");
                 // 4.向文档中添加内容
-//                PDFUtil.generateEPDF(document,"XXX公司",null,null);
+                generateEPDF(document,note,false);
 
                 // 5.关闭文档
                 document.close();
@@ -218,12 +224,12 @@ public class PDFSelfUtil {
             try {
                 // 不同字体(这里定义为同一种字体:包含不同字号、不同style)
                 BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
-                titlefont = new Font(bfChinese, 16, Font.NORMAL);
+                titlefont = new Font(bfChinese, 16, Font.BOLD);
                 headfont = new Font(bfChinese, 14, Font.BOLD);
                 keyfont = new Font(bfChinese, 10, Font.BOLD);
                 namefont = new Font(bfChinese, 12, Font.BOLD);
                 textfont = new Font(bfChinese, 10, Font.NORMAL);
-                centry=new Font(bfChinese,12,Font.NORMAL);
+                centry=new Font(bfChinese,11,Font.BOLD);
             } catch (Exception e) {
                 e.printStackTrace();
             }
@@ -240,20 +246,10 @@ public class PDFSelfUtil {
         paragraph.setIndentationLeft(12); //设置左缩进
         paragraph.setIndentationRight(12); //设置右缩进
         paragraph.setFirstLineIndent(24); //设置首行缩进
-        paragraph.setLeading(5f); //行间距
+        paragraph.setLeading(8f); //行间距
         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()));
@@ -261,7 +257,7 @@ public class PDFSelfUtil {
 //        Paragraph paragraph1 = new Paragraph("客户名称: " +receivingNote.getCustomerName() +"                           " +
 //        "                                                     运单号: " +receivingNote.getShipmentNumber(), namefont);
         Paragraph paragraph1 = new Paragraph();
-        paragraph1.setLeading(20f); //行间距
+        paragraph1.setLeading(60f); //行间距
         paragraph1.setSpacingBefore(2f); //设置段落上空白
         paragraph1.setSpacingAfter(2f); //设置段落下空白
         document.add(paragraph1);
@@ -292,52 +288,40 @@ public class PDFSelfUtil {
         //时间格式校验
         String str=receivingNote.getOrderCreationTime();
         SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd");
-        Date date =sdf.parse(str);
+        Date dateOrder =sdf.parse(str);
+        Calendar calendarOrder = Calendar.getInstance();
+        calendarOrder.setTime(dateOrder);
+        String time = str.substring( str.indexOf(" "));
+        Date date=new Date();
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(date);
         // 表格
         PdfPTable table = createTable(new float[] { 80, 80, 80, 80, 80, 80 ,80,80});
-        table.addCell(createCell("客  户  自  提  委  托  书", titlefont, Element.ALIGN_CENTER, 8, false));
-
-
-    /*    PdfPTable table = createTable(new float[] { 160, 60, 60,60});
-        table.addCell(createCell("委托人(名称): " +receivingNote.getEntrustName()+"\n\n"+
-                "受托(提货)人:姓名: " +receivingNote.getBeentrustName()+"       身份证号码: " +receivingNote.getbId()+"        车牌: " +receivingNote.getCarNumber()+"\n\n"+
-                "     委托人委托受托人于   "+calendar.get(Calendar.YEAR)+" 年 "+(calendar.get(Calendar.MONTH)+1)+"月"+calendar.get(Calendar.DATE)+" 日 "+"  来贵司提取交货单号为  "+receivingNote.getDeliveryNumber()+"    上所载明的货物。"+"\n\n"+
-                "          特此委托!。"+"\n\n\n\n"+
-                " 委托人: "+receivingNote.getEntrustName()+"\n\n", keyfont, Element.ALIGN_LEFT, 2, false));
-
-
-*/     Paragraph paragraph6 = new Paragraph();
-        paragraph6.setLeading(20f); //行间距*/
+        table.addCell(createCell("客户自提授权委托书", titlefont, Element.ALIGN_CENTER, 8, false));
+        Paragraph paragraph6 = new Paragraph();
+        paragraph6.setLeading(50f); //行间距*/
         document.add(paragraph1);
-        table.addCell(createCell(" 委托人(名称):姓名:      "+receivingNote.getEntrustName()+"\n\n"+
-                "受托(提货)人:姓名:       "+receivingNote.getBeentrustName()+"    身份证号码:   "+receivingNote.getbId()+"  车牌:  "+receivingNote.getCarNumber()+"\n\n"+
-                 "           委托人委托受托人于   "+calendar.get(Calendar.YEAR)+"  年  "+(calendar.get(Calendar.MONTH)+1)+"  月  "+calendar.get(Calendar.DATE)+"  日  "+" 来贵司提取交货单号为  "+receivingNote.getDeliveryNumber()+"\n\n"+
-                        "  上所载明的货物。  \n\n"+
+        table.addCell(createCell("致立邦装饰材料(广州)有限公司:  "+"\n\n"+"      兹 有 委 托 人:    "+receivingNote.getEntrustName()+"("+receivingNote.getBelongTo()+")"+"  全 权 委 托 受 托 人:    "+ receivingNote.getBeentrustName() +" 于 以 下 预 约"+
+                " 时 间 前 往 贵 公 司 提 取 立 邦 交 货 清 单( 编 号      "+receivingNote.getDeliveryNumber()+"    )上立邦产品,   "+
+                " 授 权 其 代 为 我 公 司 向 贵 公 司 提 货 、 确 认 产 品 数 量 和 外 观 , 并 签 收 上 述 授 权 事 宜 对 "+
+                " 应 的 交 货 (清) 单 及 提 货 资 料 , 我 公 司 表 示 认 可 并 接 受 因 此 造 成 的 一 切 法 律 后 果 。"+"\n"+
+                "        本 授 权 委 托 书 期 限 自 委 托 人 签 署 盖 章 后 生 效 , 自 委 托 人 确 定 “ 预 约 提 货 日 期 十 日 内 有 效。"+"\n\n"+
+                "受托人姓名:  "+"【"+receivingNote.getBeentrustName()+"】"+"\n\n" +
+                "受托人身份证:  "+"【"+receivingNote.getbId()+"】"+"\n\n"+
+                "受托人车牌号:  "+"【"+receivingNote.getCarNumber()+"】"+"\n\n"+
+                "自提交货(清单)单号:   "+"【"+receivingNote.getDeliveryNumber()+"】"+"\n\n"+
+                "预约提货日期和时间:"+calendarOrder.get(Calendar.YEAR)+"年"+(calendarOrder.get(Calendar.MONTH)+1)+"  月  "+calendarOrder.get(Calendar.DATE)+"  日   "+time+"\n\n"+
                         "特此委托!\n\n\n"
                 , centry, Element.ALIGN_LEFT, 7, false));
         document.add(paragraph1);
-       /* table.addCell(createCell("       \n " +
-                "受托(提货)人:姓名: "+receivingNote.getBeentrustName(), centry, Element.ALIGN_LEFT, 7, false));*/
-    /*    table.addCell(createCell(" 身份证号码: "+receivingNote.getbId(), centry, Element.ALIGN_LEFT, 7, false));
-        table.addCell(createCell(" 车牌: "+receivingNote.getCarNumber(), centry, Element.ALIGN_LEFT, 7, false));
-        table.addCell(createCell(" 委托人委托受托人于 "+calendar.get(Calendar.YEAR)+" 年 "+(calendar.get(Calendar.MONTH)+1)+"月"+calendar.get(Calendar.DATE)+" 日 ", centry, Element.ALIGN_LEFT, 8, false));
-        table.addCell(createCell(" 来贵司提取交货单号为  "+receivingNote.getDeliveryNumber()+"    上所载明的货物。  \n" +
-                "特此委托!\n", keyfont, Element.ALIGN_CENTER, 8, false));
-        table.addCell(createCell(" 特此委托!\n ", keyfont, Element.ALIGN_LEFT, 7, true));*/
         table.addCell(createCell("", keyfont, Element.ALIGN_LEFT, 7, true));
-        table.addCell(createCell(" 委托人:"+receivingNote.getEntrustName(), centry, Element.ALIGN_LEFT, 8, false));
-        table.addCell(createCell(" 受托(提货)人:"+receivingNote.getBeentrustName(), centry, Element.ALIGN_LEFT, 9, false));
-        table.addCell(createCell(calendar.get(Calendar.YEAR)+"年"+(calendar.get(Calendar.MONTH)+1)+"月"+calendar.get(Calendar.DATE)+"日", centry, Element.ALIGN_RIGHT, 10, false));
-        table.addCell(createCell("委托人盖章:", centry, Element.ALIGN_RIGHT, 11, false));
+        table.addCell(createCell(" 受托(提货)人签字印鉴:"+receivingNote.getBeentrustName()+"                                              委托人授权收货预留印章", centry,Element.ALIGN_LEFT , 8, false));
+        table.addCell(createCell(" 委托人确认:", centry, Element.ALIGN_LEFT, 11, false));
+        table.addCell(createCell(   calendar.get(Calendar.YEAR)+"年"+(calendar.get(Calendar.MONTH)+1)+"月"+calendar.get(Calendar.DATE)+"日", centry, Element.ALIGN_LEFT, 10, false));
         document.add(paragraph1);
         table.addCell(createCell("注意事项:\n" +
-                "1、受托(提货)人须携带身份证或驾驶证原件。\n" +
-                "2、本委托书必须注明立邦公司交货单号。\n" +
-                "3、本委托书必须盖有与销售合同中预留相一致的印章。\n" +
-                "4、仓库不接受传真的公章印鉴(外埠客户因特殊原因自提时,携带的传真件必须得到当地办事处相关人员确认后方为有效)。\n" +
-                "5、本委托书自委托人确定的提货日期后的十日内有效。", textfont, Element.ALIGN_LEFT, 12, false));
+                "1、受托(提货)人应当携带身份证或驾驶证原件。\n" +
+                "2、甲方提货地点不接受传真或电子方式的“客户自提授权委托书”。", centry, Element.ALIGN_LEFT, 12, false));
 
 
         document.add(table);