Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
f1294daa
Commit
f1294daa
authored
May 18, 2017
by
Java-刘 彧阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据用户手机号查用户id接口增加
parent
ecaabda9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
4 deletions
+43
-4
UserController.java
...ntgroup/xyqb/controller/internal/user/UserController.java
+6
-4
IUserService.java
...in/java/cn/quantgroup/xyqb/service/user/IUserService.java
+1
-0
UserServiceImpl.java
...cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
+36
-0
No files found.
src/main/java/cn/quantgroup/xyqb/controller/internal/user/UserController.java
View file @
f1294daa
...
@@ -171,7 +171,8 @@ public class UserController implements IBaseController {
...
@@ -171,7 +171,8 @@ public class UserController implements IBaseController {
*/
*/
@RequestMapping
(
"/register/fast"
)
@RequestMapping
(
"/register/fast"
)
public
JsonResult
registerFast
(
@RequestParam
String
phoneNo
,
@RequestParam
String
verificationCode
,
@RequestParam
(
required
=
false
)
Long
channelId
,
public
JsonResult
registerFast
(
@RequestParam
String
phoneNo
,
@RequestParam
String
verificationCode
,
@RequestParam
(
required
=
false
)
Long
channelId
,
@RequestParam
(
required
=
false
)
Long
registerFrom
,
@RequestParam
(
required
=
false
,
defaultValue
=
""
)
String
appChannel
)
{
@RequestParam
(
required
=
false
)
Long
registerFrom
,
@RequestParam
(
required
=
false
,
defaultValue
=
""
)
String
appChannel
,
@RequestParam
(
required
=
false
)
Long
btRegisterChannelId
)
{
String
password
=
genRandomPwd
();
String
password
=
genRandomPwd
();
LOGGER
.
info
(
"用户快速注册, phoneNo:{}, verificationCode:{}, channelId:{}, registerFrom:{},appChannel:{}"
,
phoneNo
,
verificationCode
,
channelId
,
registerFrom
,
appChannel
);
LOGGER
.
info
(
"用户快速注册, phoneNo:{}, verificationCode:{}, channelId:{}, registerFrom:{},appChannel:{}"
,
phoneNo
,
verificationCode
,
channelId
,
registerFrom
,
appChannel
);
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
...
@@ -197,7 +198,7 @@ public class UserController implements IBaseController {
...
@@ -197,7 +198,7 @@ public class UserController implements IBaseController {
LOGGER
.
info
(
"用户快速注册失败,短信验证码错误, registerFrom:{}, phoneNo:{}, verificationCode:{}"
,
registerFrom
,
phoneNo
,
verificationCode
);
LOGGER
.
info
(
"用户快速注册失败,短信验证码错误, registerFrom:{}, phoneNo:{}, verificationCode:{}"
,
registerFrom
,
phoneNo
,
verificationCode
);
return
JsonResult
.
buildErrorStateResult
(
"短信验证码错误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"短信验证码错误"
,
null
);
}
}
if
(!
userService
.
register
(
phoneNo
,
password
,
registerFrom
,
getIp
(),
channelId
))
{
if
(!
userService
.
register
(
phoneNo
,
password
,
registerFrom
,
getIp
(),
channelId
,
btRegisterChannelId
))
{
LOGGER
.
info
(
"用户快速注册失败,请稍后重试, registerFrom:{}, phoneNo:{}"
,
registerFrom
,
phoneNo
);
LOGGER
.
info
(
"用户快速注册失败,请稍后重试, registerFrom:{}, phoneNo:{}"
,
registerFrom
,
phoneNo
);
return
JsonResult
.
buildErrorStateResult
(
"注册失败,请稍后重试"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"注册失败,请稍后重试"
,
null
);
}
}
...
@@ -220,7 +221,8 @@ public class UserController implements IBaseController {
...
@@ -220,7 +221,8 @@ public class UserController implements IBaseController {
@RequestMapping
(
"/register"
)
@RequestMapping
(
"/register"
)
public
JsonResult
register
(
@RequestParam
String
phoneNo
,
@RequestParam
String
password
,
public
JsonResult
register
(
@RequestParam
String
phoneNo
,
@RequestParam
String
password
,
@RequestParam
String
verificationCode
,
@RequestParam
(
required
=
false
)
Long
channelId
,
@RequestParam
String
verificationCode
,
@RequestParam
(
required
=
false
)
Long
channelId
,
@RequestParam
(
required
=
false
)
Long
registerFrom
)
{
@RequestParam
(
required
=
false
)
Long
registerFrom
,
@RequestParam
(
required
=
false
)
Long
btRegisterChannelId
)
{
LOGGER
.
info
(
"用户注册, phoneNo:{}, verificationCode:{}, channelId:{}, registerFrom:{}"
,
phoneNo
,
verificationCode
,
channelId
,
registerFrom
);
LOGGER
.
info
(
"用户注册, phoneNo:{}, verificationCode:{}, channelId:{}, registerFrom:{}"
,
phoneNo
,
verificationCode
,
channelId
,
registerFrom
);
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
LOGGER
.
info
(
"用户注册失败,手机号错误, registerFrom:{}, phoneNo:{}"
,
registerFrom
,
phoneNo
);
LOGGER
.
info
(
"用户注册失败,手机号错误, registerFrom:{}, phoneNo:{}"
,
registerFrom
,
phoneNo
);
...
@@ -245,7 +247,7 @@ public class UserController implements IBaseController {
...
@@ -245,7 +247,7 @@ public class UserController implements IBaseController {
LOGGER
.
info
(
"用户注册失败,短信验证码错误, registerFrom:{}, phoneNo:{}, verificationCode:{}"
,
registerFrom
,
phoneNo
,
verificationCode
);
LOGGER
.
info
(
"用户注册失败,短信验证码错误, registerFrom:{}, phoneNo:{}, verificationCode:{}"
,
registerFrom
,
phoneNo
,
verificationCode
);
return
JsonResult
.
buildErrorStateResult
(
"短信验证码错误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"短信验证码错误"
,
null
);
}
}
if
(!
userService
.
register
(
phoneNo
,
password
,
registerFrom
,
getIp
(),
channelId
))
{
if
(!
userService
.
register
(
phoneNo
,
password
,
registerFrom
,
getIp
(),
channelId
,
btRegisterChannelId
))
{
LOGGER
.
info
(
"用户快速注册失败,请稍后重试, registerFrom:{}, phoneNo:{}"
,
registerFrom
,
phoneNo
);
LOGGER
.
info
(
"用户快速注册失败,请稍后重试, registerFrom:{}, phoneNo:{}"
,
registerFrom
,
phoneNo
);
return
JsonResult
.
buildErrorStateResult
(
"注册失败,请稍后重试"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"注册失败,请稍后重试"
,
null
);
}
}
...
...
src/main/java/cn/quantgroup/xyqb/service/user/IUserService.java
View file @
f1294daa
...
@@ -32,4 +32,5 @@ public interface IUserService {
...
@@ -32,4 +32,5 @@ public interface IUserService {
User
findById
(
Long
userId
);
User
findById
(
Long
userId
);
boolean
register
(
String
phoneNo
,
String
password
,
Long
registerFrom
,
String
ip
,
Long
channelId
,
Long
btRegisterChannelId
);
}
}
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
View file @
f1294daa
...
@@ -2,9 +2,11 @@ package cn.quantgroup.xyqb.service.user.impl;
...
@@ -2,9 +2,11 @@ package cn.quantgroup.xyqb.service.user.impl;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserBtRegister
;
import
cn.quantgroup.xyqb.repository.IUserRepository
;
import
cn.quantgroup.xyqb.repository.IUserRepository
;
import
cn.quantgroup.xyqb.service.sms.ISmsService
;
import
cn.quantgroup.xyqb.service.sms.ISmsService
;
import
cn.quantgroup.xyqb.service.user.ILkbUserService
;
import
cn.quantgroup.xyqb.service.user.ILkbUserService
;
import
cn.quantgroup.xyqb.service.user.IUserBtRegisterService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.util.PasswordUtil
;
import
cn.quantgroup.xyqb.util.PasswordUtil
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
...
@@ -42,6 +44,9 @@ public class UserServiceImpl implements IUserService {
...
@@ -42,6 +44,9 @@ public class UserServiceImpl implements IUserService {
@Autowired
@Autowired
private
ISmsService
smsService
;
private
ISmsService
smsService
;
@Autowired
private
IUserBtRegisterService
userBtRegisterService
;
@Override
@Override
public
User
findByPhoneInDb
(
String
phone
)
{
public
User
findByPhoneInDb
(
String
phone
)
{
return
userRepository
.
findByPhoneNo
(
phone
);
return
userRepository
.
findByPhoneNo
(
phone
);
...
@@ -88,6 +93,37 @@ public class UserServiceImpl implements IUserService {
...
@@ -88,6 +93,37 @@ public class UserServiceImpl implements IUserService {
return
userRepository
.
findById
(
userId
);
return
userRepository
.
findById
(
userId
);
}
}
@Override
public
boolean
register
(
String
phoneNo
,
String
password
,
Long
registerFrom
,
String
ip
,
Long
channelId
,
Long
btRegisterChannelId
)
{
String
uuid
=
lkbUserService
.
registerApp
(
phoneNo
,
password
);
Timestamp
currentTime
=
new
Timestamp
(
System
.
currentTimeMillis
());
User
user
=
new
User
();
user
.
setEnable
(
true
);
user
.
setPhoneNo
(
phoneNo
);
user
.
setUpdatedAt
(
currentTime
);
user
.
setCreatedAt
(
currentTime
);
user
.
setUuid
(
uuid
);
user
.
setPassword
(
PasswordUtil
.
MD5
(
password
.
toLowerCase
()
+
Constants
.
PASSWORD_SALT
));
//解决线上白条registerFrom为1的问题
if
(
channelId
==
222L
)
{
user
.
setRegisteredFrom
(
channelId
);
}
else
{
user
.
setRegisteredFrom
(
registerFrom
);
}
//user.setRegisteredFrom(registerFrom);
user
=
userRepository
.
save
(
user
);
if
(
null
!=
user
){
UserBtRegister
userBtRegister
=
new
UserBtRegister
();
userBtRegister
.
setUserId
(
user
.
getId
());
userBtRegister
.
setRegisterBtMerchantId
(
btRegisterChannelId
);
userBtRegisterService
.
save
(
userBtRegister
);
}
smsService
.
sendAfterRegister
(
phoneNo
);
return
user
!=
null
;
}
@Override
@Override
public
User
registerAndReturn
(
String
phoneNo
,
String
password
,
Long
registerFrom
)
{
public
User
registerAndReturn
(
String
phoneNo
,
String
password
,
Long
registerFrom
)
{
...
...
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