Browse Source

Merge remote-tracking branch 'origin/master'

ningsy 4 years ago
parent
commit
52217771a7

+ 1 - 1
suishenbang-order/src/main/java/com/dgtly/order/controller/OrderCustomersController.java

@@ -101,7 +101,7 @@ public class OrderCustomersController extends BaseController
     public Object dealHistoryData(String customerCode){
         String str="";
         String url = "";
-        if (customerCode!=null&&customerCode!=""){
+        if (customerCode!=null&&!customerCode.equals("")){
              url = cloudPath +"order/order/meta-hana-sales-order/dealHistoryData?customerCode="+customerCode;
         }else {
              url = cloudPath +"order/order/meta-hana-sales-order/dealHistoryData";

+ 38 - 8
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/EsignController.java

@@ -347,7 +347,7 @@ public class EsignController extends ApiBaseController {
         SysUser user = userService.selectUserById(Long.parseLong(userId));
 //        user.setUserName(userName);
         //判断是否注册
-        if (user.getAccountId()!=null&&user.getAccountId()!=""){//已经注册
+        if (user.getAccountId()!=null&&!user.getAccountId().equals("")){//已经注册
             //判断是否认证
             if ("1".equals(user.getIsAuthentication())){//已经认证
                 return AjaxResult.error(301,"用户已经注册且认证");
@@ -359,9 +359,20 @@ public class EsignController extends ApiBaseController {
                     return AjaxResult.success("url",url);
             }
         }else {//没有注册
-            //去注册
-            SysUser euser = eSignService.createPersonalAccount(user);
-            if (euser!=null) {
+            /*首先根据user.getLoginName()查询E签宝是否存在此账户*/
+            String accountId = eSignService.getAccountIdByThirdId(user.getLoginName());
+            System.out.println("查询E签宝accountId:"+accountId);
+            SysUser euser = new SysUser();
+            if( accountId != null ){
+                /*保存已注册信息*/
+                euser.setUserId(Long.parseLong(userId));
+                euser.setAccountId(accountId);
+                int i = userService.updateUserInfo(euser);
+            }else{
+                //去注册
+                 euser = eSignService.createPersonalAccount(user);
+            }
+            if (euser != null) {
                 //注册完以后获取认证路径
                 String url = personRealnVerifyService.personRealnVerify(euser.getAccountId(),redirectUrl);
                 return AjaxResult.success("url", url);
@@ -402,7 +413,7 @@ public class EsignController extends ApiBaseController {
         CustomersExt customersExt = customersExtService.selectCustomersExtById(user.getSysUserExt().getOrgCode());
         if (customersExt==null){
             customersExt = new CustomersExt();
-            if (user.getAccountId()!=null&&user.getAccountId()!="") {
+            if (user.getAccountId()!=null&&!user.getAccountId().equals("")) {
                 customersExt.setCreator(user.getAccountId());
             }else {
                 return AjaxResult.error(201,"个人未注册");
@@ -410,7 +421,7 @@ public class EsignController extends ApiBaseController {
             customersExt.setChainsCode(user.getSysUserExt().getOrgCode());
         }
         //判断是否注册
-        if (customersExt.getOrgId()!=null&&customersExt.getOrgId()!=""){//已经注册
+        if (customersExt.getOrgId()!=null&&!customersExt.getOrgId().equals("")){//已经注册
             //判断是否认证
             if ("1".equals(customersExt.getIsAuthentication())){//已认证
                 return AjaxResult.error(301,"企业已经注册且认证");
@@ -422,8 +433,27 @@ public class EsignController extends ApiBaseController {
                     return AjaxResult.success("url",url);
             }
         }else {//未注册
-            //去注册
-            CustomersExt ecustomersExt = eSignService.createThirdParty(customersExt);
+            /*首先根据customersExt.getChainsCode()查询E签宝是否存在此账户*/
+                String orgId = eSignService.getOrgIdByThirdId(customersExt.getChainsCode());
+                System.out.println("查询E签宝orgId:"+orgId);
+                CustomersExt ecustomersExt=null;
+                if(orgId!=null){
+                    ecustomersExt = customersExtService.selectCustomersExtById(user.getSysUserExt().getOrgCode());
+                    if (ecustomersExt!=null){
+                        ecustomersExt.setOrgId(orgId);
+                        /*修改企业id*/
+                        customersExtService.updateCustomersExt(ecustomersExt);
+                    }else {
+                        ecustomersExt = new CustomersExt();
+                        ecustomersExt.setOrgId(orgId);
+                        ecustomersExt.setCreator(user.getAccountId());
+                        ecustomersExt.setChainsCode(user.getSysUserExt().getOrgCode());
+                        customersExtService.insertCustomersExt(ecustomersExt);
+                    }
+                }else {
+                    //去注册
+                    ecustomersExt = eSignService.createThirdParty(customersExt);
+                }
             if (ecustomersExt!=null) {
                 //注册完以后获取认证路径
                 String url = organRealVerifyService.organRealVerify(ecustomersExt.getOrgId(),ecustomersExt.getCreator(),redirectUrl);

+ 17 - 1
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/ESignService.java

@@ -66,4 +66,20 @@ public interface ESignService {
       */
      int updateThirdParty(CustomersExt customersExt);
 
-    }
+     /**
+      * @description: 根据loginName查询E签宝是否存在
+      * @param: [loginName]
+      * @return: java.lang.String
+      * @author: qxm      
+      * @date: 2020/11/27 14:31
+      */ 
+    String getAccountIdByThirdId(String loginName);
+    /**
+     * @description: 根据chainsCode查询E签宝是否存在
+     * @param: [chainsCode]
+     * @return: java.lang.String
+     * @author: qxm
+     * @date: 2020/11/27 14:31
+     */
+    String getOrgIdByThirdId(String chainsCode);
+}

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

@@ -176,6 +176,29 @@ public class ESignServiceImpl implements ESignService {
         return isok;
     }
 
+    @Override
+    public String getOrgIdByThirdId(String chainsCode) {
+        JSONObject json =null;
+        JSONObject jsonObject = eSignHttpUtil.doGetGetJson(ESignUrl.getOrgIdByThirdId, json, chainsCode);
+        JSONObject result = (JSONObject)jsonObject.get("data");
+        return result.get("orgId").toString();
+    }
+
+    /**
+     * @description: 根据loginName查询E签宝是否存在
+     * @param: [loginName]
+     * @return: java.lang.String
+     * @author: qxm
+     * @date: 2020/11/27 14:23
+     */
+    @Override
+    public String getAccountIdByThirdId(String loginName) {
+        JSONObject json =null;
+        JSONObject jsonObject = eSignHttpUtil.doGetGetJson(ESignUrl.getAccountIdByThirdId, json, loginName);
+        JSONObject result = (JSONObject)jsonObject.get("data");
+        return result.get("accountId").toString();
+    }
+
     /**
      * 创建收货单pdf文件
      * @param

+ 4 - 0
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/utils/ESign/ESignUrl.java

@@ -44,6 +44,10 @@ public enum ESignUrl {
     ,ProcessDocumentDownloadUrl("/v1/signflows/%s/documents")
     //个人信息修改
     ,updatePersonalAccount("/v1/accounts/%s")
+    //E签宝个人信息查询
+    ,getAccountIdByThirdId("/v1/accounts/getByThirdId?thirdPartyUserId=%s")
+    //E签宝企业信息查询
+    ,getOrgIdByThirdId("/v1/organizations/getByThirdId?thirdPartyUserId=%s")
     //公司信息修改
     ,updateThirdParty("/v1/organizations/%s")
     //设置静默签署