Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzuaa
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzuaa
提交
54fc675e
提交
54fc675e
编写于
1月 06, 2021
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
转接sysUser
上级
73bdf4b6
变更
10
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
88 行增加
和
90 行删除
+88
-90
SysUserExService.java
.../cn/ibizlab/core/extensions/service/SysUserExService.java
+14
-0
UAACoreService.java
...n/ibizlab/core/uaa/extensions/service/UAACoreService.java
+6
-5
UserDingtalkRegisterService.java
...e/uaa/extensions/service/UserDingtalkRegisterService.java
+8
-8
UserQQRegisterService.java
...ab/core/uaa/extensions/service/UserQQRegisterService.java
+7
-9
UserRegisterService.java
...zlab/core/uaa/extensions/service/UserRegisterService.java
+8
-16
UserWechatRegisterService.java
...ore/uaa/extensions/service/UserWechatRegisterService.java
+7
-14
UserDingtalkRegisterResource.java
...lab/api/rest/extensions/UserDingtalkRegisterResource.java
+12
-13
UserQQRegisterResource.java
...n/ibizlab/api/rest/extensions/UserQQRegisterResource.java
+12
-11
UserRegisterResource.java
.../cn/ibizlab/api/rest/extensions/UserRegisterResource.java
+2
-1
UserWechatRegisterResource.java
...izlab/api/rest/extensions/UserWechatRegisterResource.java
+12
-13
未找到文件。
ibzuaa-core/src/main/java/cn/ibizlab/core/extensions/service/SysUserExService.java
0 → 100644
浏览文件 @
54fc675e
package
cn
.
ibizlab
.
core
.
extensions
.
service
;
import
cn.ibizlab.core.uaa.service.impl.SysUserServiceImpl
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.stereotype.Service
;
@Service
@Primary
public
class
SysUserExService
extends
SysUserServiceImpl
{
@Override
protected
Class
currentModelClass
()
{
return
com
.
baomidou
.
mybatisplus
.
core
.
toolkit
.
ReflectionKit
.
getSuperClassGenericType
(
this
.
getClass
().
getSuperclass
(),
1
);
}
}
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/service/UAACoreService.java
浏览文件 @
54fc675e
...
...
@@ -8,7 +8,10 @@ import cn.ibizlab.core.uaa.extensions.domain.PermissionType;
import
cn.ibizlab.core.uaa.extensions.helper.DingTalkHelper
;
import
cn.ibizlab.core.uaa.filter.SysRolePermissionSearchContext
;
import
cn.ibizlab.core.uaa.filter.SysUserSearchContext
;
import
cn.ibizlab.core.uaa.service.*
;
import
cn.ibizlab.core.uaa.service.ISysPSSystemService
;
import
cn.ibizlab.core.uaa.service.ISysRolePermissionService
;
import
cn.ibizlab.core.uaa.service.ISysUserRoleService
;
import
cn.ibizlab.core.uaa.service.ISysUserService
;
import
cn.ibizlab.util.domain.Token
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
cn.ibizlab.util.security.AuthTokenUtil
;
...
...
@@ -27,8 +30,6 @@ import org.springframework.cache.annotation.CachePut;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Caching
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.core.GrantedAuthority
;
import
org.springframework.security.core.authority.SimpleGrantedAuthority
;
import
org.springframework.stereotype.Service
;
...
...
@@ -36,6 +37,7 @@ import org.springframework.util.AlternativeJdkIdGenerator;
import
org.springframework.util.Base64Utils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
...
...
@@ -44,7 +46,6 @@ import java.security.KeyPair;
import
java.security.KeyPairGenerator
;
import
java.security.PrivateKey
;
import
java.security.PublicKey
;
import
java.sql.Wrapper
;
import
java.util.*
;
@Service
...
...
@@ -409,7 +410,7 @@ public class UAACoreService {
@Autowired
private
ISysUserService
userService
;
;
private
ISysUserService
userService
;
@Cacheable
(
value
=
"ibzuaa-model"
,
key
=
"'catalog:SysOperator'"
)
public
JSONObject
getOptions
(
String
catalog
)
{
...
...
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/service/UserDingtalkRegisterService.java
浏览文件 @
54fc675e
package
cn
.
ibizlab
.
core
.
uaa
.
extensions
.
service
;
import
cn.ibizlab.core.uaa.domain.SysOpenAccess
;
import
cn.ibizlab.core.uaa.domain.SysUser
;
import
cn.ibizlab.core.uaa.domain.SysUserAuth
;
import
cn.ibizlab.core.uaa.service.ISysOpenAccessService
;
import
cn.ibizlab.core.uaa.service.ISysUserAuthService
;
import
cn.ibizlab.
util.domain.IBZUSER
;
import
cn.ibizlab.
core.uaa.service.ISysUserService
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
cn.ibizlab.util.errors.InternalServerErrorException
;
import
cn.ibizlab.util.security.AuthenticationUser
;
import
cn.ibizlab.util.service.AuthenticationUserService
;
import
cn.ibizlab.util.service.IBZUSERService
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.dingtalk.api.DefaultDingTalkClient
;
...
...
@@ -33,7 +33,7 @@ import org.springframework.util.StringUtils;
public
class
UserDingtalkRegisterService
{
@Autowired
private
I
BZUSERService
ibzu
serService
;
private
I
SysUserService
sysU
serService
;
@Autowired
private
AuthenticationUserService
authenticationUserService
;
...
...
@@ -88,7 +88,7 @@ public class UserDingtalkRegisterService {
String
userId
=
response
.
getUserid
();
//先按userid或者username查
IBZUSER
user
=
ibzuserService
.
getOne
(
Wrappers
.<
IBZUSER
>
lambdaQuery
().
eq
(
IBZUSER:
:
getUserid
,
userId
).
or
().
eq
(
IBZUSER
:
:
getUsername
,
userId
),
false
);
SysUser
user
=
sysUserService
.
getOne
(
Wrappers
.<
SysUser
>
lambdaQuery
().
eq
(
SysUser:
:
getUserid
,
userId
).
or
().
eq
(
SysUser
:
:
getUsername
,
userId
),
false
);
if
(
user
==
null
)
{
...
...
@@ -96,7 +96,7 @@ public class UserDingtalkRegisterService {
SysUserAuth
userAuth
=
sysUserAuthService
.
getOne
(
Wrappers
.<
SysUserAuth
>
lambdaQuery
().
eq
(
SysUserAuth:
:
getIdentityType
,
"dingtalk"
).
eq
(
SysUserAuth:
:
getIdentifier
,
userId
),
false
);
// 该钉钉用户注册过账号,登录系统
if
(
userAuth
!=
null
)
{
user
=
ibzu
serService
.
getById
(
userAuth
.
getUserid
());
user
=
sysU
serService
.
getById
(
userAuth
.
getUserid
());
if
(
user
==
null
)
throw
new
BadRequestAlertException
(
"未找到"
+
userId
+
"对应系统用户"
,
"UserDingtalkRegisterService"
,
""
);
...
...
@@ -138,12 +138,12 @@ public class UserDingtalkRegisterService {
.
and
(
wrapper
->
wrapper
.
eq
(
SysUserAuth:
:
getIdentifier
,
response
.
getUserInfo
().
getOpenid
()).
or
().
eq
(
SysUserAuth:
:
getIdentifier
,
response
.
getUserInfo
().
getUnionid
())
),
false
);
IBZUSER
user
=
null
;
SysUser
user
=
null
;
// 该钉钉用户注册过账号,登录系统
if
(
userAuth
!=
null
)
{
user
=
ibzu
serService
.
getById
(
userAuth
.
getUserid
());
user
=
sysU
serService
.
getById
(
userAuth
.
getUserid
());
if
(
user
==
null
)
user
=
ibzuserService
.
getOne
(
Wrappers
.<
IBZUSER
>
lambdaQuery
().
eq
(
IBZUSER:
:
getUserid
,
response
.
getUserInfo
().
getOpenid
()).
or
().
eq
(
IBZUSER
:
:
getUsername
,
response
.
getUserInfo
().
getOpenid
()),
false
);
user
=
sysUserService
.
getOne
(
Wrappers
.<
SysUser
>
lambdaQuery
().
eq
(
SysUser:
:
getUserid
,
response
.
getUserInfo
().
getOpenid
()).
or
().
eq
(
SysUser
:
:
getUsername
,
response
.
getUserInfo
().
getOpenid
()),
false
);
if
(
user
!=
null
)
{
...
...
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/service/UserQQRegisterService.java
浏览文件 @
54fc675e
package
cn
.
ibizlab
.
core
.
uaa
.
extensions
.
service
;
import
cn.ibizlab.core.uaa.domain.SysOpenAccess
;
import
cn.ibizlab.core.uaa.domain.SysUser
;
import
cn.ibizlab.core.uaa.domain.SysUserAuth
;
import
cn.ibizlab.core.uaa.service.ISysOpenAccessService
;
import
cn.ibizlab.core.uaa.service.ISysUserAuthService
;
import
cn.ibizlab.
util.domain.IBZUSER
;
import
cn.ibizlab.
core.uaa.service.ISysUserService
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
cn.ibizlab.util.errors.InternalServerErrorException
;
import
cn.ibizlab.util.helper.HttpUtils
;
import
cn.ibizlab.util.service.IBZUSERService
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -16,8 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.io.UnsupportedEncodingException
;
/**
* 实体[IBZUSER] QQ用户注册接口实现
*/
...
...
@@ -26,11 +24,11 @@ import java.io.UnsupportedEncodingException;
public
class
UserQQRegisterService
{
@Autowired
private
IBZUSERService
ibzuserService
;
private
ISysUserService
sysUserService
;
@Autowired
private
ISysUserAuthService
sysUserAuthService
;
@Autowired
private
ISysOpenAccessService
sysOpenAccessService
;
...
...
@@ -111,12 +109,12 @@ public class UserQQRegisterService {
returnObj
.
put
(
"openid"
,
openid
);
SysUserAuth
userAuth
=
sysUserAuthService
.
getOne
(
Wrappers
.<
SysUserAuth
>
lambdaQuery
().
eq
(
SysUserAuth:
:
getIdentityType
,
"qq"
).
eq
(
SysUserAuth:
:
getIdentifier
,
openid
),
false
);
IBZUSER
user
=
null
;
SysUser
user
=
null
;
// 该qq用户注册过账号,登录系统
if
(
userAuth
!=
null
)
{
user
=
ibzu
serService
.
getById
(
userAuth
.
getUserid
());
user
=
sysU
serService
.
getById
(
userAuth
.
getUserid
());
if
(
user
==
null
)
user
=
ibzuserService
.
getOne
(
Wrappers
.<
IBZUSER
>
lambdaQuery
().
eq
(
IBZUSER:
:
getUserid
,
openid
).
or
().
eq
(
IBZUSER
:
:
getUsername
,
openid
),
false
);
user
=
sysUserService
.
getOne
(
Wrappers
.<
SysUser
>
lambdaQuery
().
eq
(
SysUser:
:
getUserid
,
openid
).
or
().
eq
(
SysUser
:
:
getUsername
,
openid
),
false
);
if
(
user
!=
null
)
{
...
...
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/service/UserRegisterService.java
浏览文件 @
54fc675e
package
cn
.
ibizlab
.
core
.
uaa
.
extensions
.
service
;
import
cn.ibizlab.core.uaa.domain.SysUser
;
import
cn.ibizlab.core.uaa.domain.SysUserAuth
;
import
cn.ibizlab.core.uaa.service.ISysUserAuthService
;
import
cn.ibizlab.
util.domain.IBZUSER
;
import
cn.ibizlab.
core.uaa.service.ISysUserService
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
cn.ibizlab.util.helper.CachedBeanCopier
;
import
cn.ibizlab.util.service.IBZUSERService
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -15,12 +13,6 @@ import org.springframework.stereotype.Service;
import
org.springframework.util.DigestUtils
;
import
org.springframework.util.StringUtils
;
import
java.sql.Wrapper
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
/**
* 实体[IBZUSER] 用户注册接口实现
*/
...
...
@@ -29,7 +21,7 @@ import java.util.UUID;
public
class
UserRegisterService
{
@Autowired
private
I
BZUSERService
ibzu
serService
;
private
I
SysUserService
sysU
serService
;
@Autowired
private
ISysUserAuthService
sysUserAuthService
;
...
...
@@ -38,12 +30,12 @@ public class UserRegisterService {
private
int
pwencrymode
;
public
IBZUSER
toRegister
(
IBZUSER
account
)
public
SysUser
toRegister
(
SysUser
account
)
{
return
toRegister
(
account
,
null
);
}
public
IBZUSER
toRegister
(
IBZUSER
account
,
SysUserAuth
sysUserAuth
)
{
public
SysUser
toRegister
(
SysUser
account
,
SysUserAuth
sysUserAuth
)
{
String
domains
=
account
.
getDomains
();
String
loginname
=
account
.
getLoginname
();
...
...
@@ -68,8 +60,8 @@ public class UserRegisterService {
String
username
=
loginname
+(
StringUtils
.
isEmpty
(
domains
)?
""
:(
"|"
+
domains
));
IBZUSER
existedUser
=
ibzuserService
.
getOne
(
Wrappers
.<
IBZUSER
>
lambdaQuery
().
eq
(
IBZUSER
:
:
getLoginname
,
loginname
)
.
eq
((!
StringUtils
.
isEmpty
(
domains
)),
IBZUSER
:
:
getDomains
,
domains
),
false
);
SysUser
existedUser
=
sysUserService
.
getOne
(
Wrappers
.<
SysUser
>
lambdaQuery
().
eq
(
SysUser
:
:
getLoginname
,
loginname
)
.
eq
((!
StringUtils
.
isEmpty
(
domains
)),
SysUser
:
:
getDomains
,
domains
),
false
);
if
(
existedUser
!=
null
)
...
...
@@ -100,7 +92,7 @@ public class UserRegisterService {
password
=
DigestUtils
.
md5DigestAsHex
(
String
.
format
(
"%1$s||%2$s"
,
username
,
password
).
getBytes
());
account
.
setPassword
(
password
);
account
.
setUserid
(
username
);
ibzu
serService
.
save
(
account
);
sysU
serService
.
save
(
account
);
}
if
(
sysUserAuth
!=
null
)
...
...
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/service/UserWechatRegisterService.java
浏览文件 @
54fc675e
package
cn
.
ibizlab
.
core
.
uaa
.
extensions
.
service
;
import
cn.ibizlab.core.uaa.domain.SysOpenAccess
;
import
cn.ibizlab.core.uaa.domain.SysUser
;
import
cn.ibizlab.core.uaa.domain.SysUserAuth
;
import
cn.ibizlab.core.uaa.service.ISysOpenAccessService
;
import
cn.ibizlab.core.uaa.service.ISysUserAuthService
;
import
cn.ibizlab.
util.domain.IBZUSER
;
import
cn.ibizlab.
core.uaa.service.ISysUserService
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
cn.ibizlab.util.errors.InternalServerErrorException
;
import
cn.ibizlab.util.helper.HttpUtils
;
import
cn.ibizlab.util.service.IBZUSERService
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.dingtalk.api.DefaultDingTalkClient
;
import
com.dingtalk.api.request.OapiSnsGetuserinfoBycodeRequest
;
import
com.dingtalk.api.response.OapiSnsGetuserinfoBycodeResponse
;
import
com.taobao.api.ApiException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.io.UnsupportedEncodingException
;
import
java.sql.Timestamp
;
/**
* 实体[IBZUSER] 微信用户注册接口实现
*/
...
...
@@ -31,11 +24,11 @@ import java.sql.Timestamp;
public
class
UserWechatRegisterService
{
@Autowired
private
IBZUSERService
ibzuserService
;
private
ISysUserService
sysUserService
;
@Autowired
private
ISysUserAuthService
sysUserAuthService
;
@Autowired
private
ISysOpenAccessService
sysOpenAccessService
;
...
...
@@ -90,12 +83,12 @@ public class UserWechatRegisterService {
.
and
(
wrapper
->
wrapper
.
eq
(
SysUserAuth:
:
getIdentifier
,
openid
).
or
().
eq
(
SysUserAuth:
:
getIdentifier
,
unionid
)
),
false
);
IBZUSER
user
=
null
;
SysUser
user
=
null
;
// 该wechat用户注册过账号,登录系统
if
(
userAuth
!=
null
)
{
user
=
ibzu
serService
.
getById
(
userAuth
.
getUserid
());
user
=
sysU
serService
.
getById
(
userAuth
.
getUserid
());
if
(
user
==
null
)
user
=
ibzuserService
.
getOne
(
Wrappers
.<
IBZUSER
>
lambdaQuery
().
eq
(
IBZUSER:
:
getUserid
,
openid
).
or
().
eq
(
IBZUSER
:
:
getUsername
,
openid
),
false
);
user
=
sysUserService
.
getOne
(
Wrappers
.<
SysUser
>
lambdaQuery
().
eq
(
SysUser:
:
getUserid
,
openid
).
or
().
eq
(
SysUser
:
:
getUsername
,
openid
),
false
);
if
(
user
!=
null
)
{
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/UserDingtalkRegisterResource.java
浏览文件 @
54fc675e
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
import
cn.ibizlab.core.uaa.domain.SysOpenAccess
;
import
cn.ibizlab.core.uaa.domain.SysUser
;
import
cn.ibizlab.core.uaa.domain.SysUserAuth
;
import
cn.ibizlab.core.uaa.extensions.service.UserDingtalkRegisterService
;
import
cn.ibizlab.core.uaa.extensions.service.UserRegisterService
;
...
...
@@ -33,8 +34,6 @@ public class UserDingtalkRegisterResource {
@Autowired
private
UserRegisterService
userRegisterService
;
@Autowired
private
IBZUSERService
ibzuserService
;
@Autowired
private
ISysUserAuthService
sysUserAuthService
;
@Autowired
private
AuthTokenUtil
jwtTokenUtil
;
...
...
@@ -127,24 +126,24 @@ public class UserDingtalkRegisterResource {
throw
new
BadRequestAlertException
(
"钉钉信息openid为空"
,
"UserDingtalkRegisterResource"
,
""
);
// 钉钉用户注册
IBZUSER
ibzuser
=
new
IBZUSER
();
ibzu
ser
.
setPassword
(
password
);
ibzu
ser
.
setLoginname
(
loginname
);
ibzu
ser
.
setPersonname
(
StringUtils
.
isEmpty
(
personname
)?
nickname:
personname
);
ibzu
ser
.
setNickname
(
nickname
);
ibzu
ser
.
setPhone
(
phone
);
ibzu
ser
.
setEmail
(
email
);
ibzu
ser
.
setDomains
(
domains
);
SysUser
sysUser
=
new
SysUser
();
sysU
ser
.
setPassword
(
password
);
sysU
ser
.
setLoginname
(
loginname
);
sysU
ser
.
setPersonname
(
StringUtils
.
isEmpty
(
personname
)?
nickname:
personname
);
sysU
ser
.
setNickname
(
nickname
);
sysU
ser
.
setPhone
(
phone
);
sysU
ser
.
setEmail
(
email
);
sysU
ser
.
setDomains
(
domains
);
SysUserAuth
userAuth
=
new
SysUserAuth
();
userAuth
.
setIdentifier
(
openid
);
userAuth
.
setIdentityType
(
"dingtalk"
);
userRegisterService
.
toRegister
(
ibzu
ser
,
userAuth
);
userRegisterService
.
toRegister
(
sysU
ser
,
userAuth
);
// 生成登录token信息
userDetailsService
.
resetByUsername
(
ibzuser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
ibzuser
.
getDomains
())?
""
:(
"|"
+
ibzu
ser
.
getDomains
())));
AuthenticationUser
user
=
userDetailsService
.
loadUserByUsername
(
ibzuser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
ibzuser
.
getDomains
())?
""
:(
"|"
+
ibzu
ser
.
getDomains
())));
userDetailsService
.
resetByUsername
(
sysUser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
sysUser
.
getDomains
())?
""
:(
"|"
+
sysU
ser
.
getDomains
())));
AuthenticationUser
user
=
userDetailsService
.
loadUserByUsername
(
sysUser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
sysUser
.
getDomains
())?
""
:(
"|"
+
sysU
ser
.
getDomains
())));
final
String
token
=
jwtTokenUtil
.
generateToken
(
user
);
AuthenticationUser
user2
=
new
AuthenticationUser
();
CachedBeanCopier
.
copy
(
user
,
user2
);
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/UserQQRegisterResource.java
浏览文件 @
54fc675e
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
import
cn.ibizlab.core.uaa.domain.SysOpenAccess
;
import
cn.ibizlab.core.uaa.domain.SysUser
;
import
cn.ibizlab.core.uaa.domain.SysUserAuth
;
import
cn.ibizlab.core.uaa.extensions.service.UserQQRegisterService
;
import
cn.ibizlab.core.uaa.extensions.service.UserRegisterService
;
...
...
@@ -126,24 +127,24 @@ public class UserQQRegisterResource {
throw
new
BadRequestAlertException
(
"QQ信息openid为空"
,
"UserQQRegisterResource"
,
""
);
// qq用户注册
IBZUSER
ibzuser
=
new
IBZUSER
();
ibzu
ser
.
setPassword
(
password
);
ibzu
ser
.
setLoginname
(
loginname
);
ibzu
ser
.
setPersonname
(
StringUtils
.
isEmpty
(
personname
)?
nickname:
personname
);
ibzu
ser
.
setNickname
(
nickname
);
ibzu
ser
.
setPhone
(
phone
);
ibzu
ser
.
setEmail
(
email
);
ibzu
ser
.
setDomains
(
domains
);
SysUser
sysUser
=
new
SysUser
();
sysU
ser
.
setPassword
(
password
);
sysU
ser
.
setLoginname
(
loginname
);
sysU
ser
.
setPersonname
(
StringUtils
.
isEmpty
(
personname
)?
nickname:
personname
);
sysU
ser
.
setNickname
(
nickname
);
sysU
ser
.
setPhone
(
phone
);
sysU
ser
.
setEmail
(
email
);
sysU
ser
.
setDomains
(
domains
);
SysUserAuth
userAuth
=
new
SysUserAuth
();
userAuth
.
setIdentifier
(
openid
);
userAuth
.
setIdentityType
(
"qq"
);
userRegisterService
.
toRegister
(
ibzu
ser
,
userAuth
);
userRegisterService
.
toRegister
(
sysU
ser
,
userAuth
);
// 生成登录token信息
userDetailsService
.
resetByUsername
(
ibzuser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
ibzuser
.
getDomains
())?
""
:(
"|"
+
ibzu
ser
.
getDomains
())));
AuthenticationUser
user
=
userDetailsService
.
loadUserByUsername
(
ibzuser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
ibzuser
.
getDomains
())?
""
:(
"|"
+
ibzu
ser
.
getDomains
())));
userDetailsService
.
resetByUsername
(
sysUser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
sysUser
.
getDomains
())?
""
:(
"|"
+
sysU
ser
.
getDomains
())));
AuthenticationUser
user
=
userDetailsService
.
loadUserByUsername
(
sysUser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
sysUser
.
getDomains
())?
""
:(
"|"
+
sysU
ser
.
getDomains
())));
final
String
token
=
jwtTokenUtil
.
generateToken
(
user
);
AuthenticationUser
user2
=
new
AuthenticationUser
();
CachedBeanCopier
.
copy
(
user
,
user2
);
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/UserRegisterResource.java
浏览文件 @
54fc675e
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
import
cn.ibizlab.core.uaa.domain.SysUser
;
import
cn.ibizlab.core.uaa.extensions.service.UserRegisterService
;
import
cn.ibizlab.util.domain.IBZUSER
;
import
com.alibaba.fastjson.JSONObject
;
...
...
@@ -18,7 +19,7 @@ public class UserRegisterResource {
private
UserRegisterService
userRegisterService
;
@PostMapping
(
value
=
"/uaa/register"
)
public
ResponseEntity
<
JSONObject
>
register
(
@RequestBody
IBZUSER
ibzuser
)
{
public
ResponseEntity
<
JSONObject
>
register
(
@RequestBody
SysUser
ibzuser
)
{
JSONObject
object
=
new
JSONObject
();
// 响应结果
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/UserWechatRegisterResource.java
浏览文件 @
54fc675e
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
import
cn.ibizlab.core.uaa.domain.SysOpenAccess
;
import
cn.ibizlab.core.uaa.domain.SysUser
;
import
cn.ibizlab.core.uaa.domain.SysUserAuth
;
import
cn.ibizlab.core.uaa.extensions.service.UserRegisterService
;
import
cn.ibizlab.core.uaa.extensions.service.UserWechatRegisterService
;
...
...
@@ -34,8 +35,6 @@ public class UserWechatRegisterResource {
@Autowired
private
UserRegisterService
userRegisterService
;
@Autowired
private
IBZUSERService
ibzuserService
;
@Autowired
private
ISysUserAuthService
sysUserAuthService
;
@Autowired
private
AuthTokenUtil
jwtTokenUtil
;
...
...
@@ -128,24 +127,24 @@ public class UserWechatRegisterResource {
throw
new
BadRequestAlertException
(
"微信信息openid为空"
,
"UserWechatRegisterResource"
,
""
);
// 微信用户注册
IBZUSER
ibzuser
=
new
IBZUSER
();
ibzu
ser
.
setPassword
(
password
);
ibzu
ser
.
setLoginname
(
loginname
);
ibzu
ser
.
setPersonname
(
StringUtils
.
isEmpty
(
personname
)?
nickname:
personname
);
ibzu
ser
.
setNickname
(
nickname
);
ibzu
ser
.
setPhone
(
phone
);
ibzu
ser
.
setEmail
(
email
);
ibzu
ser
.
setDomains
(
domains
);
SysUser
sysUser
=
new
SysUser
();
sysU
ser
.
setPassword
(
password
);
sysU
ser
.
setLoginname
(
loginname
);
sysU
ser
.
setPersonname
(
StringUtils
.
isEmpty
(
personname
)?
nickname:
personname
);
sysU
ser
.
setNickname
(
nickname
);
sysU
ser
.
setPhone
(
phone
);
sysU
ser
.
setEmail
(
email
);
sysU
ser
.
setDomains
(
domains
);
SysUserAuth
userAuth
=
new
SysUserAuth
();
userAuth
.
setIdentifier
(
openid
);
userAuth
.
setIdentityType
(
"wechat"
);
userRegisterService
.
toRegister
(
ibzu
ser
,
userAuth
);
userRegisterService
.
toRegister
(
sysU
ser
,
userAuth
);
// 生成登录token信息
userDetailsService
.
resetByUsername
(
ibzuser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
ibzuser
.
getDomains
())?
""
:(
"|"
+
ibzu
ser
.
getDomains
())));
AuthenticationUser
user
=
userDetailsService
.
loadUserByUsername
(
ibzuser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
ibzuser
.
getDomains
())?
""
:(
"|"
+
ibzu
ser
.
getDomains
())));
userDetailsService
.
resetByUsername
(
sysUser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
sysUser
.
getDomains
())?
""
:(
"|"
+
sysU
ser
.
getDomains
())));
AuthenticationUser
user
=
userDetailsService
.
loadUserByUsername
(
sysUser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
sysUser
.
getDomains
())?
""
:(
"|"
+
sysU
ser
.
getDomains
())));
final
String
token
=
jwtTokenUtil
.
generateToken
(
user
);
AuthenticationUser
user2
=
new
AuthenticationUser
();
CachedBeanCopier
.
copy
(
user
,
user2
);
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录