Browse Source

修改E签宝接口输入条件orderId,userId查询得到个人注册id和企业注册id

qxm 4 years ago
parent
commit
7439a1b144

+ 2 - 0
suishenbang-system/src/main/java/com/dgtly/system/mapper/CustomersExtMapper.java

@@ -62,4 +62,6 @@ public interface CustomersExtMapper
      * @return 结果
      */
     public int deleteCustomersExtByIds(String[] chainsCodes);
+
+    String selectOrgIdByOrderId(String orderId);
 }

+ 9 - 0
suishenbang-system/src/main/java/com/dgtly/system/service/ICustomersExtService.java

@@ -61,4 +61,13 @@ public interface ICustomersExtService
      * @return 结果
      */
     public int deleteCustomersExtById(String chainsCode);
+
+    /**
+     * @description: 根据订单编号查询组织id
+     * @param: [orderId]
+     * @return: java.lang.String
+     * @author: qxm      
+     * @date: 2020/10/19 11:31
+     */ 
+    String selectOrgIdByOrderId(String orderId);
 }

+ 5 - 0
suishenbang-system/src/main/java/com/dgtly/system/service/impl/CustomersExtServiceImpl.java

@@ -96,4 +96,9 @@ public class CustomersExtServiceImpl implements ICustomersExtService
     {
         return customersExtMapper.deleteCustomersExtById(chainsCode);
     }
+
+    @Override
+    public String selectOrgIdByOrderId(String orderId) {
+        return customersExtMapper.selectOrgIdByOrderId(orderId);
+    }
 }

+ 12 - 1
suishenbang-system/src/main/resources/mapper/system/CustomersExtMapper.xml

@@ -40,7 +40,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectCustomersExtVo"/>
         where chains_code = #{chainsCode}
     </select>
-        
+
+    <!--根据订单id关联订单基础信息表查询经销商注册id-->
+    <select id="selectOrgIdByOrderId" resultType="java.lang.String">
+        SELECT
+            s.org_id
+        FROM
+            sales_order_base t
+        LEFT JOIN customers_ext s ON t.belong_to = s.chains_code
+        WHERE
+            t.order_number = #{orderId};
+    </select>
+
     <insert id="insertCustomersExt" parameterType="CustomersExt">
         insert into customers_ext
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 35 - 100
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/EsignController.java

@@ -4,8 +4,10 @@ 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.system.domain.CustomersExt;
 import com.dgtly.system.domain.SysUser;
 import com.dgtly.system.service.ICustomersExtService;
+import com.dgtly.system.service.ISysUserExtService;
 import com.dgtly.system.service.ISysUserService;
 import com.dgtly.wxportal.domain.OrderFile;
 import com.dgtly.wxportal.service.IEsignOrganRealVerifyService;
@@ -43,17 +45,17 @@ public class EsignController extends ApiBaseController {
     @Autowired
     private ISysUserService userService;
     @Autowired
+    private ISysUserExtService userExtService;
+    @Autowired
     private ICustomersExtService customersExtService;
-
     /**
      * 经销商订单签收方法
      * 没有注册就注册,注册完就认证,然后再点击签署按钮,获取经销商用户id,对应主体id
      * E签宝一步发起签署
      */
-    @ApiOperation(value = "订单签收", notes = "参数:{'orderId':'xxx','signerAccountId':'xxx','authorizedAccountId':'xxx'}" +
+    @ApiOperation(value = "订单签收", notes = "参数:{'orderId':'xxx','userId':'xxx'}" +
             "\n(orderId:订单编号" +
-            "\n(signerAccountId:签收人(个人)" +
-            "\n authorizedAccountId:签收主体(公司))")
+            "\n(userId:用户id")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "params", paramType = "body")
     })
@@ -61,12 +63,20 @@ public class EsignController extends ApiBaseController {
     public Object dealerSign() {
 
         ParameterObject obj = getParameterObject();
-        obj.checkParameterNotNull("orderId,signerAccountId,signerName,authorizedAccountId");
+        obj.checkParameterNotNull("orderId,userId");
         String orderId = obj.getString("orderId");
+        String userId = obj.getString("userId");
+
         String businessScene = "订单签收";
         String fileName = "签收订单.pdf";
-        String signerAccountId = obj.getString("signerAccountId");
-        String authorizedAccountId = obj.getString("authorizedAccountId");
+        /*根据userId查询个人注册后accountId*/
+        String signerAccountId = "";
+        SysUser sysUser = userService.selectUserById(Long.parseLong(userId));
+        if (sysUser!=null){
+            signerAccountId=sysUser.getAccountId();
+        }
+        /*根据订单id关联查询企业注册后id*/
+        String authorizedAccountId =customersExtService.selectOrgIdByOrderId(orderId);
 
         /*首先根据订单id-orderId查询订单是否已被签署*/
         OrderFile orderFlag = orderFileService.selectOrderFileById(orderId);
@@ -113,119 +123,44 @@ public class EsignController extends ApiBaseController {
     }
 
 
-    @ApiOperation(value = "E签宝个人认证", notes = "参数:{'accountId':'XXXXXXX'}" +
-            "\n(accountId:待认证账号Id)")
+    @ApiOperation(value = "E签宝个人认证", notes = "参数:{'userId':'XXXXXXX'}" +
+            "\n(userId:待认证用户id)")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "params", paramType = "body")
     })
     @PostMapping("personRealnVerify")
     public Object personRealnVerify() {
         ParameterObject obj = getParameterObject();
-        obj.checkParameterNotNull("accountId");
-        String accountId = obj.getString("accountId");
-        String result = personRealnVerifyService.personRealnVerify(accountId);
-        return result;
-    }
-
-    /*调用修改数据库个人认证状态*/
-    @ApiOperation(value = "E签宝个人认证成功回调接口(修改认证状态)",
-            notes = "参数:{" +
-                    "userId:'123'}" +
-                    "错误:" +
-                    "500 修改个人认证状态失败" +
-                    "")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "params" , paramType = "body")
-    })
-    @PostMapping("updateUerIsAuthentication")
-    public Object updateUerIsAuthentication(){
-        ParameterObject obj =  getParameterObject();
         obj.checkParameterNotNull("userId");
         String userId = obj.getString("userId");
-        int result = userService.updateIsAuthentication("1",userId);
-        if (result>0){
-            return AjaxResult.success().putKV("result",result);
-        }else {
-            return AjaxResult.error(500,"修改个人认证状态失败");
+        SysUser sysUser = userService.selectUserById(Long.parseLong(userId));
+        String result="";
+        if (sysUser!=null){
+            result = personRealnVerifyService.personRealnVerify(sysUser.getAccountId());
         }
+        return result;
     }
 
 
-    @ApiOperation(value = "E签宝企业认证", notes = "参数:{'accountId':'XXXXXXX','agentAccountId':'XXXXXXXXX'}" +
-            "\n(accountId:待认证e签宝企业账号Id,agentAccountId:办理人账号Id)")
+    @ApiOperation(value = "E签宝企业认证", notes = "参数:{'userId':'XXXXXXX'}" +
+            "\n(userId:待认证e签宝用户id)")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "params", paramType = "body")
     })
     @PostMapping("organRealVerify")
     public Object organRealVerify() {
         ParameterObject obj = getParameterObject();
-        obj.checkParameterNotNull("accountId,agentAccountId");
-        String accountId = obj.getString("accountId");
-        String agentAccountId = obj.getString("agentAccountId");
-        String result = organRealVerifyService.organRealVerify(accountId, agentAccountId);
-        return result;
-    }
-
-    /*调用修改数据库企业认证状态*/
-    @ApiOperation(value = "E签宝企业认证成功回调接口(修改认证状态)",
-            notes = "参数:{" +
-                    "userId:'123'}" +
-                    "错误:" +
-                    "500 修改企业认证状态失败" +
-                    "")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "params" , paramType = "body")
-    })
-    @PostMapping("updateCustomersIsAuthentication")
-    public Object updateCustomersIsAuthentication(){
-        ParameterObject obj =  getParameterObject();
         obj.checkParameterNotNull("userId");
-        Long userId = obj.getLong("userId");
-        SysUser user = userService.selectUserById(userId);
-        int result = customersExtService.updateCustomersIsAuthentication("1",user.getSysUserExt().getOrgCode());
-        if (result>0){
-            return AjaxResult.success().putKV("result",result);
-        }else {
-            return AjaxResult.error(500,"修改企业认证状态失败");
+        String userId = obj.getString("userId");
+        SysUser sysUser = userService.selectUserById(Long.parseLong(userId));
+        String result="";
+        if (sysUser!=null){
+            CustomersExt customersExt = customersExtService.selectCustomersExtById(sysUser.getSysUserExt().getOrgCode());
+            if (customersExt!=null){
+                result = organRealVerifyService.organRealVerify(sysUser.getAccountId(), customersExt.getOrgId());
+            }
         }
-    }
-
-
-    /*@ApiOperation(value = "E签宝一步发起签署", notes = "参数:{'businessScene':'XXXXXXX','fileId':'XXXXXXXXX','fileName':'xxx.pdf','signerAccountId':'xxx','authorizedAccountId':'xxx'}" +
-            "\n ( businessScene:文件主题---xx订单签收" +
-            "\n fileId:签署文档id" +
-            "\n fileName:签署文件名称(名称可以自定义,必须带上文件扩展名,不然会导致后续发起流程校验过不去 示例:合同.pdf )" +
-            "\n signerAccountId:签署操作人个人账号标识,即操作本次签署的个人" +
-            "\n authorizedAccountId:签约主体账号标识,即本次签署对应任务的归属方,默认是签署操作人个人)")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "params", paramType = "body")
-    })
-    @PostMapping("oneStepFlow")
-    public Object oneStepFlow() {
-        ParameterObject obj = getParameterObject();
-        obj.checkParameterNotNull("businessScene,fileId,fileName,signerAccountId,authorizedAccountId");
-        String businessScene = obj.getString("businessScene");
-        String fileId = obj.getString("fileId");
-        String fileName = obj.getString("fileName");
-        String signerAccountId = obj.getString("signerAccountId");
-        String authorizedAccountId = obj.getString("authorizedAccountId");
-//        String result = signService.oneStepFlow(businessScene,fileId,fileName,signerAccountId,authorizedAccountId);
-//        return result;
-        return null;
-    }
-
-    @ApiOperation(value = "E签宝一步发起签署", notes = "参数:{'flowId':'XXXXXXX'}")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "params", paramType = "body")
-    })
-    @PostMapping("processDocumentDownload")
-    public Object processDocumentDownload() {
-        ParameterObject obj = getParameterObject();
-        obj.checkParameterNotNull("flowId");
-        String flowId = obj.getString("businessScene");
-        String result = signService.processDocumentDownload(flowId);
-        *//*存入数据库*//*
         return result;
-    }*/
+    }
 
 }