Просмотр исходного кода

E签宝发起签署判断订单是否已签署

qxm 4 лет назад
Родитель
Сommit
245f07fb7f

+ 24 - 14
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/EsignController.java

@@ -2,6 +2,7 @@ package com.dgtly.wxportal.controller;
 
 import com.dgtly.common.annotation.ApiPassToken;
 import com.dgtly.common.core.controller.ApiBaseController;
+import com.dgtly.common.core.domain.AjaxResult;
 import com.dgtly.common.core.domain.ParameterObject;
 import com.dgtly.wxportal.domain.OrderFile;
 import com.dgtly.wxportal.service.IEsignOrganRealVerifyService;
@@ -53,26 +54,35 @@ public class EsignController extends ApiBaseController {
     public Object dealerSign() {
 
         ParameterObject obj = getParameterObject();
-        obj.checkParameterNotNull("orderId,signerAccountId,authorizedAccountId");
+        obj.checkParameterNotNull("orderId,signerAccountId,signerName,authorizedAccountId");
         String orderId = obj.getString("orderId");
         String businessScene = "订单签收";
         String fileName = "签收订单.pdf";
         String signerAccountId = obj.getString("signerAccountId");
         String authorizedAccountId = obj.getString("authorizedAccountId");
 
-        /*1、根据传入订单id,查询订单相关信息生成PDF,调用e签宝上传方法返回文件fileId*/
-        String fileId = "f6ada0144a464d7bb90224104d1c4ca3";
-        /*2、调用E签宝接口一步发起流程,得到返回的流程id*/
-        String flowId = signService.oneStepFlow(businessScene, fileId, fileName, signerAccountId, authorizedAccountId);
-        /*3、调用E签宝获取签署地址*/
-        String result = signService.processExecuteUrl(flowId, signerAccountId, authorizedAccountId);
-        /*4、保存订单id和flowId*/
-        OrderFile orderFile = new OrderFile();
-        orderFile.setOrderId(orderId);
-        orderFile.setFlowId(flowId);
-        orderFileService.insertOrderFile(orderFile);
-
-        return result;
+        /*首先根据订单id-orderId查询订单是否已被签署*/
+        OrderFile orderFlag = orderFileService.selectOrderFileById(orderId);
+        if (orderFlag==null) {
+
+            /*1、根据传入订单id,查询订单相关信息生成PDF,调用e签宝上传方法返回文件fileId*/
+            String fileId = "f6ada0144a464d7bb90224104d1c4ca3";
+            /*2、调用E签宝接口一步发起流程,得到返回的流程id*/
+            String flowId = signService.oneStepFlow(businessScene, fileId, fileName, signerAccountId, authorizedAccountId);
+            /*3、调用E签宝获取签署地址*/
+            String result = signService.processExecuteUrl(flowId, signerAccountId, authorizedAccountId);
+            /*4、保存订单id和flowId*/
+            OrderFile orderFile = new OrderFile();
+            orderFile.setOrderId(orderId);
+            orderFile.setCustomersCode(authorizedAccountId);
+            orderFile.setSignerId(signerAccountId);
+            orderFile.setSignerName("");
+            orderFile.setFlowId(flowId);
+            orderFileService.insertOrderFile(orderFile);
+            return result;
+        }else{
+            return AjaxResult.error("订单已签署");
+        }
     }
 
     /**

+ 36 - 0
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/domain/OrderFile.java

@@ -19,6 +19,18 @@ public class OrderFile extends BaseEntity
     @Excel(name = "订单id")
     private String orderId;
 
+    /** 经销商id */
+    @Excel(name = "经销商id")
+    private String customersCode;
+
+    /** 签收人id */
+    @Excel(name = "签收人id")
+    private String signerId;
+
+    /** 签收人名称id */
+    @Excel(name = "签收人名称")
+    private String signerName;
+
     /** 签署流程id */
     @Excel(name = "签署流程id")
     private String flowId;
@@ -68,6 +80,30 @@ public class OrderFile extends BaseEntity
         return isDelete;
     }
 
+    public String getCustomersCode() {
+        return customersCode;
+    }
+
+    public void setCustomersCode(String customersCode) {
+        this.customersCode = customersCode;
+    }
+
+    public String getSignerId() {
+        return signerId;
+    }
+
+    public void setSignerId(String signerId) {
+        this.signerId = signerId;
+    }
+
+    public String getSignerName() {
+        return signerName;
+    }
+
+    public void setSignerName(String signerName) {
+        this.signerName = signerName;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 16 - 1
suishenbang-wxportal/suishenbang-wxportal-common/src/main/resources/mapper/wxportal/OrderFileMapper.xml

@@ -7,6 +7,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <resultMap type="OrderFile" id="OrderFileResult">
         <result property="orderId"    column="order_id"    />
         <result property="flowId"    column="flow_id"    />
+        <result property="customersCode"    column="customers_code"    />
+        <result property="signerId"    column="signer_id"    />
+        <result property="signerName"    column="signer_name"    />
         <result property="fileUrl"    column="file_url"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
@@ -16,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectOrderFileVo">
-        select order_id, flow_id, file_url, create_by, create_time, update_by, update_time, is_delete from ssb_order_file
+        select order_id, flow_id,customers_code,signer_id,signer_name, file_url, create_by, create_time, update_by, update_time, is_delete from ssb_order_file
     </sql>
 
     <select id="selectOrderFileList" parameterType="OrderFile" resultMap="OrderFileResult">
@@ -38,6 +41,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         insert into ssb_order_file
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="orderId != null">order_id,</if>
+            <if test="customersCode != null">customers_code,</if>
+            <if test="signerId != null">signer_id,</if>
+            <if test="signerName != null">signer_name,</if>
             <if test="flowId != null">flow_id,</if>
             <if test="fileUrl != null">file_url,</if>
             <if test="createBy != null">create_by,</if>
@@ -49,6 +55,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="orderId != null">#{orderId},</if>
             <if test="flowId != null">#{flowId},</if>
+            <if test="customersCode != null">#{customersCode},</if>
+            <if test="signerId != null">#{signerId},</if>
+            <if test="signerName != null">#{signerName},</if>
             <if test="fileUrl != null">#{fileUrl},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
@@ -62,6 +71,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         update ssb_order_file
         <trim prefix="SET" suffixOverrides=",">
             <if test="flowId != null">flow_id = #{flowId},</if>
+            <if test="customersCode != null">customers_code = #{customersCode},</if>
+            <if test="signerId != null">signer_id = #{signerId},</if>
+            <if test="signerName != null">signer_name = #{signerName},</if>
             <if test="fileUrl != null">file_url = #{fileUrl},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
@@ -74,6 +86,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="updateOrderFileByFlowId">
         update ssb_order_file
         <trim prefix="SET" suffixOverrides=",">
+            <if test="customersCode != null">customers_code = #{customersCode},</if>
+            <if test="signerId != null">signer_id = #{signerId},</if>
+            <if test="signerName != null">signer_name = #{signerName},</if>
             <if test="fileUrl != null">file_url = #{fileUrl},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>