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
dce81cde
Commit
dce81cde
authored
Sep 30, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
123
parent
8107ef94
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
15 deletions
+27
-15
AppPermissionService.java
...aoqi/security/admin/rpc/service/AppPermissionService.java
+27
-15
No files found.
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/service/AppPermissionService.java
View file @
dce81cde
...
@@ -239,7 +239,7 @@ public class AppPermissionService {
...
@@ -239,7 +239,7 @@ public class AppPermissionService {
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
JSONObject
register
(
String
username
,
String
password
,
String
headimgurl
,
public
JSONObject
register
(
String
username
,
String
password
,
String
headimgurl
,
String
nickname
,
String
mobilecode
,
String
openId
,
String
unionid
,
Integer
type
,
String
code
)
{
String
nickname
,
String
mobilecode
,
String
openId
,
String
unionid
,
Integer
type
,
String
code
)
{
log
.
info
(
"register------code====="
+
code
);
log
.
info
(
"register------code====="
+
code
+
"----开始进入方法---time===="
+
System
.
currentTimeMillis
()/
1000L
);
String
activityCode
=
null
;
String
activityCode
=
null
;
// 判断参数和验证码
// 判断参数和验证码
if
(
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
password
)
||
StringUtils
.
isBlank
(
mobilecode
))
{
if
(
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
password
)
||
StringUtils
.
isBlank
(
mobilecode
))
{
...
@@ -247,7 +247,7 @@ public class AppPermissionService {
...
@@ -247,7 +247,7 @@ public class AppPermissionService {
}
}
String
redisLockKey
=
RedisKey
.
CONSTANT_CODE_PREFIX
+
username
+
mobilecode
;
String
redisLockKey
=
RedisKey
.
CONSTANT_CODE_PREFIX
+
username
+
mobilecode
;
String
mobilecodeRedis
=
userRedisTemplate
.
opsForValue
().
get
(
redisLockKey
)
==
null
?
""
:
userRedisTemplate
.
opsForValue
().
get
(
redisLockKey
).
toString
();
String
mobilecodeRedis
=
userRedisTemplate
.
opsForValue
().
get
(
redisLockKey
)
==
null
?
""
:
userRedisTemplate
.
opsForValue
().
get
(
redisLockKey
).
toString
();
log
.
error
(
"注册接口,获取redis中的验证码:"
+
mobilecodeRedis
);
log
.
info
(
"注册接口,获取redis中的验证码:"
+
mobilecodeRedis
+
"---time===="
+
System
.
currentTimeMillis
()/
1000L
);
// 获取到缓存的验证码后要先清空缓存对应键的值
// 获取到缓存的验证码后要先清空缓存对应键的值
userRedisTemplate
.
delete
(
redisLockKey
);
userRedisTemplate
.
delete
(
redisLockKey
);
if
(
StringUtils
.
isBlank
(
mobilecodeRedis
))
{
if
(
StringUtils
.
isBlank
(
mobilecodeRedis
))
{
...
@@ -282,7 +282,7 @@ public class AppPermissionService {
...
@@ -282,7 +282,7 @@ public class AppPermissionService {
appUserLogin
.
setUpdatetime
(
now
);
appUserLogin
.
setUpdatetime
(
now
);
appUserLoginBiz
.
insertSelective
(
appUserLogin
);
appUserLoginBiz
.
insertSelective
(
appUserLogin
);
Integer
userid
=
appUserLogin
.
getId
();
Integer
userid
=
appUserLogin
.
getId
();
log
.
error
(
"注册:新增登陆用户信息: "
+
userid
);
log
.
info
(
"注册:新增登陆用户信息: "
+
userid
+
"---time===="
+
System
.
currentTimeMillis
()/
1000L
);
// 新增用户详情
// 新增用户详情
AppUserDetail
rsUserDetail
=
new
AppUserDetail
();
AppUserDetail
rsUserDetail
=
new
AppUserDetail
();
rsUserDetail
.
setUserid
(
userid
);
rsUserDetail
.
setUserid
(
userid
);
...
@@ -292,7 +292,9 @@ public class AppPermissionService {
...
@@ -292,7 +292,9 @@ public class AppPermissionService {
rsUserDetail
.
setUpdatetime
(
now
);
rsUserDetail
.
setUpdatetime
(
now
);
rsUserDetail
.
setIsdel
(
0
);
rsUserDetail
.
setIsdel
(
0
);
rsUserDetail
.
setCrtHost
(
getIp
());
rsUserDetail
.
setCrtHost
(
getIp
());
setCreateIPInfo
(
rsUserDetail
);
//setCreateIPInfo(rsUserDetail);
log
.
info
(
"注册:解析地址后: "
+
userid
+
"---time===="
+
System
.
currentTimeMillis
()/
1000L
);
//邀请人id关系绑定
//邀请人id关系绑定
Integer
parentId
=
0
;
Integer
parentId
=
0
;
if
(
StringUtils
.
isNotBlank
(
code
)){
if
(
StringUtils
.
isNotBlank
(
code
)){
...
@@ -314,21 +316,27 @@ public class AppPermissionService {
...
@@ -314,21 +316,27 @@ public class AppPermissionService {
//生成邀请码 长度改为8 不然重复率太高
//生成邀请码 长度改为8 不然重复率太高
rsUserDetail
.
setCode
(
ReferralCodeUtil
.
encode
(
userid
));
rsUserDetail
.
setCode
(
ReferralCodeUtil
.
encode
(
userid
));
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
log
.
info
(
"注册:新增用户详情: "
+
userid
+
"---time===="
+
System
.
currentTimeMillis
()/
1000L
);
/* //绑定上下线关系
/* //绑定上下线关系
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
);
log
.
info
(
"注册:临时会员绑定: "
+
userid
+
"---time===="
+
System
.
currentTimeMillis
()/
1000L
);
//参加新人活动
//参加新人活动
jionActivity
(
userid
);
jionActivity
(
userid
);
log
.
info
(
"注册:参加新人活动: "
+
userid
+
"---time===="
+
System
.
currentTimeMillis
()/
1000L
);
//创建钱包
//创建钱包
walletBiz
.
createWalletByUserId
(
appUserLogin
.
getId
());
walletBiz
.
createWalletByUserId
(
appUserLogin
.
getId
());
log
.
info
(
"注册:创建钱包: "
+
userid
+
"---time===="
+
System
.
currentTimeMillis
()/
1000L
);
// 登录结果要做做统一处理
// 登录结果要做做统一处理
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
,
code
,
activityCode
,
1
);
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
,
code
,
activityCode
,
1
);
log
.
info
(
"注册:登录结果要做做统一处理: "
+
userid
+
"---time===="
+
System
.
currentTimeMillis
()/
1000L
);
// 到im注册,获取返回结果
// 到im注册,获取返回结果
Map
<
String
,
Object
>
map
=
registerIm
(
username
,
appUserLogin
.
getPassword
(),
nickname
);
Map
<
String
,
Object
>
map
=
registerIm
(
username
,
appUserLogin
.
getPassword
(),
nickname
);
log
.
info
(
"注册:到im注册: "
+
userid
+
"---time===="
+
System
.
currentTimeMillis
()/
1000L
);
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();
...
@@ -345,6 +353,7 @@ public class AppPermissionService {
...
@@ -345,6 +353,7 @@ public class AppPermissionService {
//data.put("imToken",access_token);
//data.put("imToken",access_token);
data
.
put
(
"imUserId"
,
imUserId
);
data
.
put
(
"imUserId"
,
imUserId
);
}
}
log
.
info
(
"注册:处理im账号: "
+
userid
+
"---time===="
+
System
.
currentTimeMillis
()/
1000L
);
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"userId"
,
userid
);
jsonObject
.
put
(
"userId"
,
userid
);
...
@@ -352,6 +361,7 @@ public class AppPermissionService {
...
@@ -352,6 +361,7 @@ public class AppPermissionService {
log
.
info
(
"注册成功获取积分:发送消息 exchange = {}, routingKey = {}, json = {}"
,
RabbitConstant
.
INTEGRAL_TOPIC
,
RabbitConstant
.
INTEGRAL_ROUTING_KEY
,
jsonObject
.
toJSONString
());
log
.
info
(
"注册成功获取积分:发送消息 exchange = {}, routingKey = {}, json = {}"
,
RabbitConstant
.
INTEGRAL_TOPIC
,
RabbitConstant
.
INTEGRAL_ROUTING_KEY
,
jsonObject
.
toJSONString
());
mqSenderFeign
.
sendMessage
(
RabbitConstant
.
INTEGRAL_TOPIC
,
RabbitConstant
.
INTEGRAL_ROUTING_KEY
,
jsonObject
.
toJSONString
());
mqSenderFeign
.
sendMessage
(
RabbitConstant
.
INTEGRAL_TOPIC
,
RabbitConstant
.
INTEGRAL_ROUTING_KEY
,
jsonObject
.
toJSONString
());
sendQueue
(
username
,
password
,
headimgurl
,
nickname
,
mobilecode
,
openId
,
unionid
,
type
,
code
,
activityCode
,
userid
,
RegisterQueueDTO
.
SIGN_NEW
);
sendQueue
(
username
,
password
,
headimgurl
,
nickname
,
mobilecode
,
openId
,
unionid
,
type
,
code
,
activityCode
,
userid
,
RegisterQueueDTO
.
SIGN_NEW
);
log
.
info
(
"注册:发消息队列: "
+
userid
+
"---time===="
+
System
.
currentTimeMillis
()/
1000L
);
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
}
else
{
}
else
{
return
JsonResultUtil
.
createDefaultFail
();
return
JsonResultUtil
.
createDefaultFail
();
...
@@ -535,7 +545,7 @@ public class AppPermissionService {
...
@@ -535,7 +545,7 @@ public class AppPermissionService {
userDetail
.
setUpdatetime
(
now
);
userDetail
.
setUpdatetime
(
now
);
userDetail
.
setIsdel
(
0
);
userDetail
.
setIsdel
(
0
);
userDetail
.
setCrtHost
(
getIp
());
userDetail
.
setCrtHost
(
getIp
());
setCreateIPInfo
(
userDetail
);
//
setCreateIPInfo(userDetail);
appUserDetailBiz
.
insertSelective
(
userDetail
);
appUserDetailBiz
.
insertSelective
(
userDetail
);
}
/*else {
}
/*else {
...
@@ -949,7 +959,7 @@ public class AppPermissionService {
...
@@ -949,7 +959,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
);
rsUserDetail
.
setState
(
1
);
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
...
@@ -1083,7 +1093,7 @@ public class AppPermissionService {
...
@@ -1083,7 +1093,7 @@ public class AppPermissionService {
public
void
setCreateIPInfo
(
AppUserDetail
appUserDetail
)
{
public
void
setCreateIPInfo
(
AppUserDetail
appUserDetail
)
{
String
crtHost
=
appUserDetail
.
getCrtHost
();
String
crtHost
=
appUserDetail
.
getCrtHost
();
if
(
log
.
isDebugEnabled
())
{
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"解析的地址:【{}】"
,
crtHost
);
log
.
debug
(
"解析的地址:【{}】"
,
crtHost
+
"---time==="
+
System
.
currentTimeMillis
()/
1000L
);
}
}
try
{
try
{
analyticalIPByWebSiteAndIPAddress
(
IPAddress
.
BASE_IP_PARSING_URL2
,
crtHost
,
appUserDetail
);
analyticalIPByWebSiteAndIPAddress
(
IPAddress
.
BASE_IP_PARSING_URL2
,
crtHost
,
appUserDetail
);
...
@@ -1100,13 +1110,15 @@ public class AppPermissionService {
...
@@ -1100,13 +1110,15 @@ public class AppPermissionService {
private
void
analyticalIPByWebSiteAndIPAddress
(
String
url
,
String
crtHost
,
AppUserDetail
appUserDetail
)
{
private
void
analyticalIPByWebSiteAndIPAddress
(
String
url
,
String
crtHost
,
AppUserDetail
appUserDetail
)
{
String
ipAddress
=
restTemplate
.
getForObject
(
String
.
format
(
"%s%s"
,
url
,
crtHost
),
String
.
class
);
String
ipAddress
=
restTemplate
.
getForObject
(
String
.
format
(
"%s%s"
,
url
,
crtHost
),
String
.
class
);
String
data
=
JSONObject
.
parseObject
(
ipAddress
).
getString
(
IPAddress
.
BASE_DATA
);
log
.
debug
(
"解析的调用网站后:【{}】"
,
crtHost
+
"---time==="
+
System
.
currentTimeMillis
()/
1000L
);
JSONObject
ipJsonObject
=
JSONObject
.
parseObject
(
data
);
String
data
=
JSONObject
.
parseObject
(
ipAddress
).
getString
(
IPAddress
.
BASE_DATA
);
String
cityName
=
ipJsonObject
.
getString
(
IPAddress
.
CITY_NAME
);
JSONObject
ipJsonObject
=
JSONObject
.
parseObject
(
data
);
RegionDTO
regionDTO
=
regionFeign
.
getRegionByCityName
(
StringUtils
.
isEmpty
(
cityName
)
?
"东莞"
:
cityName
);
String
cityName
=
ipJsonObject
.
getString
(
IPAddress
.
CITY_NAME
);
if
(
null
!=
regionDTO
)
{
RegionDTO
regionDTO
=
regionFeign
.
getRegionByCityName
(
StringUtils
.
isEmpty
(
cityName
)
?
"东莞"
:
cityName
);
appUserDetail
.
setProvinceCode
(
Integer
.
valueOf
(
String
.
valueOf
(
regionDTO
.
getParentId
())));
log
.
debug
(
"解析的调用服务后:【{}】"
,
crtHost
+
"---time==="
+
System
.
currentTimeMillis
()/
1000L
);
appUserDetail
.
setCityCode
(
Integer
.
valueOf
(
String
.
valueOf
(
regionDTO
.
getId
())));
if
(
null
!=
regionDTO
)
{
appUserDetail
.
setProvinceCode
(
Integer
.
valueOf
(
String
.
valueOf
(
regionDTO
.
getParentId
())));
appUserDetail
.
setCityCode
(
Integer
.
valueOf
(
String
.
valueOf
(
regionDTO
.
getId
())));
}
}
}
}
...
...
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