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
9e90a618
Commit
9e90a618
authored
Dec 10, 2018
by
xiaoguang.xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix : userHashMapping 重复保存不报错
parent
e8845f0e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
PhoneHashEventListener.java
...java/cn/quantgroup/xyqb/event/PhoneHashEventListener.java
+3
-2
UserDetailHashEventListener.java
...cn/quantgroup/xyqb/event/UserDetailHashEventListener.java
+3
-2
No files found.
src/main/java/cn/quantgroup/xyqb/event/PhoneHashEventListener.java
View file @
9e90a618
...
@@ -6,11 +6,12 @@ import cn.quantgroup.xyqb.repository.IUserHashMappingRepository;
...
@@ -6,11 +6,12 @@ import cn.quantgroup.xyqb.repository.IUserHashMappingRepository;
import
cn.quantgroup.xyqb.util.encrypt.MD5Util
;
import
cn.quantgroup.xyqb.util.encrypt.MD5Util
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.hibernate.exception.ConstraintViolationException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.persistence.PersistenceException
;
@Component
@Component
@Slf4j
@Slf4j
public
class
PhoneHashEventListener
implements
ApplicationListener
<
RegisterEvent
>
{
public
class
PhoneHashEventListener
implements
ApplicationListener
<
RegisterEvent
>
{
...
@@ -45,7 +46,7 @@ public class PhoneHashEventListener implements ApplicationListener<RegisterEvent
...
@@ -45,7 +46,7 @@ public class PhoneHashEventListener implements ApplicationListener<RegisterEvent
try
{
try
{
userHashMappingRepository
.
saveAndFlush
(
userHashMapping
);
userHashMappingRepository
.
saveAndFlush
(
userHashMapping
);
}
catch
(
ConstraintViolation
Exception
e
)
{
}
catch
(
Persistence
Exception
e
)
{
log
.
error
(
"保存userHashMapping重复, 无需再保存, userId:{}"
,
userId
);
log
.
error
(
"保存userHashMapping重复, 无需再保存, userId:{}"
,
userId
);
}
}
...
...
src/main/java/cn/quantgroup/xyqb/event/UserDetailHashEventListener.java
View file @
9e90a618
...
@@ -6,11 +6,12 @@ import cn.quantgroup.xyqb.repository.IUserHashMappingRepository;
...
@@ -6,11 +6,12 @@ import cn.quantgroup.xyqb.repository.IUserHashMappingRepository;
import
cn.quantgroup.xyqb.util.encrypt.MD5Util
;
import
cn.quantgroup.xyqb.util.encrypt.MD5Util
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.hibernate.exception.ConstraintViolationException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.persistence.PersistenceException
;
/**
/**
* userDetail 更新时, 保存 hashMapping 数据
* userDetail 更新时, 保存 hashMapping 数据
...
@@ -50,7 +51,7 @@ public class UserDetailHashEventListener implements ApplicationListener<UserDeta
...
@@ -50,7 +51,7 @@ public class UserDetailHashEventListener implements ApplicationListener<UserDeta
userHashMapping
.
setIdNoMd5
(
idNoMd5New
);
userHashMapping
.
setIdNoMd5
(
idNoMd5New
);
try
{
try
{
userHashMappingRepository
.
save
(
userHashMapping
);
userHashMappingRepository
.
save
(
userHashMapping
);
}
catch
(
ConstraintViolationException
e
)
{
}
catch
(
PersistenceException
e
)
{
log
.
error
(
"保存userHashMapping重复, 无需再保存, userId:{}"
,
userDetail
.
getUserId
());
log
.
error
(
"保存userHashMapping重复, 无需再保存, userId:{}"
,
userDetail
.
getUserId
());
}
}
...
...
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