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 c27678f6
authored
May 11, 2021
by
zhoujinghao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
登陆接口两种方式提交
1 parent
869f2152
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
1 deletions
nafmii-app/src/main/java/org/nafmii/app/user/service/impl/UserServiceImpl.java
nafmii-app/src/main/java/org/nafmii/app/user/vo/UserVO.java
nafmii-common/src/main/java/org/nafmii/common/constant/MessageEnum.java
nafmii-common/src/main/java/org/nafmii/common/constant/UserEnum.java
nafmii-app/src/main/java/org/nafmii/app/user/service/impl/UserServiceImpl.java
View file @
c27678f
...
...
@@ -149,6 +149,10 @@ public class UserServiceImpl implements UserService {
if
(
loginDto
.
getType
().
equals
(
UserEnum
.
LOGINPWD
.
getCode
())){
//密码登陆
userVo
=
appUserMapper
.
selectByPassword
(
loginDto
);
if
(
null
==
userVo
){
return
new
ApiResponse
(
ApiResponse
.
FAIL
,
MessageEnum
.
FAIR_PASSWORD
.
getRemarks
());
}
userVo
.
setLoginType
(
UserEnum
.
NOTFIRSTLOGIN
.
getCode
());
}
else
{
//验证码登陆
String
code
=
stringRedisTemplate
.
opsForValue
().
get
(
USER_CODE_KEY
+
loginDto
.
getPhone
());
...
...
@@ -157,6 +161,8 @@ public class UserServiceImpl implements UserService {
return
new
ApiResponse
(
ApiResponse
.
FAIL
,
MessageEnum
.
CODE_ERROR
.
getRemarks
());
}
userVo
=
appUserMapper
.
selectByPhone
(
loginDto
.
getPhone
());
log
.
info
(
"验证码登录返回用户实体=======》{}"
,
userVo
);
userVo
.
setLoginType
(
userVo
!=
null
?
UserEnum
.
NOTFIRSTLOGIN
.
getCode
()
:
UserEnum
.
FIRSTLOGIN
.
getCode
());
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
HttpClientHeaderEnum
.
USER_HEADER_USER_ID
.
getCode
(),
userVo
.
getId
());
...
...
nafmii-app/src/main/java/org/nafmii/app/user/vo/UserVO.java
View file @
c27678f
...
...
@@ -64,6 +64,10 @@ public class UserVO {
@ApiModelProperty
(
value
=
"是否有效标识 0 有效用户 1无效用户"
)
private
String
isEnable
;
@ApiModelProperty
(
value
=
"token"
)
private
String
authorization
;
@ApiModelProperty
(
value
=
"验证码登陆判断是否第一次登陆 0是 1否"
)
private
String
loginType
;
}
nafmii-common/src/main/java/org/nafmii/common/constant/MessageEnum.java
View file @
c27678f
...
...
@@ -22,6 +22,7 @@ public enum MessageEnum {
FILE_PICTURE
(-
113L
,
"图片格式非法!"
),
CODE_ERROR
(-
114L
,
"验证码错误或失效!"
),
EXCEL_ERROR
(-
115L
,
"导入模板列数不匹配!"
),
FAIR_PASSWORD
(-
116L
,
"密码有误!"
),
;
private
Long
code
;
...
...
nafmii-common/src/main/java/org/nafmii/common/constant/UserEnum.java
View file @
c27678f
...
...
@@ -25,9 +25,16 @@ public enum UserEnum{
*/
ENABLE
(
"0"
,
"有效用户"
),
NOTENABLE
(
"1"
,
"无效用户"
),
/**
* 登陆方式
*/
LOGINPHONE
(
"1"
,
"验证码"
),
LOGINPWD
(
"0"
,
"密码"
),
/**
*用户是否第一次登陆
*/
FIRSTLOGIN
(
"0"
,
"是第一次登陆"
),
NOTFIRSTLOGIN
(
"1"
,
"不是第一次登陆"
),
;
...
...
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