Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xzxt-app-report
Overview
Overview
Details
Activity
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
Administrator
xzxt-app-report
Commits
d2ed94b6
Commit
d2ed94b6
authored
Jul 13, 2022
by
wang_jiaxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加证件号码的登录
parent
90d2896e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
86 additions
and
5 deletions
+86
-5
src/main/java/org/springblade/modules/auth/controller/AuthController.java
+26
-0
src/main/java/org/springblade/modules/auth/granter/CaptchaTokenGranter.java
+1
-1
src/main/java/org/springblade/modules/auth/granter/PasswordTokenGranter.java
+4
-1
src/main/java/org/springblade/modules/system/mapper/UserMapper.java
+1
-0
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
+46
-0
src/main/java/org/springblade/modules/system/service/IUserService.java
+1
-1
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
+7
-2
No files found.
src/main/java/org/springblade/modules/auth/controller/AuthController.java
View file @
d2ed94b6
...
@@ -155,4 +155,30 @@ public class AuthController {
...
@@ -155,4 +155,30 @@ public class AuthController {
return
R
.
data
(
TokenUtil
.
createAuthInfo
(
userInfo
));
return
R
.
data
(
TokenUtil
.
createAuthInfo
(
userInfo
));
}
}
@PostMapping
(
"login"
)
@ApiOperation
(
value
=
"登录"
)
@LogOper
(
czxxLbdm
=
"05"
,
yymcJyqk
=
"0701"
,
czxxJyqk
=
"登陆"
)
public
R
<
AuthInfo
>
login
(
@ApiParam
(
value
=
"身份证号"
)
@RequestParam
(
required
=
false
)
String
zjhm
)
{
String
userType
=
Func
.
toStr
(
WebUtil
.
getRequest
().
getHeader
(
TokenUtil
.
USER_TYPE_HEADER_KEY
),
TokenUtil
.
DEFAULT_USER_TYPE
);
TokenParameter
tokenParameter
=
new
TokenParameter
();
tokenParameter
.
getArgs
().
set
(
"tenantId"
,
"000000"
)
.
set
(
"zjhm"
,
zjhm
)
.
set
(
"grantType"
,
"password"
)
.
set
(
"userType"
,
userType
);
ITokenGranter
granter
=
TokenGranterBuilder
.
getGranter
(
"password"
);
// UserInfo userInfo = granter.grant(tokenParameter);
UserInfoResult
userInfo
=
granter
.
grant
(
tokenParameter
);
if
(
userInfo
==
null
||
userInfo
.
getUser
()
==
null
)
{
return
R
.
fail
(
TokenUtil
.
USER_NOT_FOUND
);
}
if
(
userInfo
.
getPermissions
()
==
null
||
userInfo
.
getPermissions
().
size
()
==
0
){
return
R
.
fail
(
TokenUtil
.
USER_NOT_PERMISSIONS
);
}
return
R
.
data
(
TokenUtil
.
createAuthInfo
(
userInfo
));
}
}
}
src/main/java/org/springblade/modules/auth/granter/CaptchaTokenGranter.java
View file @
d2ed94b6
...
@@ -61,7 +61,7 @@ public class CaptchaTokenGranter implements ITokenGranter {
...
@@ -61,7 +61,7 @@ public class CaptchaTokenGranter implements ITokenGranter {
// 获取用户类型
// 获取用户类型
String
userType
=
tokenParameter
.
getArgs
().
getStr
(
"userType"
);
String
userType
=
tokenParameter
.
getArgs
().
getStr
(
"userType"
);
// 根据不同用户类型调用对应的接口返回数据,用户可自行拓展
// 根据不同用户类型调用对应的接口返回数据,用户可自行拓展
userInfo
=
userService
.
userInfoR
(
tenantId
,
account
,
DigestUtil
.
encrypt
(
password
));
userInfo
=
userService
.
userInfoR
(
tenantId
,
account
,
DigestUtil
.
encrypt
(
password
)
,
null
);
// if (userType.equals(BladeUserEnum.WEB.getName())) {
// if (userType.equals(BladeUserEnum.WEB.getName())) {
// userInfo = userService.userInfo(tenantId, account, DigestUtil.encrypt(password));
// userInfo = userService.userInfo(tenantId, account, DigestUtil.encrypt(password));
...
...
src/main/java/org/springblade/modules/auth/granter/PasswordTokenGranter.java
View file @
d2ed94b6
...
@@ -41,6 +41,7 @@ public class PasswordTokenGranter implements ITokenGranter {
...
@@ -41,6 +41,7 @@ public class PasswordTokenGranter implements ITokenGranter {
String
tenantId
=
tokenParameter
.
getArgs
().
getStr
(
"tenantId"
);
String
tenantId
=
tokenParameter
.
getArgs
().
getStr
(
"tenantId"
);
String
account
=
tokenParameter
.
getArgs
().
getStr
(
"account"
);
String
account
=
tokenParameter
.
getArgs
().
getStr
(
"account"
);
String
password
=
tokenParameter
.
getArgs
().
getStr
(
"password"
);
String
password
=
tokenParameter
.
getArgs
().
getStr
(
"password"
);
String
zjhm
=
tokenParameter
.
getArgs
().
getStr
(
"zjhm"
);
UserInfoResult
userInfo
=
null
;
UserInfoResult
userInfo
=
null
;
if
(
Func
.
isNoneBlank
(
account
,
password
))
{
if
(
Func
.
isNoneBlank
(
account
,
password
))
{
// 获取用户类型
// 获取用户类型
...
@@ -48,7 +49,7 @@ public class PasswordTokenGranter implements ITokenGranter {
...
@@ -48,7 +49,7 @@ public class PasswordTokenGranter implements ITokenGranter {
// BASE64Encoder encoder = new BASE64Encoder();
// BASE64Encoder encoder = new BASE64Encoder();
// 根据不同用户类型调用对应的接口返回数据,用户可自行拓展
// 根据不同用户类型调用对应的接口返回数据,用户可自行拓展
// userInfo = userService.userInfoR(tenantId, account, encoder.encode(password.getBytes()));
// userInfo = userService.userInfoR(tenantId, account, encoder.encode(password.getBytes()));
userInfo
=
userService
.
userInfoR
(
tenantId
,
account
,
DigestUtil
.
encrypt
(
password
));
userInfo
=
userService
.
userInfoR
(
tenantId
,
account
,
DigestUtil
.
encrypt
(
password
)
,
null
);
// if (userType.equals(BladeUserEnum.WEB.getName())) {
// if (userType.equals(BladeUserEnum.WEB.getName())) {
// userInfo = userService.userInfo(tenantId, account, DigestUtil.encrypt(password));
// userInfo = userService.userInfo(tenantId, account, DigestUtil.encrypt(password));
// } else if (userType.equals(BladeUserEnum.APP.getName())) {
// } else if (userType.equals(BladeUserEnum.APP.getName())) {
...
@@ -56,6 +57,8 @@ public class PasswordTokenGranter implements ITokenGranter {
...
@@ -56,6 +57,8 @@ public class PasswordTokenGranter implements ITokenGranter {
// } else {
// } else {
// userInfo = userService.userInfo(tenantId, account, DigestUtil.encrypt(password));
// userInfo = userService.userInfo(tenantId, account, DigestUtil.encrypt(password));
// }
// }
}
else
if
(
Func
.
isNoneBlank
(
zjhm
))
{
userInfo
=
userService
.
userInfoR
(
tenantId
,
account
,
DigestUtil
.
encrypt
(
password
),
zjhm
);
}
}
return
userInfo
;
return
userInfo
;
}
}
...
...
src/main/java/org/springblade/modules/system/mapper/UserMapper.java
View file @
d2ed94b6
...
@@ -84,4 +84,5 @@ public interface UserMapper extends BaseMapper<User> {
...
@@ -84,4 +84,5 @@ public interface UserMapper extends BaseMapper<User> {
*/
*/
List
<
UserExcel
>
exportUser
(
@Param
(
"ew"
)
Wrapper
<
User
>
queryWrapper
);
List
<
UserExcel
>
exportUser
(
@Param
(
"ew"
)
Wrapper
<
User
>
queryWrapper
);
SysNewUser
getUserNewByZjhm
(
String
zjhm
);
}
}
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
View file @
d2ed94b6
...
@@ -194,5 +194,51 @@
...
@@ -194,5 +194,51 @@
<select
id=
"exportUser"
resultType=
"org.springblade.modules.system.excel.UserExcel"
>
<select
id=
"exportUser"
resultType=
"org.springblade.modules.system.excel.UserExcel"
>
SELECT id, tenant_id, account, name, real_name, email, phone, birthday, role_id, dept_id, post_id FROM blade_user ${ew.customSqlSegment}
SELECT id, tenant_id, account, name, real_name, email, phone, birthday, role_id, dept_id, post_id FROM blade_user ${ew.customSqlSegment}
</select>
</select>
<select
id=
"getUserNewByZjhm"
resultType=
"org.springblade.modules.system.entity.SysNewUser"
>
SELECT
id as id,
unitcode as unitcode,
username as username,
password as password,
true_name as trueName,
open_flag as openFlag,
default_model as defaultModel,
remark as remark,
lrr as lrr,
lrsj as lrsj,
gxr as gxr,
gxsj as gxsj,
lrdwdm as lrdwdm,
lrdwmc as lrdwmc,
identitycard as identitycard,
sex as sex,
birthday as birthday,
telephone as telephone,
unitname as unitname,
scbz as scbz,
ip as ip,
grade as grade,
policemanid as policemanid,
default_desktop as defaultDesktop,
theme as theme,
lastlogintime as lastlogintime,
lastchecktime as lastchecktime,
xxzyurl as xxzyurl,
gzzm_zhy as gzzmZhy,
gzzm_ypy as gzzmYpy,
gzzm_zcy as gzzmZcy,
gzzm_play as gzzmPlay,
glybz as glybz,
tqyhbz as tqyhbz,
jgz_photo_zm as jgzPhotoZm,
jgz_photo_fm as jgzPhotoFm,
zbzx_dwdm as zbzxDwdm,
grdf as grdf
FROM sys_user
where open_flag='1' and scbz='0'
and identitycard = #{zjhm}
order by lrsj desc
limit 1
</select>
</mapper>
</mapper>
src/main/java/org/springblade/modules/system/service/IUserService.java
View file @
d2ed94b6
...
@@ -68,7 +68,7 @@ public interface IUserService extends BaseService<User> {
...
@@ -68,7 +68,7 @@ public interface IUserService extends BaseService<User> {
* @return
* @return
*/
*/
UserInfo
userInfo
(
String
tenantId
,
String
account
,
String
password
);
UserInfo
userInfo
(
String
tenantId
,
String
account
,
String
password
);
UserInfoResult
userInfoR
(
String
tenantId
,
String
account
,
String
password
);
UserInfoResult
userInfoR
(
String
tenantId
,
String
account
,
String
password
,
String
zjhm
);
/**
/**
* 给用户设置角色
* 给用户设置角色
*
*
...
...
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
View file @
d2ed94b6
...
@@ -157,9 +157,14 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
...
@@ -157,9 +157,14 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
}
}
@Override
@Override
public
UserInfoResult
userInfoR
(
String
tenantId
,
String
account
,
String
password
)
{
public
UserInfoResult
userInfoR
(
String
tenantId
,
String
account
,
String
password
,
String
zjhm
)
{
UserInfoResult
userInfo
=
new
UserInfoResult
();
UserInfoResult
userInfo
=
new
UserInfoResult
();
SysNewUser
userNew
=
baseMapper
.
getUserNew
(
account
,
password
);
SysNewUser
userNew
;
if
(
Func
.
isNoneBlank
(
zjhm
))
{
userNew
=
baseMapper
.
getUserNewByZjhm
(
zjhm
);
}
else
{
userNew
=
baseMapper
.
getUserNew
(
account
,
password
);
}
// 查询对应的角色
// 查询对应的角色
...
...
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