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 6291581a
authored
Apr 27, 2021
by
zhoujinghao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
app用户注册登陆接口提交
1 parent
a72d87a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
nafmii-app/src/main/java/org/nafmii/app/user/dao/AppUserMapper.java
nafmii-app/src/main/java/org/nafmii/app/user/service/impl/UserServiceImpl.java
nafmii-app/src/main/java/org/nafmii/app/user/dao/AppUserMapper.java
View file @
6291581
...
@@ -20,7 +20,7 @@ import java.util.List;
...
@@ -20,7 +20,7 @@ import java.util.List;
@Mapper
@Mapper
public
interface
AppUserMapper
extends
BaseMapper
<
AppUserPO
>
{
public
interface
AppUserMapper
extends
BaseMapper
<
AppUserPO
>
{
List
<
UserVO
>
selectByPassword
(
LoginDto
loginDto
);
UserVO
selectByPassword
(
LoginDto
loginDto
);
List
<
UserVO
>
selectByPhone
(
@Param
(
"phone"
)
String
phone
);
UserVO
selectByPhone
(
@Param
(
"phone"
)
String
phone
);
}
}
nafmii-app/src/main/java/org/nafmii/app/user/service/impl/UserServiceImpl.java
View file @
6291581
...
@@ -77,6 +77,11 @@ public class UserServiceImpl implements UserService {
...
@@ -77,6 +77,11 @@ public class UserServiceImpl implements UserService {
*/
*/
@Override
@Override
public
ApiResponse
register
(
RegisterDto
registerDto
)
{
public
ApiResponse
register
(
RegisterDto
registerDto
)
{
//查询用户信息通过手机号
UserVO
userVO
=
appUserMapper
.
selectByPhone
(
registerDto
.
getPhone
());
if
(
null
!=
userVO
){
throw
new
BusinessException
(
"该用户已注册"
);
}
//用户实体类
//用户实体类
AppUserPO
appUser
=
new
AppUserPO
();
AppUserPO
appUser
=
new
AppUserPO
();
appUser
.
setId
(
SnowFlakeUtil
.
nextId
());
appUser
.
setId
(
SnowFlakeUtil
.
nextId
());
...
@@ -90,12 +95,8 @@ public class UserServiceImpl implements UserService {
...
@@ -90,12 +95,8 @@ public class UserServiceImpl implements UserService {
throw
new
BusinessException
(
"两次密码输入不相同,请再次输入"
);
throw
new
BusinessException
(
"两次密码输入不相同,请再次输入"
);
}
}
appUser
.
setLoginPwd
(
registerDto
.
getLoginPwd
());
appUser
.
setLoginPwd
(
registerDto
.
getLoginPwd
());
//格式化格式
appUser
.
setCreateTime
(
LocalDateTime
.
now
());
String
format
=
"YYYY-MM-dd hh:mm:ss"
;
appUser
.
setUpdateTime
(
LocalDateTime
.
now
());
// DateTimeFormatter.ofPattern方法根据指定的格式输出时间
String
formatDateTime
=
LocalDateTime
.
now
().
format
(
DateTimeFormatter
.
ofPattern
(
format
));
// appUser.setCreateTime(formatDateTime);
// appUser.setUpdateTime(new Date());
log
.
info
(
"用户注册参数==============>"
+
registerDto
);
log
.
info
(
"用户注册参数==============>"
+
registerDto
);
//将验证码放入到缓存当中(过期时间60s)test
//将验证码放入到缓存当中(过期时间60s)test
// GuavaUtil.putTrackGuava(registerDto.getPhone(),registerDto.getCode());
// GuavaUtil.putTrackGuava(registerDto.getPhone(),registerDto.getCode());
...
@@ -123,12 +124,12 @@ public class UserServiceImpl implements UserService {
...
@@ -123,12 +124,12 @@ public class UserServiceImpl implements UserService {
*/
*/
@Override
@Override
public
ApiResponse
<
UserVO
>
userLogin
(
LoginDto
loginDto
)
{
public
ApiResponse
<
UserVO
>
userLogin
(
LoginDto
loginDto
)
{
List
<
UserVO
>
userVo
=
new
ArrayList
<>
();
UserVO
userVo
=
new
UserVO
();
//首先判断登陆方式
//首先判断登陆方式
if
(
loginDto
.
getType
().
equals
(
"0"
)){
if
(
loginDto
.
getType
().
equals
(
"0"
)){
//密码登陆
//密码登陆
userVo
=
appUserMapper
.
selectByPassword
(
loginDto
);
userVo
=
appUserMapper
.
selectByPassword
(
loginDto
);
if
(
userVo
.
isEmpty
()
){
if
(
null
!=
userVo
){
throw
new
BusinessException
(
"请先注册"
);
throw
new
BusinessException
(
"请先注册"
);
}
}
}
else
{
}
else
{
...
@@ -142,7 +143,7 @@ public class UserServiceImpl implements UserService {
...
@@ -142,7 +143,7 @@ public class UserServiceImpl implements UserService {
throw
new
BusinessException
(
"验证码错误请重新输入"
);
throw
new
BusinessException
(
"验证码错误请重新输入"
);
}
}
userVo
=
appUserMapper
.
selectByPhone
(
loginDto
.
getPhone
());
userVo
=
appUserMapper
.
selectByPhone
(
loginDto
.
getPhone
());
if
(
userVo
.
isEmpty
()
){
if
(
null
!=
userVo
){
throw
new
BusinessException
(
"请先注册"
);
throw
new
BusinessException
(
"请先注册"
);
}
}
}
}
...
...
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