Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
96350fb2
Commit
96350fb2
authored
Jan 19, 2018
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决线上写实名账户时经常触发idNo唯一约束异常的问题
parent
65b7ba06
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
UserAuthorizedServiceImpl.java
...oup/xyqb/service/auth/impl/UserAuthorizedServiceImpl.java
+9
-0
No files found.
src/main/java/cn/quantgroup/xyqb/service/auth/impl/UserAuthorizedServiceImpl.java
View file @
96350fb2
...
...
@@ -9,11 +9,13 @@ import cn.quantgroup.xyqb.service.auth.IUserAuthorizedService;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.sql.Timestamp
;
import
java.text.ParseException
;
import
java.util.Objects
;
/**
* @author xufei on 2018/1/5.
...
...
@@ -27,6 +29,7 @@ public class UserAuthorizedServiceImpl implements IUserAuthorizedService {
@Resource
private
IUserAuthorizedRepository
userAuthorizedRepository
;
@Cacheable
(
value
=
"user_authorized_idno_cache"
,
key
=
"#idNo"
,
unless
=
"#result == null"
,
cacheManager
=
"cacheManager"
)
@Override
public
Boolean
hasUserAuthorized
(
String
idNo
)
{
try
{
...
...
@@ -35,6 +38,7 @@ public class UserAuthorizedServiceImpl implements IUserAuthorizedService {
}
}
catch
(
ParseException
e
)
{
LOGGER
.
error
(
"[hasUserAuthorized]参数异常e:{}"
,
e
);
return
Boolean
.
FALSE
;
}
UserAuthorized
userAuthorized
=
userAuthorizedRepository
.
findByIdNo
(
idNo
);
...
...
@@ -62,6 +66,10 @@ public class UserAuthorizedServiceImpl implements IUserAuthorizedService {
@Override
public
UserAuthorized
createUserAuthorized
(
UserAuthorizedParam
userAuthorizedParam
)
{
// 数据检查
if
(
Objects
.
isNull
(
userAuthorizedParam
)
||
this
.
hasUserAuthorized
(
userAuthorizedParam
.
getIdNo
())){
return
null
;
}
AuthPattern
authPatternEnum
=
AuthPattern
.
valueOf
(
userAuthorizedParam
.
getAuthPattern
());
UserAuthorized
userAuthorized
=
new
UserAuthorized
();
...
...
@@ -84,6 +92,7 @@ public class UserAuthorizedServiceImpl implements IUserAuthorizedService {
}
}
@Cacheable
(
value
=
"user_authorized_uuid_2_id_cache"
,
key
=
"#userUuid"
,
unless
=
"#result == null"
,
cacheManager
=
"cacheManager"
)
@Override
public
String
getUserAuthorizedId
(
String
userUuid
)
{
if
(
StringUtils
.
isBlank
(
userUuid
))
{
...
...
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