Przeglądaj źródła

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

zhangding 4 lat temu
rodzic
commit
872fdf8924

+ 5 - 1
suishenbang-system/src/main/java/com/dgtly/system/mapper/CustomersExtMapper.java

@@ -1,6 +1,8 @@
 package com.dgtly.system.mapper;
 
 import com.dgtly.system.domain.CustomersExt;
+import org.apache.ibatis.annotations.Param;
+
 import java.util.List;
 
 /**
@@ -43,7 +45,9 @@ public interface CustomersExtMapper
      */
     public int updateCustomersExt(CustomersExt customersExt);
 
-    /**
+    public int updateCustomersIsAuthentication(@Param("isAuthentication") String isAuthentication,@Param("chainsCode") String chainsCode);
+
+  /**
      * 删除经销商扩展
      * 
      * @param chainsCode 经销商扩展ID

+ 3 - 0
suishenbang-system/src/main/java/com/dgtly/system/mapper/SysUserMapper.java

@@ -104,6 +104,9 @@ public interface SysUserMapper
      */
     public int updateUser(SysUser user);
 
+    //修改认证状态
+    public int updateIsAuthentication(@Param("isAuthentication") String isAuthentication,@Param("userId") String userId);
+
     /**
      * 修改全公司的状态
      *

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

@@ -43,6 +43,9 @@ public interface ICustomersExtService
      */
     public int updateCustomersExt(CustomersExt customersExt);
 
+    //修改企业认证状态
+    public int updateCustomersIsAuthentication(String isAuthentication,String chainsCode);
+
     /**
      * 批量删除经销商扩展
      * 

+ 4 - 0
suishenbang-system/src/main/java/com/dgtly/system/service/ISysUserService.java

@@ -133,6 +133,10 @@ public interface ISysUserService
      */
     public int updateUserInfo(SysUser user);
 
+
+    //修改认证状态
+    public int updateIsAuthentication(String isAuthentication,String userId);
+
     /**
      * 修改用户详细信息和销售相关信息
      *

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

@@ -68,6 +68,11 @@ public class CustomersExtServiceImpl implements ICustomersExtService
         return customersExtMapper.updateCustomersExt(customersExt);
     }
 
+    @Override
+    public int updateCustomersIsAuthentication(String isAuthentication, String chainsCode) {
+        return customersExtMapper.updateCustomersIsAuthentication(isAuthentication,chainsCode);
+    }
+
     /**
      * 删除经销商扩展对象
      * 

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

@@ -252,6 +252,11 @@ public class SysUserServiceImpl implements ISysUserService
         return userMapper.updateUser(user);
     }
 
+    @Override
+    public int updateIsAuthentication(String isAuthentication,String userId) {
+        return userMapper.updateIsAuthentication(isAuthentication,userId);
+    }
+
     /**
      * 修改用户个人详细信息和销售销售相关信息
      *

+ 5 - 0
suishenbang-system/src/main/resources/mapper/system/CustomersExtMapper.xml

@@ -85,6 +85,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where chains_code = #{chainsCode}
     </update>
 
+    <update id="updateCustomersIsAuthentication" parameterType="String">
+        update customers_ext set is_authentication = #{isAuthentication}
+		where chains_code = #{chainsCode}
+    </update>
+
     <delete id="deleteCustomersExtById" parameterType="String">
         delete from customers_ext where chains_code = #{chainsCode}
     </delete>

+ 5 - 0
suishenbang-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -253,6 +253,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  		where user_id = #{userId}
 	</update>
 
+	<update id="updateIsAuthentication" parameterType="String">
+		update sys_user set is_authentication = #{isAuthentication}
+		where user_id = #{userId}
+	</update>
+
 
 	<update id="changeStatus">
 		update sys_user set del_flag = #{status}

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

@@ -4,6 +4,9 @@ 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.SysUser;
+import com.dgtly.system.service.ICustomersExtService;
+import com.dgtly.system.service.ISysUserService;
 import com.dgtly.wxportal.domain.OrderFile;
 import com.dgtly.wxportal.service.IEsignOrganRealVerifyService;
 import com.dgtly.wxportal.service.IEsignPersonRealnVerifyService;
@@ -37,6 +40,10 @@ public class EsignController extends ApiBaseController {
     private IEsignSignService signService;
     @Autowired
     private IOrderFileService orderFileService;
+    @Autowired
+    private ISysUserService userService;
+    @Autowired
+    private ICustomersExtService customersExtService;
 
     /**
      * 经销商订单签收方法
@@ -121,14 +128,27 @@ public class EsignController extends ApiBaseController {
     }
 
     /*调用修改数据库个人认证状态*/
-    /*@PostMapping("notifyUrl")
-    public Object notifyUrl(){
+    @ApiOperation(value = "E签宝个人认证成功回调接口(修改认证状态)",
+            notes = "参数:{" +
+                    "userId:'123'}" +
+                    "错误:" +
+                    "500 修改个人认证状态失败" +
+                    "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "params" , paramType = "body")
+    })
+    @PostMapping("updateUerIsAuthentication")
+    public Object updateUerIsAuthentication(){
         ParameterObject obj =  getParameterObject();
-        obj.checkParameterNotNull("success");
-        String accountId = obj.getString("success");
-        String result = personRealnVerifyService.personRealnVerify(accountId);
-        return AjaxResult.success().putKV("result",result);
-    }*/
+        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,"修改个人认证状态失败");
+        }
+    }
 
 
     @ApiOperation(value = "E签宝企业认证", notes = "参数:{'accountId':'XXXXXXX','agentAccountId':'XXXXXXXXX'}" +
@@ -147,14 +167,28 @@ public class EsignController extends ApiBaseController {
     }
 
     /*调用修改数据库企业认证状态*/
-    /*@PostMapping("notifyUrl")
-    public Object notifyUrl(){
+    @ApiOperation(value = "E签宝企业认证成功回调接口(修改认证状态)",
+            notes = "参数:{" +
+                    "userId:'123'}" +
+                    "错误:" +
+                    "500 修改企业认证状态失败" +
+                    "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "params" , paramType = "body")
+    })
+    @PostMapping("updateCustomersIsAuthentication")
+    public Object updateCustomersIsAuthentication(){
         ParameterObject obj =  getParameterObject();
-        obj.checkParameterNotNull("success");
-        String accountId = obj.getString("success");
-        String result = personRealnVerifyService.personRealnVerify(accountId);
-        return AjaxResult.success().putKV("result",result);
-    }*/
+        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,"修改企业认证状态失败");
+        }
+    }
 
 
     /*@ApiOperation(value = "E签宝一步发起签署", notes = "参数:{'businessScene':'XXXXXXX','fileId':'XXXXXXXXX','fileName':'xxx.pdf','signerAccountId':'xxx','authorizedAccountId':'xxx'}" +

+ 39 - 12
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/WxPortalController.java

@@ -69,9 +69,9 @@ public class WxPortalController extends ApiBaseController {
      * @date: 2020-10-12 14:04
      */
 
-    @ApiOperation(value = "绑定微信用户和系统用户",
+    @ApiOperation(value = "E签宝个人注册返回认证接口",
             notes = "参数:{" +
-                    "username:'admin',loginName:'admin'}" +
+                    "userId:'123'}" +
                     "错误:" +
                     "301  用户已经注册且认证" +
                     "500 注册失败" +
@@ -84,11 +84,11 @@ public class WxPortalController extends ApiBaseController {
     public Object createPersonalAccount(){
         ParameterObject obj =  getParameterObject();
         //判断参数
-        obj.checkParameterNotNull("loginName");
-        String loginName = obj.getString("loginName");
+        obj.checkParameterNotNull("userId");
+        String userId = obj.getString("userId");
 //        SysUser user = obj.parseBean(SysUser.class);
         //根据用户loginName查询用户信息
-        SysUser user = userService.selectUserByLoginName(loginName);
+        SysUser user = userService.selectUserById(Long.parseLong(userId));
         //判断是否注册
         if (user.getAccountId()!=null&&user.getAccountId()!=""){//已经注册
             //判断是否认证
@@ -119,19 +119,46 @@ public class WxPortalController extends ApiBaseController {
      * @auther: ZhangDing
      * @date: 2020-10-12 15:26
      */
+    @ApiOperation(value = "E签宝企业注册返回认证接口",
+            notes = "参数:{" +
+                    "userId:'123',customersName:'XXX商贸公司',orgLegalIdNumber:'企业法定代表人证件号','orgLegalName':'企业法定代表人名称'}" +
+                    "错误:" +
+                    "301  企业已经注册且认证" +
+                    "201  个人未注册" +
+                    "500 注册失败" +
+                    "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "params" , paramType = "body")
+    })
     @ResponseBody
-    @RequestMapping("/createThirdParty")
+    @PostMapping("/createThirdParty")
     public Object createThirdParty(){
         ParameterObject obj =  getParameterObject();
-        obj.checkParameterNotNull("chainsCode,creator,customersName");
-        String chainsCode = obj.getString("chainsCode");
+        obj.checkParameterNotNull("userId,customersName,orgLegalIdNumber,orgLegalName");
+        Long userId = obj.getLong("userId");
+        String customersName = obj.getString("customersName");
+        String orgLegalIdNumber = obj.getString("orgLegalIdNumber");
+        String orgLegalName = obj.getString("orgLegalName");
+        SysUser user = userService.selectUserById(userId);
 //        CustomersExt customersExt = obj.parseBean(CustomersExt.class);
-        CustomersExt customersExt = customersExtService.selectCustomersExtById(chainsCode);
+        CustomersExt customersExt = customersExtService.selectCustomersExtById(user.getSysUserExt().getOrgCode());
+        if (customersExt==null){
+            customersExt = new CustomersExt();
+            if (user.getAccountId()!=null&&user.getAccountId()!="") {
+                customersExt.setCreator(user.getAccountId());
+            }else {
+                return AjaxResult.error(201,"个人未注册");
+            }
+            customersExt.setChainsCode(user.getSysUserExt().getOrgCode());
+            customersExt.setCustomersName(customersName);
+            customersExt.setOrgLegalidNumber(orgLegalIdNumber);
+            customersExt.setOrgLegalName(orgLegalName);
+        }
         //判断是否注册
         if (customersExt.getOrgId()!=null&&customersExt.getOrgId()!=""){//已经注册
             //判断是否认证
             if ("1".equals(customersExt.getIsAuthentication())){//已认证
-                return AjaxResult.error(301,"经销商已经注册且认证");
+                return AjaxResult.error(301,"企业已经注册且认证");
             }else {//未认证
                 //获取认证路径
                 String url = organRealVerifyService.organRealVerify(customersExt.getOrgId(),customersExt.getCreator());
@@ -158,7 +185,7 @@ public class WxPortalController extends ApiBaseController {
      * @date: 2020-10-13 13:31
      */
     @ResponseBody
-    @RequestMapping("/updatePersonalAccount")
+    @PostMapping("/updatePersonalAccount")
     public Object updatePersonalAccount(){
         ParameterObject obj = getParameterObject();
         obj.checkParameterNotNull("accountId");
@@ -174,7 +201,7 @@ public class WxPortalController extends ApiBaseController {
      * @date: 2020-10-13 14:32
      */
     @ResponseBody
-    @RequestMapping("/updateThirdParty")
+    @PostMapping("/updateThirdParty")
     public Object updateThirdParty(){
         ParameterObject obj = getParameterObject();
         obj.checkParameterNotNull("orgId");

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

@@ -94,8 +94,8 @@ public class ESignServiceImpl implements ESignService {
         json.put("name",customersExt.getCustomersName());
 //        json.put("idType","CRED_ORG_USCC");
 //        json.put("idNumber",customersExt.getIdNumber());
-//        json.put("orgLegalIdNumber",customersExt.getOrgLegalidNumber());
-//        json.put("orgLegalName",customersExt.getOrgLegalName());
+        json.put("orgLegalIdNumber",customersExt.getOrgLegalidNumber());
+        json.put("orgLegalName",customersExt.getOrgLegalName());
         JSONObject resule = eSignHttpUtil.doPostGetJson(ESignUrl.CreateThirdParty,json);
         customersExt.setOrgId(resule.getJSONObject("data").getString("orgId"));
         isok = customersExtService.insertCustomersExt(customersExt);