Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
df85fd91
Commit
df85fd91
authored
Jul 05, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
123
parent
a2bfe95b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
41 deletions
+37
-41
AppPermissionService.java
...aoqi/security/admin/rpc/service/AppPermissionService.java
+37
-41
No files found.
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/service/AppPermissionService.java
View file @
df85fd91
...
@@ -253,7 +253,7 @@ public class AppPermissionService {
...
@@ -253,7 +253,7 @@ public class AppPermissionService {
Map
<
String
,
Object
>
map
=
registerIm
(
username
,
appUserLogin
.
getPassword
(),
nickname
);
Map
<
String
,
Object
>
map
=
registerIm
(
username
,
appUserLogin
.
getPassword
(),
nickname
);
if
(
map
!=
null
){
if
(
map
!=
null
){
Integer
imUserId
=
Integer
.
parseInt
(
map
.
get
(
"userId"
).
toString
());
Integer
imUserId
=
Integer
.
parseInt
(
map
.
get
(
"userId"
).
toString
());
String
access_token
=
map
.
get
(
"access_token"
).
toString
();
//
String access_token=map.get("access_token").toString();
String
imPassword
=
map
.
get
(
"password"
).
toString
();
String
imPassword
=
map
.
get
(
"password"
).
toString
();
if
(
imUserId
!=
null
&&
imUserId
>
0
&&
StringUtils
.
isNotBlank
(
imPassword
)){
if
(
imUserId
!=
null
&&
imUserId
>
0
&&
StringUtils
.
isNotBlank
(
imPassword
)){
AppUserLogin
userLogin
=
new
AppUserLogin
();
AppUserLogin
userLogin
=
new
AppUserLogin
();
...
@@ -264,7 +264,7 @@ public class AppPermissionService {
...
@@ -264,7 +264,7 @@ public class AppPermissionService {
appUserLoginBiz
.
updateSelectiveById
(
userLogin
);
appUserLoginBiz
.
updateSelectiveById
(
userLogin
);
log
.
info
(
username
+
"----userLogin updateSelectiveById---username====="
+
username
+
"----imPassword===="
+
imPassword
);
log
.
info
(
username
+
"----userLogin updateSelectiveById---username====="
+
username
+
"----imPassword===="
+
imPassword
);
}
}
data
.
put
(
"imToken"
,
access_token
);
//
data.put("imToken",access_token);
data
.
put
(
"imUserId"
,
imUserId
);
data
.
put
(
"imUserId"
,
imUserId
);
}
}
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
...
@@ -283,12 +283,10 @@ public class AppPermissionService {
...
@@ -283,12 +283,10 @@ public class AppPermissionService {
*/
*/
public
JSONObject
autoLogin
(
Integer
userid
,
String
username
,
String
headimgurl
,
String
nickname
)
{
public
JSONObject
autoLogin
(
Integer
userid
,
String
username
,
String
headimgurl
,
String
nickname
)
{
JSONObject
data
=
new
JSONObject
();
JSONObject
data
=
new
JSONObject
();
AppUserLogin
userLoign
=
appUserLoginBiz
.
selectById
(
userid
);
if
(
userLoign
!=
null
)
{
data
.
put
(
"nickname"
,
nickname
);
data
.
put
(
"headerurl"
,
headimgurl
);
AppUserVo
userVo
=
appUserDetailBiz
.
getUserInfoById
(
userid
);
AppUserVo
userVo
=
appUserDetailBiz
.
getUserInfoById
(
userid
);
if
(
userVo
!=
null
)
{
if
(
userVo
!=
null
)
{
data
.
put
(
"nickname"
,
nickname
);
data
.
put
(
"headerurl"
,
headimgurl
);
if
(
StringUtils
.
isNotBlank
(
userVo
.
getNickname
()))
{
if
(
StringUtils
.
isNotBlank
(
userVo
.
getNickname
()))
{
data
.
put
(
"nickname"
,
userVo
.
getNickname
());
data
.
put
(
"nickname"
,
userVo
.
getNickname
());
}
}
...
@@ -296,7 +294,6 @@ public class AppPermissionService {
...
@@ -296,7 +294,6 @@ public class AppPermissionService {
data
.
put
(
"headerurl"
,
userVo
.
getHeadimgurl
());
data
.
put
(
"headerurl"
,
userVo
.
getHeadimgurl
());
}
}
data
.
put
(
"certificationStatus"
,
userVo
.
getCertificationStatus
());
data
.
put
(
"certificationStatus"
,
userVo
.
getCertificationStatus
());
}
// 缓存操作
// 缓存操作
String
token
=
""
;
String
token
=
""
;
String
imtoken_
=
""
;
String
imtoken_
=
""
;
...
@@ -304,13 +301,16 @@ public class AppPermissionService {
...
@@ -304,13 +301,16 @@ public class AppPermissionService {
//userRedisTemplate.opsForValue().set("imtoken_" + userid,imtoken_,SystemConfig.REDISTOKENTIME, TimeUnit.SECONDS);
//userRedisTemplate.opsForValue().set("imtoken_" + userid,imtoken_,SystemConfig.REDISTOKENTIME, TimeUnit.SECONDS);
// 返回结果
// 返回结果
// data.put("token", token);
// data.put("token", token);
data
.
put
(
"username"
,
StringUtils
.
isNotEmpty
(
username
)?
username:
userLoign
.
getUsername
());
data
.
put
(
"username"
,
StringUtils
.
isNotEmpty
(
username
)?
username:
userVo
.
getUsername
());
data
.
put
(
"userId"
,
userid
);
data
.
put
(
"userId"
,
userid
);
data
.
put
(
"imUserId"
,
userVo
.
getImUserid
());
//更新登录时间 和 ip
//更新登录时间 和 ip
EntityUtils
.
setCreatAndUpdatInfo
(
userLoign
);
AppUserLogin
userLoign
=
new
AppUserLogin
();
EntityUtils
.
setCreateInfo
(
userLoign
);
appUserLoginBiz
.
updateLoginInfo
(
userid
,
userLoign
.
getCrtHost
());
appUserLoginBiz
.
updateLoginInfo
(
userid
,
userLoign
.
getCrtHost
());
}
}
return
data
;
return
data
;
}
}
...
@@ -387,14 +387,14 @@ public class AppPermissionService {
...
@@ -387,14 +387,14 @@ public class AppPermissionService {
}*/
}*/
// 登录结果要做做统一处理
// 登录结果要做做统一处理
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
// 到im
注册
,获取返回结果
// 到im
登录
,获取返回结果
Integer
imUserId
=
userLogin
.
getImUserid
();
/*
Integer imUserId=userLogin.getImUserid();
String imPassword=userLogin.getImPassword();
String imPassword=userLogin.getImPassword();
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
String access_token=loginIm(username,imPassword,imUserId);
String access_token=loginIm(username,imPassword,imUserId);
data.put("imToken",access_token);
data.put("imToken",access_token);
data.put("imUserId",imUserId);
data.put("imUserId",imUserId);
}
}
*/
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
}
}
...
@@ -474,14 +474,14 @@ public class AppPermissionService {
...
@@ -474,14 +474,14 @@ public class AppPermissionService {
nickname
=
userVo
.
getNickname
();
nickname
=
userVo
.
getNickname
();
}
}
JSONObject
data
=
autoLogin
(
userid
,
userLogin
.
getUsername
(),
headimgurl
,
nickname
);
JSONObject
data
=
autoLogin
(
userid
,
userLogin
.
getUsername
(),
headimgurl
,
nickname
);
// 到im注册,获取返回结果
/*
// 到im注册,获取返回结果
Integer imUserId=userLogin.getImUserid();
Integer imUserId=userLogin.getImUserid();
String imPassword=userLogin.getImPassword();
String imPassword=userLogin.getImPassword();
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
String access_token=loginIm(userLogin.getUsername(),imPassword,imUserId);
String access_token=loginIm(userLogin.getUsername(),imPassword,imUserId);
data.put("imToken",access_token);
data.put("imToken",access_token);
data.put("imUserId",imUserId);
data.put("imUserId",imUserId);
}
}
*/
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
}
}
...
@@ -516,14 +516,14 @@ public class AppPermissionService {
...
@@ -516,14 +516,14 @@ public class AppPermissionService {
Integer
userid
=
user
.
getId
();
Integer
userid
=
user
.
getId
();
String
nickname
=
SystemConfig
.
USER_NIKENAME_DEFAULT
+
(
int
)
((
Math
.
random
()
*
9
+
1
)
*
100000
);
String
nickname
=
SystemConfig
.
USER_NIKENAME_DEFAULT
+
(
int
)
((
Math
.
random
()
*
9
+
1
)
*
100000
);
JSONObject
data
=
autoLogin
(
userid
,
user
.
getUsername
(),
SystemConfig
.
USER_HEADER_URL_DEFAULT
,
nickname
);
JSONObject
data
=
autoLogin
(
userid
,
user
.
getUsername
(),
SystemConfig
.
USER_HEADER_URL_DEFAULT
,
nickname
);
// 到im注册,获取返回结果
/
*/
/ 到im注册,获取返回结果
Integer imUserId=user.getImUserid();
Integer imUserId=user.getImUserid();
String imPassword=user.getImPassword();
String imPassword=user.getImPassword();
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
String access_token=loginIm(username,imPassword,imUserId);
String access_token=loginIm(username,imPassword,imUserId);
data.put("imToken",access_token);
data.put("imToken",access_token);
data.put("imUserId",imUserId);
data.put("imUserId",imUserId);
}
}
*/
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
}
}
...
@@ -557,14 +557,14 @@ public class AppPermissionService {
...
@@ -557,14 +557,14 @@ public class AppPermissionService {
Integer
userid
=
user
.
getId
();
Integer
userid
=
user
.
getId
();
String
nickname
=
SystemConfig
.
USER_NIKENAME_DEFAULT
+
(
int
)
((
Math
.
random
()
*
9
+
1
)
*
100000
);
String
nickname
=
SystemConfig
.
USER_NIKENAME_DEFAULT
+
(
int
)
((
Math
.
random
()
*
9
+
1
)
*
100000
);
JSONObject
data
=
autoLogin
(
userid
,
user
.
getUsername
(),
SystemConfig
.
USER_HEADER_URL_DEFAULT
,
nickname
);
JSONObject
data
=
autoLogin
(
userid
,
user
.
getUsername
(),
SystemConfig
.
USER_HEADER_URL_DEFAULT
,
nickname
);
// 到im注册
,获取返回结果
/* // 到im登录
,获取返回结果
Integer imUserId=user.getImUserid();
Integer imUserId=user.getImUserid();
String imPassword=user.getImPassword();
String imPassword=user.getImPassword();
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
String access_token=loginIm(username,imPassword,imUserId);
String access_token=loginIm(username,imPassword,imUserId);
data.put("imToken",access_token);
data.put("imToken",access_token);
data.put("imUserId",imUserId);
data.put("imUserId",imUserId);
}
}
*/
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
}
}
...
@@ -638,10 +638,10 @@ public class AppPermissionService {
...
@@ -638,10 +638,10 @@ public class AppPermissionService {
log
.
error
(
"------im注册----data======"
+
data
);
log
.
error
(
"------im注册----data======"
+
data
);
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
map
.
put
(
"userId"
,
data
.
getString
(
"userId"
));
map
.
put
(
"userId"
,
data
.
getString
(
"userId"
));
map
.
put
(
"access_token"
,
data
.
getString
(
"access_token"
));
//
map.put("access_token", data.getString("access_token"));
}
else
{
}
else
{
map
.
put
(
"userId"
,
""
);
map
.
put
(
"userId"
,
""
);
map
.
put
(
"access_token"
,
""
);
//
map.put("access_token", "");
}
}
}
}
}
}
...
@@ -658,7 +658,7 @@ public class AppPermissionService {
...
@@ -658,7 +658,7 @@ public class AppPermissionService {
map
.
put
(
"password"
,
password
);
map
.
put
(
"password"
,
password
);
map
.
put
(
"userId"
,
userId
);
map
.
put
(
"userId"
,
userId
);
BaseResponse
response
=
imFeign
.
login
(
map
);
BaseResponse
response
=
imFeign
.
login
(
map
);
log
.
error
(
"
register
Im->response:{}"
,
response
);
log
.
error
(
"
login
Im->response:{}"
,
response
);
String
access_token
=
""
;
String
access_token
=
""
;
if
(
response
.
getStatus
()
==
ResultCode
.
SUCCESS_CODE
)
{
if
(
response
.
getStatus
()
==
ResultCode
.
SUCCESS_CODE
)
{
String
result
=
response
.
getMessage
();
String
result
=
response
.
getMessage
();
...
@@ -721,7 +721,6 @@ public class AppPermissionService {
...
@@ -721,7 +721,6 @@ public class AppPermissionService {
//主要是ip地址
//主要是ip地址
EntityUtils
.
setCreatAndUpdatInfo
(
appUserLogin
);
EntityUtils
.
setCreatAndUpdatInfo
(
appUserLogin
);
setCreateIPInfo
(
appUserLogin
);
setCreateIPInfo
(
appUserLogin
);
appUserLogin
.
setUsername
(
username
);
appUserLogin
.
setUsername
(
username
);
appUserLogin
.
setPassword
(
password
);
appUserLogin
.
setPassword
(
password
);
appUserLogin
.
setIsdel
(
0
);
appUserLogin
.
setIsdel
(
0
);
...
@@ -745,17 +744,15 @@ public class AppPermissionService {
...
@@ -745,17 +744,15 @@ public class AppPermissionService {
log
.
error
(
"注册:新增用户详情: "
+
userid
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
//上线绑定
//上线绑定
relationBiz
.
bindByUserId
(
userid
,
small_id
);
relationBiz
.
bindByUserId
(
userid
,
small_id
);
//自动登录获取优惠卷
authCoupn
(
userid
);
//发送短信通知用户
//发送短信通知用户
thirdFeign
.
sendCode
(
username
,
password
,
SystemConfig
.
TEMPLATECODE
);
thirdFeign
.
sendCode
(
username
,
password
,
SystemConfig
.
TEMPLATECODE
);
// 登录结果要做做统一处理
// 登录结果要做做统一处理
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
// 到im注册,获取返回结果
// 到im注册,获取返回结果
/*
Map<String,Object> map=registerIm(username,appUserLogin.getPassword(),nickname);
Map
<
String
,
Object
>
map
=
registerIm
(
username
,
appUserLogin
.
getPassword
(),
nickname
);
if
(
map
!=
null
){
if
(
map
!=
null
){
Integer
imUserId
=
Integer
.
parseInt
(
map
.
get
(
"userId"
).
toString
());
Integer
imUserId
=
Integer
.
parseInt
(
map
.
get
(
"userId"
).
toString
());
String access_token=map.get("access_token").toString();
//
String access_token=map.get("access_token").toString();
String
imPassword
=
map
.
get
(
"password"
).
toString
();
String
imPassword
=
map
.
get
(
"password"
).
toString
();
if
(
imUserId
!=
null
&&
imUserId
>
0
&&
StringUtils
.
isNotBlank
(
imPassword
)){
if
(
imUserId
!=
null
&&
imUserId
>
0
&&
StringUtils
.
isNotBlank
(
imPassword
)){
AppUserLogin
userLogin
=
new
AppUserLogin
();
AppUserLogin
userLogin
=
new
AppUserLogin
();
...
@@ -766,11 +763,10 @@ public class AppPermissionService {
...
@@ -766,11 +763,10 @@ public class AppPermissionService {
appUserLoginBiz
.
updateSelectiveById
(
userLogin
);
appUserLoginBiz
.
updateSelectiveById
(
userLogin
);
log
.
info
(
username
+
"----userLogin updateSelectiveById---username====="
+
username
+
"----imPassword===="
+
imPassword
);
log
.
info
(
username
+
"----userLogin updateSelectiveById---username====="
+
username
+
"----imPassword===="
+
imPassword
);
}
}
data.put("imToken",access_token);
//
data.put("imToken",access_token);
data
.
put
(
"imUserId"
,
imUserId
);
data
.
put
(
"imUserId"
,
imUserId
);
}
*/
}
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
}
else
{
}
else
{
return
JsonResultUtil
.
createDefaultFail
();
return
JsonResultUtil
.
createDefaultFail
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment