Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
polysoft-nafmii
/
polysoft-parent
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3e471276
authored
Apr 29, 2021
by
zhoujinghao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
返回请求修改
1 parent
c7cae427
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
nafmii-app/src/main/java/org/nafmii/app/user/service/impl/UserServiceImpl.java
nafmii-app/src/main/java/org/nafmii/app/user/service/impl/UserServiceImpl.java
View file @
3e47127
...
@@ -100,7 +100,7 @@ public class UserServiceImpl implements UserService {
...
@@ -100,7 +100,7 @@ public class UserServiceImpl implements UserService {
//查询用户信息通过手机号
//查询用户信息通过手机号
UserVO
userVO
=
appUserMapper
.
selectByPhone
(
registerDto
.
getPhone
());
UserVO
userVO
=
appUserMapper
.
selectByPhone
(
registerDto
.
getPhone
());
if
(
null
!=
userVO
){
if
(
null
!=
userVO
){
throw
new
BusinessException
(
"该用户已注册"
);
return
new
ApiResponse
(
ApiResponse
.
FAIL
,
"该用户已注册"
);
}
}
//用户实体类
//用户实体类
AppUserPO
appUser
=
new
AppUserPO
();
AppUserPO
appUser
=
new
AppUserPO
();
...
@@ -112,7 +112,7 @@ public class UserServiceImpl implements UserService {
...
@@ -112,7 +112,7 @@ public class UserServiceImpl implements UserService {
appUser
.
setPhone
(
registerDto
.
getPhone
());
appUser
.
setPhone
(
registerDto
.
getPhone
());
//判断注册密码和再次输入密码
//判断注册密码和再次输入密码
if
(!
registerDto
.
getLoginPwd
().
equals
(
registerDto
.
getConfirmPwd
())){
if
(!
registerDto
.
getLoginPwd
().
equals
(
registerDto
.
getConfirmPwd
())){
throw
new
BusinessException
(
"两次密码输入不相同,请再次输入"
);
return
new
ApiResponse
(
ApiResponse
.
FAIL
,
"两次密码输入不相同,请再次输入"
);
}
}
appUser
.
setLoginPwd
(
registerDto
.
getLoginPwd
());
appUser
.
setLoginPwd
(
registerDto
.
getLoginPwd
());
appUser
.
setCreateTime
(
LocalDateTime
.
now
());
appUser
.
setCreateTime
(
LocalDateTime
.
now
());
...
@@ -125,16 +125,16 @@ public class UserServiceImpl implements UserService {
...
@@ -125,16 +125,16 @@ public class UserServiceImpl implements UserService {
String
code
=
stringRedisTemplate
.
opsForValue
().
get
(
USER_CODE_KEY
+
registerDto
.
getPhone
());
String
code
=
stringRedisTemplate
.
opsForValue
().
get
(
USER_CODE_KEY
+
registerDto
.
getPhone
());
log
.
info
(
"冲缓存中获取的验证码===============》{}"
,
code
);
log
.
info
(
"冲缓存中获取的验证码===============》{}"
,
code
);
if
(
null
==
code
){
if
(
null
==
code
){
throw
new
BusinessException
(
"验证码已过期"
);
return
new
ApiResponse
(
ApiResponse
.
FAIL
,
"验证码已过期"
);
}
}
if
(!
code
.
equals
(
registerDto
.
getCode
())){
if
(!
code
.
equals
(
registerDto
.
getCode
())){
throw
new
BusinessException
(
"验证码错误请重新输入"
);
return
new
ApiResponse
(
ApiResponse
.
FAIL
,
"验证码错误请重新输入"
);
}
}
int
i
=
appUserMapper
.
insert
(
appUser
);
int
i
=
appUserMapper
.
insert
(
appUser
);
if
(
i
<
0
){
if
(
i
<
0
){
return
new
ApiResponse
(
).
fail
(
"新增失败"
);
return
new
ApiResponse
(
ApiResponse
.
FAIL
,
"新增失败"
);
}
}
return
new
ApiResponse
();
return
new
ApiResponse
(
ApiResponse
.
SUCCESS
,
"新增成功"
);
}
}
/**
/**
...
@@ -152,21 +152,21 @@ public class UserServiceImpl implements UserService {
...
@@ -152,21 +152,21 @@ public class UserServiceImpl implements UserService {
//密码登陆
//密码登陆
userVo
=
appUserMapper
.
selectByPassword
(
loginDto
);
userVo
=
appUserMapper
.
selectByPassword
(
loginDto
);
if
(
null
==
userVo
){
if
(
null
==
userVo
){
throw
new
BusinessException
(
"请先注册"
);
return
new
ApiResponse
(
ApiResponse
.
FAIL
,
"请先注册"
);
}
}
}
else
{
}
else
{
//验证码登陆
//验证码登陆
String
code
=
stringRedisTemplate
.
opsForValue
().
get
(
USER_CODE_KEY
+
loginDto
.
getPhone
());
String
code
=
stringRedisTemplate
.
opsForValue
().
get
(
USER_CODE_KEY
+
loginDto
.
getPhone
());
log
.
info
(
"冲redis中获取的验证码===============》{}"
,
code
);
log
.
info
(
"冲redis中获取的验证码===============》{}"
,
code
);
if
(
null
==
code
){
if
(
null
==
code
){
throw
new
BusinessException
(
"验证码已过期"
);
return
new
ApiResponse
(
ApiResponse
.
FAIL
,
"验证码已过期"
);
}
}
if
(!
code
.
equals
(
loginDto
.
getCode
())){
if
(!
code
.
equals
(
loginDto
.
getCode
())){
throw
new
BusinessException
(
"验证码错误请重新输入"
);
return
new
ApiResponse
(
ApiResponse
.
FAIL
,
"验证码错误请重新输入"
);
}
}
userVo
=
appUserMapper
.
selectByPhone
(
loginDto
.
getPhone
());
userVo
=
appUserMapper
.
selectByPhone
(
loginDto
.
getPhone
());
if
(
null
!=
userVo
){
if
(
null
!=
userVo
){
throw
new
BusinessException
(
"请先注册"
);
return
new
ApiResponse
(
ApiResponse
.
FAIL
,
"请先注册"
);
}
}
}
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment