Kaynağa Gözat

自主下单/确认收货/自提授权委托确认书

njs 2 yıl önce
ebeveyn
işleme
5226d1cce5
13 değiştirilmiş dosya ile 433 ekleme ve 12 silme
  1. 10 0
      suishenbang-system/src/main/java/com/dgtly/system/domain/SysUser.java
  2. 21 0
      suishenbang-system/src/main/java/com/dgtly/system/util/AuthType.java
  3. 7 2
      suishenbang-system/src/main/resources/mapper/system/SysUserMapper.xml
  4. 97 0
      suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/EsignController.java
  5. 24 0
      suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/WxPortalController.java
  6. 48 1
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/domain/OrderFile.java
  7. 33 0
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/domain/OrderSelfNote.java
  8. 16 4
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/ESignService.java
  9. 2 0
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/IEsignSignService.java
  10. 92 0
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/impl/ESignServiceImpl.java
  11. 19 3
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/impl/EsignSignServiceImpl.java
  12. 51 2
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/utils/pdf/PDFSelfUtil.java
  13. 13 0
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/resources/mapper/wxportal/OrderFileMapper.xml

+ 10 - 0
suishenbang-system/src/main/java/com/dgtly/system/domain/SysUser.java

@@ -122,6 +122,8 @@ public class SysUser extends BaseEntity
     private String  isConsignee;
     /** 自主下单是否授权(0否1是)*/
     private String  isIndependently;
+    /**自提是否授权 0否1是*/
+    private String isSelfDelivery;
     /*企业认证状态0未认证1已认证*/
     private String isOrgAuthentication;
     /*企业认证时间*/
@@ -165,6 +167,14 @@ public class SysUser extends BaseEntity
 
     }
 
+    public String getIsSelfDelivery() {
+        return isSelfDelivery;
+    }
+
+    public void setIsSelfDelivery(String isSelfDelivery) {
+        this.isSelfDelivery = isSelfDelivery;
+    }
+
     public String getIsIndependently() {
         return isIndependently;
     }

+ 21 - 0
suishenbang-system/src/main/java/com/dgtly/system/util/AuthType.java

@@ -0,0 +1,21 @@
+package com.dgtly.system.util;
+
+/**
+ * @description: 授权类型
+ * @param:
+ * @return:
+ * @author: njs
+ * @date: 2023/3/22 13:16
+ */
+public class AuthType {
+
+    //确认产品数量和外观并签收产品
+    public final static String IS_CONSIGNEE = "1";
+    public final static String IS_CONSIGNEE_NAME = "确认产品数量和外观并签收产品";
+    //向立邦下达订单
+    public final static String IS_INDEPENDENTLY = "2";
+    public final static String IS_INDEPENDENTLY_NAME = "向立邦下达订单";
+    //指派司机到立邦提货
+    public final static String IS_SELFDELIVERY = "3";
+    public final static String IS_SELFDELIVERY_NAME = "指派司机到立邦提货";
+}

+ 7 - 2
suishenbang-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -33,6 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="remark"       column="remark"       />
 		<result property="isConsignee"       column="is_consignee"       />
 		<result property="isIndependently"  column="is_independently" />
+		<result property="isSelfDelivery" column="is_self_delivery" />
 		<result property="isSync"       column="is_sync"       />
 		<result property="quit"       column="quit"       />
 		<result property="isAuthentication"       column="is_authentication"       />
@@ -89,7 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	
 	<sql id="selectUserVo">
         select  u.user_id,u.company_id, u.dept_id, u.login_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.password, u.salt,u.id_type,u.id_number,u.account_id,u.is_authentication,u.receive_url_mobile_no, u.status,
-        		u.del_flag, u.login_ip, u.login_date, u.create_time, u.remark,u.is_consignee,u.person_attestation_time,u.is_independently,is_sync,
+        		u.del_flag, u.login_ip, u.login_date, u.create_time, u.remark,u.is_consignee,u.person_attestation_time,u.is_independently,u.is_self_delivery,is_sync,
         		c.company_name,u.quit,
        		    d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,
        		    r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,
@@ -105,7 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	
 	<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
 		select u.user_id,u.company_id, u.dept_id, u.login_name, u.user_name,u.id_type,u.id_number,u.account_id,u.is_authentication,u.receive_url_mobile_no, u.email, u.avatar,
-          u.phonenumber, u.password, u.sex, u.salt, u.status, u.del_flag,u.quit,u.is_independently,
+          u.phonenumber, u.password, u.sex, u.salt, u.status, u.del_flag,u.quit,u.is_independently,u.is_self_delivery,
           u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
           d.dept_name, d.leader,
 		suse.identity,suse.sales_level,suse.org_name,suse.org_code,suse.post_name,suse.is_customer_manager,ce.is_authentication is_org_authentication,ce.org_attestation_time
@@ -250,6 +251,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			u.account_id,
 			u.is_authentication,
 		    u.is_independently,
+			u.is_self_delivery,
 			u.receive_url_mobile_no,
 			u.STATUS,
 			u.del_flag,
@@ -337,6 +339,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="accountId != null and accountId != ''">account_id = #{accountId},</if>
  			<if test="isAuthentication != null and isAuthentication != ''">is_authentication = #{isAuthentication},</if>
 			<if test="isIndependently != null ">is_independently = #{isIndependently},</if>
+			<if test="isSelfDelivery !=null">is_self_delivery =#{isSelfDelivery},</if>
  			<if test="personAttestationTime != null">person_attestation_time = #{personAttestationTime},</if>
  			<if test="receiveUrlMobileNo != null and receiveUrlMobileNo != ''">receive_url_mobile_no = #{receiveUrlMobileNo},</if>
  			<if test="status != null and status != ''">status = #{status},</if>
@@ -377,6 +380,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="isConsignee != null">is_consignee = #{isConsignee},</if>
 			<if test="isSync != null">is_sync = #{isSync},</if>
 			<if test="isIndependently != null ">is_independently = #{isIndependently},</if>
+			<if test="isSelfDelivery !=null">is_self_delivery =#{isSelfDelivery},</if>
 			update_time = sysdate()
 		</set>
 		where login_name = #{loginName}
@@ -535,6 +539,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			u.user_name,
 			u.is_consignee,
 		    u.is_independently,
+			u.is_self_delivery,
 			v.sap_employee_id,
 		    v.is_customer_manager,
 			v.org_code

+ 97 - 0
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/EsignController.java

@@ -15,6 +15,7 @@ import com.dgtly.system.service.IAssRelcustomerinfoService;
 import com.dgtly.system.service.ICustomersExtService;
 import com.dgtly.system.service.ISysUserExtService;
 import com.dgtly.system.service.ISysUserService;
+import com.dgtly.system.util.AuthType;
 import com.dgtly.wxportal.config.ESignConfig;
 import com.dgtly.wxportal.domain.ESignUpPDFModal;
 import com.dgtly.wxportal.domain.OrderFile;
@@ -270,6 +271,102 @@ public class EsignController extends ApiBaseController {
         }
     }
 
+    /**
+     * 收货/自主下单/自提授权
+     *
+     *      * 没有注册就注册,注册完就认证,然后再点击签署按钮,获取经销商用户id,对应主体id
+     */
+    @ApiOperation(value = "收货/自主下单/自提授权", notes = "参数:{'userId':'xxx','customerCode':'xxx','customerName':'xxx','clientName':'xxx','clientPost':'xxx','trusteeName':'xxx','trusteePost':'xxx','authType':'xxx','redirectUrl':'xxx'}"+
+            "\n(userId:用户id" +
+            "\n(customerCode:经销商编码" +
+            "\n(customerName:经销商名称" +
+            "\n(clientName: 委托人名称" +
+            "\n(clientPost: 委托人职务" +
+            "\n(trusteeName: 受托人名称" +
+            "\n(trusteePost: 受托人职务" +
+            "\n(authType:委托标记" +
+            "\n(redirectUrl:签署完成跳转地址")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "params", paramType = "body")
+    })
+    @PostMapping("empowerByAuth")
+    public Object empowerByAuth() {
+
+        ParameterObject obj = getParameterObject();
+        obj.checkParameterNotNull("userId,customerCode,customerName,clientName,clientPost,trusteeName,trusteePost,authType,redirectUrl");
+        try {
+            String authName="";
+            String authType = obj.getString("authType");
+            if(AuthType.IS_CONSIGNEE.equals(authType)){
+                authName=AuthType.IS_CONSIGNEE_NAME;
+            }else if(AuthType.IS_INDEPENDENTLY.equals(authType)){
+                authName=AuthType.IS_INDEPENDENTLY_NAME;
+            }else if(AuthType.IS_SELFDELIVERY.equals(authType)){
+                authName=AuthType.IS_SELFDELIVERY_NAME;
+            }
+            String userId = obj.getString("userId");
+            String customerCode = obj.getString("customerCode");
+            String customerName = obj.getString("customerName");
+            String clientName = obj.getString("clientName");
+            String clientPost = obj.getString("clientPost");
+            String trusteeName = obj.getString("trusteeName");
+            String trusteePost=obj.getString("trusteePost");
+            String redirectUrl = obj.getString("redirectUrl");
+            logger.info("签署完成跳转地址:{}",redirectUrl);
+
+            String businessScene = "委托授权";
+            String fileName = UUID.randomUUID()+"_授权.pdf";
+            /*根据userId查询个人注册后accountId*/
+            String signerAccountId = "";
+            SysUser sysUser = userService.selectUserById(Long.parseLong(userId));
+            if (sysUser!=null){
+                signerAccountId=sysUser.getAccountId();
+            }
+            /*根据订单id关联查询企业注册后id*/
+            String authorizedAccountId =customersExtService.selectChainsCodeByOrderId(customerCode);
+            // authorizedAccountId = "563c540b67354026a5f84f6c5b9d8eb0";
+//            signService.signAuth(authorizedAccountId);
+            logger.info("签署人认证id:{}",authorizedAccountId);
+
+            /*4、保存订单id和flowId*/
+            OrderFile orderFile = new OrderFile();
+            orderFile.setChainsCode(customerCode);
+            orderFile.setCustomersCode(authorizedAccountId);
+            orderFile.setSignerId(signerAccountId);
+            orderFile.setSignerName(sysUser.getUserName());
+            String trusteePostName=trusteePost.replaceAll("1","经销商负责人").replaceAll("2","财务").replaceAll("3","仓管");
+            orderFile.setBeentrustPost(trusteePostName);
+            String clientPostName=clientPost.replaceAll("1","经销商负责人").replaceAll("2","财务").replaceAll("3","仓管");
+            orderFile.setEntrustPost(clientPostName);
+            orderFile.setAuthType(authType);
+            orderFile.setTypes(2);
+            orderFile.setEntrustName(clientName);
+            orderFile.setBeentrustName(trusteeName);
+            orderFile.setChainsName(customerName);
+            orderFile.setAuthName(authName);
+
+            ESignUpPDFModal fileModal = eSignService.uploadEmpowerByAuth(orderFile);
+            /*1、根据传入订单id,查询订单相关信息生成PDF,调用e签宝上传方法返回文件fileId*/
+            Object fileId = fileModal.getFileId();
+            logger.info("签署授权返回文件id:{}",fileId);
+            /*2、调用E签宝接口一步发起流程,得到返回的流程id*/
+            String flowId = signService.oneStepFlowempowerByAuth(businessScene, fileId.toString(),fileModal.getX(),fileModal.getY(),fileName, signerAccountId, authorizedAccountId,redirectUrl);
+            logger.info("签署授权一步发起完成流程id:{}",flowId);
+            orderFile.setFlowId(flowId);
+            orderFileService.insertOrderFile(orderFile);
+            logger.info("保存授权签署附件");
+            File f = new File(fileModal.getFilePath());
+            f.delete();
+            logger.info("授权成功");
+            return AjaxResult.success("授权成功");
+        } catch (Exception e) {
+            e.printStackTrace();
+            logger.error("授权失败:{}",e.getMessage());
+            return AjaxResult.error("授权失败");
+        }
+    }
+
+
     /**
      * 经销商通过签署地址签署后,回调此方法,通过flowId得到签署后的文件下载地址并保存url
      */

+ 24 - 0
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/WxPortalController.java

@@ -278,6 +278,30 @@ public class WxPortalController extends ApiBaseController {
         }
     }
 
+
+    @ApiOperation(value = "设置/取消自提授权", notes = "参数:{'userId':'XXXXXXX','isSelfDelivery':'1'}" +
+            "\n(userId:用户id" +
+            "\n isSelfDelivery:是否自提授权(0否1是))")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "params", paramType = "body")
+    })
+    @PostMapping("updateUserByIsSelfDelivery")
+    public Object updateUserByIsSelfDelivery() {
+        ParameterObject obj = getParameterObject();
+        obj.checkParameterNotNull("userId,isSelfDelivery");
+        String userId = obj.getString("userId");
+        String IsSelfDelivery = obj.getString("isSelfDelivery");
+        SysUser user = new SysUser();
+        user.setUserId(Long.parseLong(userId));
+        user.setIsSelfDelivery(IsSelfDelivery);
+        int i = userService.updateUserInfo(user);
+        if (i>0){
+            return AjaxResult.success();
+        }else {
+            return AjaxResult.error();
+        }
+    }
+
     @ApiOperation(value = "帮助中心",notes = "参数:{userId:1}")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "params" , paramType = "body")

+ 48 - 1
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/domain/OrderFile.java

@@ -94,10 +94,57 @@ public class OrderFile extends BaseEntity
     @Excel(name = "提货时间")
     private String run_time;
 
-    /** 类型1司机授权 */
+    /** 类型1司机授权2委托 */
     @Excel(name = "类型1司机授权")
     private Integer types;
 
+    /** 委托类型 1收货2自主下单3自提 */
+    @Excel(name = "委托类型 1收货2自主下单3自提")
+    private String authType;
+
+    /** 受托人职位 */
+    @Excel(name = "受托人职位")
+    private String beentrustPost;
+
+    /** 委托人职位 */
+    @Excel(name = "委托人职位")
+    private String entrustPost;
+    /** 委托类型对应的值*/
+    private String authName;
+
+
+    public String getAuthName() {
+        return authName;
+    }
+
+    public void setAuthName(String authName) {
+        this.authName = authName;
+    }
+
+    public String getAuthType() {
+        return authType;
+    }
+
+    public void setAuthType(String authType) {
+        this.authType = authType;
+    }
+
+    public String getBeentrustPost() {
+        return beentrustPost;
+    }
+
+    public void setBeentrustPost(String beentrustPost) {
+        this.beentrustPost = beentrustPost;
+    }
+
+    public String getEntrustPost() {
+        return entrustPost;
+    }
+
+    public void setEntrustPost(String entrustPost) {
+        this.entrustPost = entrustPost;
+    }
+
     public Integer getTypes() {
         return types;
     }

+ 33 - 0
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/domain/OrderSelfNote.java

@@ -1,5 +1,6 @@
 package com.dgtly.wxportal.domain;
 
+import com.dgtly.common.annotation.Excel;
 import com.dgtly.common.core.domain.BaseEntity;
 
 import java.util.ArrayList;
@@ -39,6 +40,38 @@ public class OrderSelfNote extends BaseEntity {
     private String customerName;
     private String agent;
 
+    /** 受托人职位 */
+    private String beentrustPost;
+
+    /** 委托人职位 */
+    private String entrustPost;
+    /** 委托类型对应的值*/
+    private String authName;
+
+    public String getBeentrustPost() {
+        return beentrustPost;
+    }
+
+    public void setBeentrustPost(String beentrustPost) {
+        this.beentrustPost = beentrustPost;
+    }
+
+    public String getEntrustPost() {
+        return entrustPost;
+    }
+
+    public void setEntrustPost(String entrustPost) {
+        this.entrustPost = entrustPost;
+    }
+
+    public String getAuthName() {
+        return authName;
+    }
+
+    public void setAuthName(String authName) {
+        this.authName = authName;
+    }
+
     public String getOrderNumber() {
         return orderNumber;
     }

+ 16 - 4
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/ESignService.java

@@ -21,15 +21,27 @@ public interface ESignService {
 
   /**
    * 根据订单和运单好生成PDF并上传至E签宝
-   * @param deliveryNumber 交货单
-   * @param shipmentNumber 运单号
-   * @param belongTo 经销商代码
    * @param customerName 经销商名和曾
    * @return
    */
   ESignUpPDFModal upload(String orderId,String tmsShipNumber,String customerCode, String customerName,String userName);
+    /**
+     * @description: 自提
+     * @param: [orderFile]
+     * @return: com.dgtly.wxportal.domain.ESignUpPDFModal
+     * @author: njs
+     * @date: 2023/3/22 17:42
+     */
+   ESignUpPDFModal uploadDriver(OrderFile orderFile);
 
-  ESignUpPDFModal uploadDriver(OrderFile orderFile);
+    /**
+     * @description: 委托签署pdf
+     * @param: [orderFile]
+     * @return: com.dgtly.wxportal.domain.ESignUpPDFModal
+     * @author: njs
+     * @date: 2023/3/22 17:42
+     */
+    ESignUpPDFModal uploadEmpowerByAuth(OrderFile orderFile);
 
 
      String verificationUser();

+ 2 - 0
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/IEsignSignService.java

@@ -8,6 +8,8 @@ import com.dgtly.wxportal.domain.OrderFile;
  * @date:2020/10/13 10:29
  */
 public interface IEsignSignService {
+
+    public String oneStepFlowempowerByAuth(String businessScene, String fileId,float posX,float posY, String fileName, String signerAccountId, String authorizedAccountId,String redirectUrl);
     /**
      * @description: 司机授权书
      * @param: [businessScene, fileId, posX, posY, posX2, posY2, fileName, signerAccountId, authorizedAccountId, redirectUrl]

+ 92 - 0
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/impl/ESignServiceImpl.java

@@ -111,6 +111,44 @@ public class ESignServiceImpl implements ESignService {
         return fileModal;
     }
 
+    /**
+     * @param orderFile
+     * @description: 委托签署pdf
+     * @param: [orderFile]
+     * @return: com.dgtly.wxportal.domain.ESignUpPDFModal
+     * @author: njs
+     * @date: 2023/3/22 17:42
+     */
+    @Override
+    public ESignUpPDFModal uploadEmpowerByAuth(OrderFile orderFile) {
+        OrderSelfNote receivingNote =new OrderSelfNote();
+        // 受托人
+        receivingNote.setBeentrustName(orderFile.getBeentrustName());
+        //委托人
+        receivingNote.setEntrustName(orderFile.getEntrustName());
+        receivingNote.setBelongTo(orderFile.getChainsCode());
+        receivingNote.setCustomerName(orderFile.getChainsName());
+        receivingNote.setAuthName(orderFile.getAuthName());
+        receivingNote.setBeentrustPost(orderFile.getBeentrustPost());
+        receivingNote.setEntrustPost(orderFile.getEntrustPost());
+        Map<String,Object> map = new HashMap<>();
+        //创建PDF
+        ESignUpPDFModal fileModal = creatEmpowerByAuthPdf(receivingNote);
+        String md5 = ESignUploadUtil.getStringContentMD5(fileModal.getFilePath());
+        String contentTtpe = "application/pdf";
+        int fileLength = ESignUploadUtil.getFileSize(fileModal.getFilePath());
+        //根据文件获取上传路径
+        JSONObject urlData =  getUpUrl(fileModal.getFilePath(),md5,contentTtpe,fileLength).getJSONObject("data");
+        //文件id
+        String fileId = urlData.getString("fileId");
+        //文件上传路径
+        String uploadUrl = urlData.getString("uploadUrl");
+        //上传文件
+        String res = eSignHttpUtil.upLoadFile(uploadUrl,fileModal.getFilePath(),md5,contentTtpe,fileLength);
+        fileModal.setFileId(fileId);
+        return fileModal;
+    }
+
     @Override
     public String verificationUser() {
         return null;
@@ -302,7 +340,61 @@ public class ESignServiceImpl implements ESignService {
         res.setFilePath(fileUrl);
         return res;
     }
+    /**
+     * @description: 委托授权签署
+     * @param: [receivingNote]
+     * @return: com.dgtly.wxportal.domain.ESignUpPDFModal
+     * @author: njs
+     * @date: 2023/3/22 17:55
+     */
+    private ESignUpPDFModal creatEmpowerByAuthPdf(OrderSelfNote receivingNote){
+        ESignUpPDFModal res = new ESignUpPDFModal();
+        String fileUrl = "";
+        int size = 0;
+        try {
+            // 1.新建document对象
+            Document document = new Document(PageSize.A4);// 建立一个Document对象
 
+            // 2.建立一个书写器(Writer)与document对象关联
+            String uploadPath = eSignConfig.getFileUrl() ;
+            String filePath = uploadPath+File.separator+new Date().getTime()+"PDFDemo.pdf";
+            File file = new File(filePath);
+            if (!file.getParentFile().exists())
+            {
+                file.getParentFile().mkdirs();
+            }
+            fileUrl = filePath;
+            file.createNewFile();
+
+            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file));
+            // 3.打开文档
+            document.open();
+            document.addTitle("随  身  邦  授  权  委  托  书");// 标题
+            document.addAuthor("");// 作者
+            document.addSubject("");// 主题
+            document.addKeywords("");// 关键字
+            document.addCreator("");// 创建者
+
+            // 4.向文档中添加内容
+            size = PDFSelfUtil.generateByEmpowerByAuthPDF(document,receivingNote, false);
+            writer.flush();
+            // 5.关闭文档
+            document.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("生成PDF出错:",e);
+        }
+        //计算宽高
+        Float fosX = 500F;
+        Float fosY = 510F;
+//        for (int i =0;i<size;i++){
+//           fosY = fosY-11f;
+//        }
+        res.setX(fosX);
+        res.setY(fosY);
+        res.setFilePath(fileUrl);
+        return res;
+    }
     /**
      * 创建指派司机pdf文件
      * @param

+ 19 - 3
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/impl/EsignSignServiceImpl.java

@@ -52,9 +52,22 @@ public class EsignSignServiceImpl implements IEsignSignService {
     //完成收货回调
     private String confirmUrl="order/order/deliver-quantity-confirm/confirmCollect";
 
+    /**
+     * @description: 授权
+     * @param: [businessScene, fileId, posX, posY, fileName, signerAccountId, authorizedAccountId, redirectUrl]
+     * @return: java.lang.String
+     * @author: njs
+     * @date: 2023/3/23 14:06
+     */
+    @Override
+    public String oneStepFlowempowerByAuth(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");
+        return result.get("flowId").toString();
+    }
 
-
-   /**
+    /**
     * @description: 司机授权书
     * @param: [businessScene, fileId, posX, posY, posX2, posY2, fileName, signerAccountId, authorizedAccountId, redirectUrl]
     * @return: java.lang.String
@@ -227,8 +240,11 @@ public class EsignSignServiceImpl implements IEsignSignService {
         if(orderFlag.getTypes()==1){
             downloadFile(Global.getPdfPath(), orderFlag.getOrderId() + "_授权.pdf", fileUrl);
             orderFile.setFileUrl(Constants.RESOURCE_PREFIX+"/pdf/"+DateUtils.datePath()+"/"+orderFlag.getOrderId() + "_授权.pdf");
+        }else if( orderFlag.getTypes()==2){
+            downloadFile(Global.getPdfPath(), orderFlag.getFlowId() + "_授权委托.pdf", fileUrl);
+            orderFile.setFileUrl(Constants.RESOURCE_PREFIX+"/pdf/"+DateUtils.datePath()+"/"+orderFlag.getFlowId() + "_授权委托.pdf");
         }else{
-        downloadFile(Global.getPdfPath(), orderFlag.getOrderId() + "_签收订单.pdf", fileUrl);
+            downloadFile(Global.getPdfPath(), orderFlag.getOrderId() + "_签收订单.pdf", fileUrl);
             orderFile.setFileUrl(Constants.RESOURCE_PREFIX+"/pdf/"+DateUtils.datePath()+"/"+orderFlag.getOrderId() + "_签收订单.pdf");
 
         }

+ 51 - 2
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/utils/pdf/PDFSelfUtil.java

@@ -235,8 +235,57 @@ public class PDFSelfUtil {
             }
         }
 
-
-
+    //委托授权书针对财务,仓管
+    public  static int generateByEmpowerByAuthPDF(Document document, OrderSelfNote receivingNote, boolean flag) throws Exception {
+        // 段落
+        Paragraph paragraph;
+        paragraph = new Paragraph();
+        paragraph.setAlignment(1); //设置文字居中 0靠左   1,居中     2,靠右
+        paragraph.setIndentationLeft(12); //设置左缩进
+        paragraph.setIndentationRight(12); //设置右缩进
+        paragraph.setFirstLineIndent(24); //设置首行缩进
+        paragraph.setLeading(8f); //行间距
+        paragraph.setSpacingBefore(5f); //设置段落上空白
+        paragraph.setSpacingAfter(10f); //设置段落下空白
+        document.add(paragraph);
+        Paragraph paragraph1 = new Paragraph();
+        paragraph1.setLeading(100f); //行间距
+        paragraph1.setSpacingBefore(2f); //设置段落上空白
+        paragraph1.setSpacingAfter(2f); //设置段落下空白
+        document.add(paragraph1);
+        //添加空行
+        Paragraph p3 = new Paragraph();
+        p3.setSpacingBefore(5f); //设置段落上空白
+        p3.setSpacingAfter(5f); //设置段落下空白
+        // 定位
+        Anchor gotoP = new Anchor("goto");
+        gotoP.setReference("#top");
+        int size = 0;
+        //时间格式校验
+        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));
+        Paragraph paragraph6 = new Paragraph();
+        paragraph6.setLeading(100f); //行间距*/
+        document.add(paragraph1);
+        table.addCell(createCell("委托单位: \t \t"+receivingNote.getCustomerName()+"\n\n"+
+                        "法定代表人: \t \t  "+receivingNote.getEntrustName()+" \t\t\t\t\t\t\t\t\t\t\t  职务: \t "+ receivingNote.getEntrustPost()+"\n\n"+
+                        "受委托人:姓名: \t \t "+receivingNote.getBeentrustName()+"\t  工作单位: \t\t\t\t\t\t\t\t\t\t\t\t "+receivingNote.getCustomerName()+"\n\n"+
+                        "        职务:"+receivingNote.getBeentrustPost()+"\n\n\n\n"+
+                        "    \t \t 现委托上列受委托人在我单位与 立邦装饰材料(广州)有限公司 在随身邦模块操作 事宜中,作为我方 \t"+receivingNote.getCustomerName()+" \t 代理人。"+"\n\n\n\n"
+                , centry, Element.ALIGN_LEFT, 7, false));
+        document.add(paragraph1);
+        table.addCell(createCell("", centry, Element.ALIGN_LEFT, 7, true));
+        table.addCell(createCell("    代理人 \t "+receivingNote.getBeentrustName()+"\t 的代理权限为:"+receivingNote.getAuthName(), centry, Element.ALIGN_LEFT, 8, false));
+        table.addCell(createCell("委托单位:  "+receivingNote.getCustomerName(), centry, Element.ALIGN_RIGHT, 9, false));
+        table.addCell(createCell(   calendar.get(Calendar.YEAR)+"年"+(calendar.get(Calendar.MONTH)+1)+"月"+calendar.get(Calendar.DATE)+"日", centry, Element.ALIGN_RIGHT, 10, false));
+        document.add(paragraph1);
+        document.add(table);
+        return size;
+    }
 
     public  static int generateEPDF(Document document, OrderSelfNote receivingNote, boolean flag) throws Exception {
         // 段落

+ 13 - 0
suishenbang-wxportal/suishenbang-wxportal-common/src/main/resources/mapper/wxportal/OrderFileMapper.xml

@@ -113,6 +113,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="bId != null">b_Id,</if>
             <if test="carNumber != null">car_Number,</if>
             <if test="types !=null">types,</if>
+            <if test="beentrustPost !=null">beentrust_post,</if>
+            <if test="entrustPost !=null">entrust_post,</if>
+            <if test="authType !=null">auth_type,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="orderId != null">#{orderId},</if>
@@ -138,6 +141,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="bId != null">#{bId},</if>
             <if test="carNumber != null">#{carNumber},</if>
             <if test="types !=null">#{types},</if>
+            <if test="beentrustPost !=null">#{beentrustPost},</if>
+            <if test="entrustPost !=null">#{entrustPost},</if>
+            <if test="authType !=null">#{authType},</if>
          </trim>
     </insert>
 
@@ -159,6 +165,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="beentrustName != null">beentrust_Name = #{beentrustName},</if>
             <if test="bId != null">b_Id = #{bId},</if>
             <if test="carNumber != null">car_Number = #{carNumber},</if>
+            <if test="beentrustPost !=null">beentrust_post =#{beentrustPost},</if>
+            <if test="entrustPost !=null">entrust_post =#{entrustPost},</if>
+            <if test="authType !=null">auth_type =#{authType},</if>
         </trim>
         where order_id = #{orderId}
     </update>
@@ -181,6 +190,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="beentrustName != null">beentrust_Name = #{beentrustName},</if>
             <if test="bId != null">b_Id = #{bId},</if>
             <if test="carNumber != null">car_Number = #{carNumber},</if>
+            <if test="bId != null">b_Id = #{bId},</if>
+            <if test="beentrustPost !=null">beentrust_post =#{beentrustPost},</if>
+            <if test="entrustPost !=null">entrust_post =#{entrustPost},</if>
+            <if test="authType !=null">auth_type =#{authType},</if>
         </trim>
         where flow_id = #{flowId}
     </update>