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
e4783857
Commit
e4783857
authored
Oct 30, 2019
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sonar--npe
parent
86aedf75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
ContactServiceImpl.java
...quantgroup/xyqb/service/user/impl/ContactServiceImpl.java
+15
-6
No files found.
src/main/java/cn/quantgroup/xyqb/service/user/impl/ContactServiceImpl.java
View file @
e4783857
...
...
@@ -103,18 +103,27 @@ public class ContactServiceImpl implements IContactService {
private
void
mergeContacts
(
Long
userId
,
List
<
Contact
>
contacts
)
{
// 当前联系人列表
List
<
Contact
>
userContact
=
contactRepository
.
findByUserId
(
userId
);
int
userContactCount
=
(
userContact
==
null
)
?
0
:
userContact
.
size
();
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
for
(
int
i
=
0
;
i
<
contacts
.
size
();
i
++)
{
Contact
c
=
contacts
.
get
(
i
);
c
.
setId
(
null
);
c
.
setUserId
(
userId
);
c
.
setRelation
(
c
.
getRelation
()
==
null
?
Relation
.
OTHER
:
c
.
getRelation
());
c
.
setCreatedAt
(
now
);
if
(
Objects
.
isNull
(
c
.
getRelation
())){
c
.
setRelation
(
Relation
.
OTHER
);
}
c
.
setUpdateAt
(
now
);
if
(
userContactCount
>
i
)
{
c
.
setId
(
userContact
.
get
(
i
).
getId
());
c
.
setCreatedAt
(
userContact
.
get
(
i
).
getCreatedAt
()
==
null
?
now
:
userContact
.
get
(
i
).
getCreatedAt
());
if
(
CollectionUtils
.
isEmpty
(
userContact
)
||
userContact
.
size
()
<=
i
)
{
continue
;
}
Contact
old
=
userContact
.
get
(
i
);
if
(
Objects
.
isNull
(
old
)){
continue
;
}
c
.
setId
(
old
.
getId
());
if
(
Objects
.
nonNull
(
old
.
getCreatedAt
())){
c
.
setCreatedAt
(
old
.
getCreatedAt
());
}
else
{
c
.
setCreatedAt
(
now
);
}
}
}
...
...
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