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
5517c796
Commit
5517c796
authored
Jul 19, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
123
parent
69237a35
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
18 deletions
+58
-18
AppUserRest.java
...va/com/github/wxiaoqi/security/admin/rpc/AppUserRest.java
+8
-4
AppPermissionService.java
...aoqi/security/admin/rpc/service/AppPermissionService.java
+50
-14
No files found.
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/AppUserRest.java
View file @
5517c796
...
@@ -144,8 +144,11 @@ public class AppUserRest {
...
@@ -144,8 +144,11 @@ public class AppUserRest {
@RequestMapping
(
value
=
"/user/wxlogin"
)
@RequestMapping
(
value
=
"/user/wxlogin"
)
public
@ResponseBody
JSONObject
wxlogin
(
@RequestParam
(
value
=
"openid"
,
defaultValue
=
""
)
String
openid
,
@RequestParam
(
value
=
"isQQ"
,
defaultValue
=
"0"
)
Integer
isQQ
)
{
public
@ResponseBody
JSONObject
wxlogin
(
return
appPermissionService
.
weCahtLogin
(
openid
,
isQQ
);
@RequestParam
(
value
=
"openid"
,
defaultValue
=
""
)
String
openid
,
@RequestParam
(
value
=
"isQQ"
,
defaultValue
=
"0"
)
Integer
isQQ
,
@RequestParam
(
value
=
"code"
,
defaultValue
=
""
)
String
code
)
{
return
appPermissionService
.
weCahtLogin
(
openid
,
isQQ
,
code
);
}
}
/**
/**
...
@@ -162,10 +165,11 @@ public class AppUserRest {
...
@@ -162,10 +165,11 @@ public class AppUserRest {
@RequestParam
(
value
=
"username"
,
defaultValue
=
""
)
String
username
,
@RequestParam
(
value
=
"username"
,
defaultValue
=
""
)
String
username
,
@RequestParam
(
value
=
"mobilecode"
,
defaultValue
=
""
)
String
mobilecode
,
@RequestParam
(
value
=
"mobilecode"
,
defaultValue
=
""
)
String
mobilecode
,
@RequestParam
(
value
=
"password"
,
defaultValue
=
""
)
String
password
,
@RequestParam
(
value
=
"password"
,
defaultValue
=
""
)
String
password
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"1"
)
Integer
type
@RequestParam
(
value
=
"type"
,
defaultValue
=
"1"
)
Integer
type
,
@RequestParam
(
value
=
"code"
,
defaultValue
=
""
)
String
code
){
){
return
appPermissionService
.
login
(
username
,
password
,
mobilecode
,
type
);
return
appPermissionService
.
login
(
username
,
password
,
mobilecode
,
type
,
code
);
}
}
@RequestMapping
(
value
=
"/user/reset"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/user/reset"
,
method
=
RequestMethod
.
POST
)
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/service/AppPermissionService.java
View file @
5517c796
...
@@ -287,10 +287,10 @@ public class AppPermissionService {
...
@@ -287,10 +287,10 @@ public class AppPermissionService {
rsUserDetail
.
setCode
(
UUIDUtils
.
genCodes
(
8
));
rsUserDetail
.
setCode
(
UUIDUtils
.
genCodes
(
8
));
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
//绑定上下线关系
/
*/
/绑定上下线关系
if(parentId!=null&&parentId>0){
if(parentId!=null&&parentId>0){
relationBiz.bindRelation(userid,parentId,1);
relationBiz.bindRelation(userid,parentId,1);
}
}
*/
//临时会员绑定
//临时会员绑定
insertUserMemberByUserIdAndPhone
(
userid
,
username
);
insertUserMemberByUserIdAndPhone
(
userid
,
username
);
//参加新人活动
//参加新人活动
...
@@ -298,7 +298,7 @@ public class AppPermissionService {
...
@@ -298,7 +298,7 @@ public class AppPermissionService {
//创建钱包
//创建钱包
walletBiz
.
createWalletByUserId
(
appUserLogin
.
getId
());
walletBiz
.
createWalletByUserId
(
appUserLogin
.
getId
());
// 登录结果要做做统一处理
// 登录结果要做做统一处理
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
,
code
);
// 到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
)
{
...
@@ -318,7 +318,7 @@ public class AppPermissionService {
...
@@ -318,7 +318,7 @@ public class AppPermissionService {
data
.
put
(
"imUserId"
,
imUserId
);
data
.
put
(
"imUserId"
,
imUserId
);
}
}
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
sendQueue
(
username
,
password
,
headimgurl
,
nickname
,
mobilecode
,
openId
,
unionid
,
type
,
code
,
activityCode
,
userid
);
sendQueue
(
username
,
password
,
headimgurl
,
nickname
,
mobilecode
,
openId
,
unionid
,
type
,
code
,
activityCode
,
userid
,
RegisterQueueDTO
.
SIGN_NEW
);
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
}
else
{
}
else
{
return
JsonResultUtil
.
createDefaultFail
();
return
JsonResultUtil
.
createDefaultFail
();
...
@@ -329,12 +329,13 @@ public class AppPermissionService {
...
@@ -329,12 +329,13 @@ public class AppPermissionService {
}
}
}
}
private
void
sendQueue
(
String
username
,
String
password
,
String
headimgurl
,
String
nickname
,
String
mobilecode
,
String
openId
,
String
unionid
,
Integer
type
,
String
code
,
String
activityCode
,
Integer
userid
)
{
private
void
sendQueue
(
String
username
,
String
password
,
String
headimgurl
,
String
nickname
,
String
mobilecode
,
String
openId
,
String
unionid
,
Integer
type
,
String
code
,
String
activityCode
,
Integer
userid
,
Integer
sign
)
{
try
{
try
{
RegisterQueueDTO
registerQueueDTO
=
new
RegisterQueueDTO
();
RegisterQueueDTO
registerQueueDTO
=
new
RegisterQueueDTO
();
//出参
//出参
// registerQueueDTO.setData(data);
// registerQueueDTO.setData(data);
registerQueueDTO
.
setAppUserId
(
userid
);
registerQueueDTO
.
setAppUserId
(
userid
);
registerQueueDTO
.
setSign
(
sign
);
//入参
//入参
registerQueueDTO
.
setInParamDTO
(
new
RegisterParamDTO
(
username
,
password
,
headimgurl
,
registerQueueDTO
.
setInParamDTO
(
new
RegisterParamDTO
(
username
,
password
,
headimgurl
,
nickname
,
mobilecode
,
openId
,
unionid
,
type
,
code
,
activityCode
));
nickname
,
mobilecode
,
openId
,
unionid
,
type
,
code
,
activityCode
));
...
@@ -348,7 +349,7 @@ public class AppPermissionService {
...
@@ -348,7 +349,7 @@ 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
,
String
code
)
{
JSONObject
data
=
new
JSONObject
();
JSONObject
data
=
new
JSONObject
();
AppUserVo
userVo
=
appUserDetailBiz
.
getUserInfoById
(
userid
);
AppUserVo
userVo
=
appUserDetailBiz
.
getUserInfoById
(
userid
);
if
(
userVo
!=
null
)
{
if
(
userVo
!=
null
)
{
...
@@ -375,6 +376,40 @@ public class AppPermissionService {
...
@@ -375,6 +376,40 @@ public class AppPermissionService {
//更新登录时间 和 ip
//更新登录时间 和 ip
String
clientIp
=
getIp
();
String
clientIp
=
getIp
();
appUserLoginBiz
.
updateLoginInfo
(
userid
,
clientIp
);
appUserLoginBiz
.
updateLoginInfo
(
userid
,
clientIp
);
try
{
String
code1
=
null
;
String
activityCode
=
null
;
if
(
StringUtils
.
isNotBlank
(
code
)){
//判断处理活动关键字
String
[]
codes
=
code
.
split
(
"_"
);
if
(
codes
.
length
>
1
)
{
code1
=
codes
[
0
];
activityCode
=
codes
[
1
];
}
}
if
(
StringUtils
.
isNotBlank
(
code1
)){
Integer
parentId
=
appUserDetailBiz
.
getUserByCode
(
code1
);
//绑定上下线关系
if
(
parentId
!=
null
&&
parentId
>
0
)
{
relationBiz
.
bindRelation
(
userid
,
parentId
,
1
);
}
//活动消息
Integer
state
=
userVo
.
getState
();
if
(
state
!=
null
&&
state
==
1
&&
StringUtils
.
isNotBlank
(
activityCode
)){
if
(
userVo
.
getInviterAccount
()==
null
||
userVo
.
getInviterAccount
()==
0
){
userVo
.
setInviterAccount
(
parentId
);
}
userVo
.
setState
(
2
);
appUserDetailBiz
.
updUuserInfoById
(
userVo
);
sendQueue
(
username
,
null
,
headimgurl
,
nickname
,
null
,
null
,
null
,
null
,
code1
,
activityCode
,
userid
,
RegisterQueueDTO
.
SIGN_ACTIVATE
);
}
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
}
...
@@ -469,7 +504,7 @@ public class AppPermissionService {
...
@@ -469,7 +504,7 @@ public class AppPermissionService {
appUserDetailBiz.updateSelectiveById(userDetail);
appUserDetailBiz.updateSelectiveById(userDetail);
}*/
}*/
// 登录结果要做做统一处理
// 登录结果要做做统一处理
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
,
code
);
// 到im登录,获取返回结果
// 到im登录,获取返回结果
/*Integer imUserId=userLogin.getImUserid();
/*Integer imUserId=userLogin.getImUserid();
String imPassword=userLogin.getImPassword();
String imPassword=userLogin.getImPassword();
...
@@ -537,7 +572,7 @@ public class AppPermissionService {
...
@@ -537,7 +572,7 @@ public class AppPermissionService {
* @return
* @return
*/
*/
@Transactional
@Transactional
public
JSONObject
weCahtLogin
(
String
openId
,
Integer
isQQ
)
{
public
JSONObject
weCahtLogin
(
String
openId
,
Integer
isQQ
,
String
code
)
{
if
(
StringUtils
.
isBlank
(
openId
))
{
if
(
StringUtils
.
isBlank
(
openId
))
{
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
}
}
...
@@ -556,7 +591,7 @@ public class AppPermissionService {
...
@@ -556,7 +591,7 @@ public class AppPermissionService {
headimgurl
=
userVo
.
getHeadimgurl
();
headimgurl
=
userVo
.
getHeadimgurl
();
nickname
=
userVo
.
getNickname
();
nickname
=
userVo
.
getNickname
();
}
}
JSONObject
data
=
autoLogin
(
userid
,
userLogin
.
getUsername
(),
headimgurl
,
nickname
);
JSONObject
data
=
autoLogin
(
userid
,
userLogin
.
getUsername
(),
headimgurl
,
nickname
,
code
);
/* // 到im注册,获取返回结果
/* // 到im注册,获取返回结果
Integer imUserId=userLogin.getImUserid();
Integer imUserId=userLogin.getImUserid();
String imPassword=userLogin.getImPassword();
String imPassword=userLogin.getImPassword();
...
@@ -571,7 +606,7 @@ public class AppPermissionService {
...
@@ -571,7 +606,7 @@ public class AppPermissionService {
return
JsonResultUtil
.
createDefaultFail
();
return
JsonResultUtil
.
createDefaultFail
();
}
}
public
JSONObject
login
(
String
username
,
String
password
,
String
mobilecode
,
int
type
)
{
public
JSONObject
login
(
String
username
,
String
password
,
String
mobilecode
,
int
type
,
String
code
)
{
if
(
StringUtils
.
isBlank
(
username
)
||
((
StringUtils
.
isBlank
(
password
)
&&
type
==
1
)
||
(
StringUtils
.
isBlank
(
mobilecode
)
&&
type
==
2
)))
{
if
(
StringUtils
.
isBlank
(
username
)
||
((
StringUtils
.
isBlank
(
password
)
&&
type
==
1
)
||
(
StringUtils
.
isBlank
(
mobilecode
)
&&
type
==
2
)))
{
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"请求参数为空"
);
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"请求参数为空"
);
}
}
...
@@ -598,7 +633,7 @@ public class AppPermissionService {
...
@@ -598,7 +633,7 @@ 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
,
code
);
/*// 到im注册,获取返回结果
/*// 到im注册,获取返回结果
Integer imUserId=user.getImUserid();
Integer imUserId=user.getImUserid();
String imPassword=user.getImPassword();
String imPassword=user.getImPassword();
...
@@ -639,7 +674,7 @@ public class AppPermissionService {
...
@@ -639,7 +674,7 @@ public class AppPermissionService {
appUserLoginBiz
.
updatePasswordById
(
user
);
appUserLoginBiz
.
updatePasswordById
(
user
);
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
,
null
);
/* // 到im登录,获取返回结果
/* // 到im登录,获取返回结果
Integer imUserId=user.getImUserid();
Integer imUserId=user.getImUserid();
String imPassword=user.getImPassword();
String imPassword=user.getImPassword();
...
@@ -793,7 +828,7 @@ public class AppPermissionService {
...
@@ -793,7 +828,7 @@ public class AppPermissionService {
* @return
* @return
*/
*/
public
JSONObject
appletLoginByUserId
(
Integer
uid
)
{
public
JSONObject
appletLoginByUserId
(
Integer
uid
)
{
JSONObject
data
=
autoLogin
(
uid
,
null
,
null
,
null
);
JSONObject
data
=
autoLogin
(
uid
,
null
,
null
,
null
,
null
);
if
(
data
.
getDate
(
"userId"
)
!=
null
)
{
if
(
data
.
getDate
(
"userId"
)
!=
null
)
{
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
}
}
...
@@ -847,6 +882,7 @@ public class AppPermissionService {
...
@@ -847,6 +882,7 @@ public class AppPermissionService {
rsUserDetail
.
setChannel
(
UserSourceEnum
.
APPLET
.
getCode
());
rsUserDetail
.
setChannel
(
UserSourceEnum
.
APPLET
.
getCode
());
rsUserDetail
.
setCrtHost
(
getIp
());
rsUserDetail
.
setCrtHost
(
getIp
());
setCreateIPInfo
(
rsUserDetail
);
setCreateIPInfo
(
rsUserDetail
);
rsUserDetail
.
setState
(
1
);
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
//创建钱包
//创建钱包
...
@@ -860,7 +896,7 @@ public class AppPermissionService {
...
@@ -860,7 +896,7 @@ public class AppPermissionService {
//参加新人活动
//参加新人活动
jionActivity
(
userid
);
jionActivity
(
userid
);
// 登录结果要做做统一处理
// 登录结果要做做统一处理
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
,
null
);
// 到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
)
{
...
...
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