|
@@ -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);
|