Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Q
queueForTicket_bl
Project
Project
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
mengmeng
queueForTicket_bl
Commits
2d661e00
Commit
2d661e00
authored
Apr 18, 2024
by
Shen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. tb_user 内容加密
2. 用户发起预约返回个人信息接口对数据解密 3. 新增数据库修改信息
parent
75556489
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
58 additions
and
18 deletions
+58
-18
update_20240418.sql
db/update_20240418.sql
+1
-0
ShiroConfig.java
...ain/java/io/hmit/modules/security/config/ShiroConfig.java
+6
-9
application-dev.yml
hmit-admin/src/main/resources/application-dev.yml
+1
-1
application-prod.yml
hmit-admin/src/main/resources/application-prod.yml
+1
-1
ApiLoginController.java
.../src/main/java/io/hmit/controller/ApiLoginController.java
+10
-4
UserService.java
hmit-api/src/main/java/io/hmit/service/UserService.java
+9
-0
UserServiceImpl.java
...i/src/main/java/io/hmit/service/impl/UserServiceImpl.java
+27
-0
application-dev.yml
hmit-api/src/main/resources/application-dev.yml
+1
-1
application-prod.yml
hmit-api/src/main/resources/application-prod.yml
+1
-1
application-test.yml
hmit-api/src/main/resources/application-test.yml
+1
-1
No files found.
db/update_20240418.sql
0 → 100644
View file @
2d661e00
ALTER
TABLE
`tb_user`
MODIFY
COLUMN
`mobile`
varchar
(
100
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NOT
NULL
COMMENT
'手机号'
AFTER
`head_url`
;
\ No newline at end of file
hmit-admin/src/main/java/io/hmit/modules/security/config/ShiroConfig.java
View file @
2d661e00
...
@@ -58,17 +58,14 @@ public class ShiroConfig {
...
@@ -58,17 +58,14 @@ public class ShiroConfig {
Map
<
String
,
String
>
filterMap
=
new
LinkedHashMap
<>();
Map
<
String
,
String
>
filterMap
=
new
LinkedHashMap
<>();
filterMap
.
put
(
"/webjars/**"
,
"anon"
);
filterMap
.
put
(
"/webjars/**"
,
"anon"
);
filterMap
.
put
(
"/druid/**"
,
"anon"
);
//
filterMap.put("/druid/**", "anon");
filterMap
.
put
(
"/login"
,
"anon"
);
filterMap
.
put
(
"/login"
,
"anon"
);
filterMap
.
put
(
"/swagger/**"
,
"anon"
);
//
filterMap.put("/swagger/**", "anon");
filterMap
.
put
(
"/v2/api-docs"
,
"anon"
);
//
filterMap.put("/v2/api-docs", "anon");
filterMap
.
put
(
"/swagger-ui.html"
,
"anon"
);
//
filterMap.put("/swagger-ui.html", "anon");
filterMap
.
put
(
"/doc.html"
,
"anon"
);
//
filterMap.put("/doc.html", "anon");
filterMap
.
put
(
"/swagger-resources/**"
,
"anon"
);
//
filterMap.put("/swagger-resources/**", "anon");
filterMap
.
put
(
"/service/**"
,
"anon"
);
filterMap
.
put
(
"/service/**"
,
"anon"
);
filterMap
.
put
(
"/editor-app/**"
,
"anon"
);
filterMap
.
put
(
"/diagram-viewer/**"
,
"anon"
);
filterMap
.
put
(
"/modeler.html"
,
"anon"
);
filterMap
.
put
(
"/captcha"
,
"anon"
);
filterMap
.
put
(
"/captcha"
,
"anon"
);
filterMap
.
put
(
"/favicon.ico"
,
"anon"
);
filterMap
.
put
(
"/favicon.ico"
,
"anon"
);
filterMap
.
put
(
"/**"
,
"oauth2"
);
filterMap
.
put
(
"/**"
,
"oauth2"
);
...
...
hmit-admin/src/main/resources/application-dev.yml
View file @
2d661e00
...
@@ -37,7 +37,7 @@ spring:
...
@@ -37,7 +37,7 @@ spring:
test-on-borrow
:
false
test-on-borrow
:
false
test-on-return
:
false
test-on-return
:
false
stat-view-servlet
:
stat-view-servlet
:
enabled
:
tru
e
enabled
:
fals
e
url-pattern
:
/druid/*
url-pattern
:
/druid/*
#login-username: admin
#login-username: admin
#login-password: admin
#login-password: admin
...
...
hmit-admin/src/main/resources/application-prod.yml
View file @
2d661e00
...
@@ -22,7 +22,7 @@ spring:
...
@@ -22,7 +22,7 @@ spring:
test-on-borrow
:
false
test-on-borrow
:
false
test-on-return
:
false
test-on-return
:
false
stat-view-servlet
:
stat-view-servlet
:
enabled
:
tru
e
enabled
:
fals
e
url-pattern
:
/druid/*
url-pattern
:
/druid/*
#login-username: admin
#login-username: admin
#login-password: admin
#login-password: admin
...
...
hmit-api/src/main/java/io/hmit/controller/ApiLoginController.java
View file @
2d661e00
...
@@ -9,6 +9,7 @@ import com.google.gson.reflect.TypeToken;
...
@@ -9,6 +9,7 @@ import com.google.gson.reflect.TypeToken;
import
io.hmit.annotation.Login
;
import
io.hmit.annotation.Login
;
import
io.hmit.common.constant.Constant
;
import
io.hmit.common.constant.Constant
;
import
io.hmit.common.utils.Result
;
import
io.hmit.common.utils.Result
;
import
io.hmit.common.utils.sm.SMUtil
;
import
io.hmit.common.validator.ValidatorUtils
;
import
io.hmit.common.validator.ValidatorUtils
;
import
io.hmit.config.ZhelibanUtils
;
import
io.hmit.config.ZhelibanUtils
;
import
io.hmit.dto.LoginDTO
;
import
io.hmit.dto.LoginDTO
;
...
@@ -175,13 +176,13 @@ public class ApiLoginController {
...
@@ -175,13 +176,13 @@ public class ApiLoginController {
userId
=
user
.
getId
();
userId
=
user
.
getId
();
userMap
.
put
(
"username"
,
user
.
getUsername
());
userMap
.
put
(
"username"
,
user
.
getUsername
());
userMap
.
put
(
"mobile"
,
user
.
getMobile
(
));
userMap
.
put
(
"mobile"
,
SMUtil
.
SM4Decrypt
(
user
.
getMobile
()
));
userMap
.
put
(
"idnum"
,
user
.
getIdCardNo
(
));
userMap
.
put
(
"idnum"
,
SMUtil
.
SM4Decrypt
(
user
.
getIdCardNo
()
));
}
else
{
}
else
{
userId
=
oldUser
.
getId
();
userId
=
oldUser
.
getId
();
userMap
.
put
(
"username"
,
oldUser
.
getUsername
());
userMap
.
put
(
"username"
,
oldUser
.
getUsername
());
userMap
.
put
(
"mobile"
,
oldUser
.
getMobile
(
));
userMap
.
put
(
"mobile"
,
SMUtil
.
SM4Decrypt
(
oldUser
.
getMobile
()
));
userMap
.
put
(
"idnum"
,
oldUser
.
getIdCardNo
(
));
userMap
.
put
(
"idnum"
,
SMUtil
.
SM4Decrypt
(
oldUser
.
getIdCardNo
()
));
}
}
TokenEntity
tokenEntity
=
tokenService
.
createToken
(
userId
);
TokenEntity
tokenEntity
=
tokenService
.
createToken
(
userId
);
...
@@ -194,4 +195,9 @@ public class ApiLoginController {
...
@@ -194,4 +195,9 @@ public class ApiLoginController {
}
}
}
}
@GetMapping
(
"encryptOneTime"
)
public
Result
<
Object
>
encryptOneTime
()
{
return
userService
.
encryptOneTime
();
}
}
}
hmit-api/src/main/java/io/hmit/service/UserService.java
View file @
2d661e00
package
io
.
hmit
.
service
;
package
io
.
hmit
.
service
;
import
io.hmit.common.service.BaseService
;
import
io.hmit.common.service.BaseService
;
import
io.hmit.common.utils.Result
;
import
io.hmit.dto.LoginDTO
;
import
io.hmit.dto.LoginDTO
;
import
io.hmit.entity.UserEntity
;
import
io.hmit.entity.UserEntity
;
...
@@ -26,4 +27,12 @@ public interface UserService extends BaseService<UserEntity> {
...
@@ -26,4 +27,12 @@ public interface UserService extends BaseService<UserEntity> {
* @return 返回登录信息
* @return 返回登录信息
*/
*/
Map
<
String
,
Object
>
login
(
LoginDTO
dto
);
Map
<
String
,
Object
>
login
(
LoginDTO
dto
);
/**
* <h1>此方法对全部 手机号及身份证号 进行加密</h1>
* 请勿执行此代码
*/
@Deprecated
Result
<
Object
>
encryptOneTime
();
}
}
hmit-api/src/main/java/io/hmit/service/impl/UserServiceImpl.java
View file @
2d661e00
...
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
io.hmit.common.exception.ErrorCode
;
import
io.hmit.common.exception.ErrorCode
;
import
io.hmit.common.exception.HmitException
;
import
io.hmit.common.exception.HmitException
;
import
io.hmit.common.service.impl.BaseServiceImpl
;
import
io.hmit.common.service.impl.BaseServiceImpl
;
import
io.hmit.common.utils.Result
;
import
io.hmit.common.utils.sm.SMUtil
;
import
io.hmit.common.validator.AssertUtils
;
import
io.hmit.common.validator.AssertUtils
;
import
io.hmit.dao.UserDao
;
import
io.hmit.dao.UserDao
;
import
io.hmit.dto.LoginDTO
;
import
io.hmit.dto.LoginDTO
;
...
@@ -16,7 +18,10 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -16,7 +18,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
@Service
@Service
public
class
UserServiceImpl
extends
BaseServiceImpl
<
UserDao
,
UserEntity
>
implements
UserService
{
public
class
UserServiceImpl
extends
BaseServiceImpl
<
UserDao
,
UserEntity
>
implements
UserService
{
...
@@ -60,4 +65,26 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
...
@@ -60,4 +65,26 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
return
map
;
return
map
;
}
}
/**
* <h1>此方法对全部 手机号及身份证号 进行加密</h1>
* 请勿执行此代码
*/
@Override
public
Result
<
Object
>
encryptOneTime
()
{
QueryWrapper
<
UserEntity
>
wrapper
=
new
QueryWrapper
<>();
List
<
UserEntity
>
userEntities
=
baseDao
.
selectList
(
wrapper
);
String
testStr
=
userEntities
.
get
(
0
).
getMobile
();
Pattern
pattern
=
Pattern
.
compile
(
"[0-9]{1,}"
);
Matcher
matcher
=
pattern
.
matcher
(
testStr
);
if
(!
matcher
.
matches
())
{
return
new
Result
<>().
error
(
"加密内容何必再加密"
);
}
for
(
UserEntity
userEntity
:
userEntities
)
{
userEntity
.
setIdCardNo
(
SMUtil
.
SM4Encrypt
(
userEntity
.
getIdCardNo
()));
userEntity
.
setMobile
(
SMUtil
.
SM4Encrypt
(
userEntity
.
getMobile
()));
baseDao
.
updateById
(
userEntity
);
}
return
new
Result
<>().
ok
(
null
);
}
}
}
hmit-api/src/main/resources/application-dev.yml
View file @
2d661e00
...
@@ -21,7 +21,7 @@ spring:
...
@@ -21,7 +21,7 @@ spring:
test-on-borrow
:
false
test-on-borrow
:
false
test-on-return
:
false
test-on-return
:
false
stat-view-servlet
:
stat-view-servlet
:
enabled
:
tru
e
enabled
:
fals
e
url-pattern
:
/druid/*
url-pattern
:
/druid/*
#login-username: admin
#login-username: admin
#login-password: admin
#login-password: admin
...
...
hmit-api/src/main/resources/application-prod.yml
View file @
2d661e00
...
@@ -21,7 +21,7 @@ spring:
...
@@ -21,7 +21,7 @@ spring:
test-on-borrow
:
false
test-on-borrow
:
false
test-on-return
:
false
test-on-return
:
false
stat-view-servlet
:
stat-view-servlet
:
enabled
:
tru
e
enabled
:
fals
e
url-pattern
:
/druid/*
url-pattern
:
/druid/*
#login-username: admin
#login-username: admin
#login-password: admin
#login-password: admin
...
...
hmit-api/src/main/resources/application-test.yml
View file @
2d661e00
...
@@ -21,7 +21,7 @@ spring:
...
@@ -21,7 +21,7 @@ spring:
test-on-borrow
:
false
test-on-borrow
:
false
test-on-return
:
false
test-on-return
:
false
stat-view-servlet
:
stat-view-servlet
:
enabled
:
tru
e
enabled
:
fals
e
url-pattern
:
/druid/*
url-pattern
:
/druid/*
#login-username: admin
#login-username: admin
#login-password: admin
#login-password: admin
...
...
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