Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
wecloud_im_server
Commits
81e0814b
Commit
81e0814b
authored
Mar 03, 2022
by
Future
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
好友逻辑调整
parent
b260532f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
+18
-9
core/src/main/java/com/wecloud/im/friend/service/ImFriendService.java
+18
-9
No files found.
core/src/main/java/com/wecloud/im/friend/service/ImFriendService.java
View file @
81e0814b
...
...
@@ -102,7 +102,7 @@ public class ImFriendService extends BaseServiceImpl<ImFriendMapper, ImFriend> {
if
(
StringUtils
.
isNotEmpty
(
friendName
))
{
my
.
setFriendName
(
friendName
);
}
this
.
updateByKey
AndClaimer
(
my
);
this
.
updateByKey
(
my
);
}
else
{
my
.
setId
(
SnowflakeUtil
.
getId
());
my
.
setCreateTime
(
new
Date
());
...
...
@@ -119,10 +119,7 @@ public class ImFriendService extends BaseServiceImpl<ImFriendMapper, ImFriend> {
if
(
StringUtils
.
isNotEmpty
(
requestRemark
))
{
friend
.
setRequestRemark
(
requestRemark
);
}
if
(
StringUtils
.
isNotEmpty
(
friendName
))
{
friend
.
setFriendName
(
friendName
);
}
this
.
updateByKeyAndClaimer
(
friend
);
this
.
updateByKey
(
friend
);
}
else
{
friend
.
setId
(
SnowflakeUtil
.
getId
());
friend
.
setCreateTime
(
new
Date
());
...
...
@@ -146,8 +143,7 @@ public class ImFriendService extends BaseServiceImpl<ImFriendMapper, ImFriend> {
public
ImFriend
getByKey
(
String
clientId
,
String
friendClientId
)
{
return
this
.
getOne
(
new
QueryWrapper
<
ImFriend
>().
lambda
()
.
eq
(
ImFriend:
:
getClientId
,
clientId
)
.
eq
(
ImFriend:
:
getClientIdFriend
,
friendClientId
)
.
in
(
ImFriend:
:
getState
,
Lists
.
newArrayList
(
FriendStateEnum
.
UNSURE
.
getCode
(),
FriendStateEnum
.
CONFORM
.
getCode
())));
.
eq
(
ImFriend:
:
getClientIdFriend
,
friendClientId
));
}
/**
...
...
@@ -165,6 +161,19 @@ public class ImFriendService extends BaseServiceImpl<ImFriendMapper, ImFriend> {
}
/**
* 根据 自己id和好友id,更新好友信息
* @param imFriend
*/
public
boolean
updateByKey
(
ImFriend
imFriend
)
{
// 不更新id
imFriend
.
setId
(
null
);
imFriend
.
setCreateTime
(
null
);
return
this
.
update
(
imFriend
,
new
QueryWrapper
<
ImFriend
>().
lambda
()
.
eq
(
ImFriend:
:
getClientId
,
imFriend
.
getClientId
())
.
eq
(
ImFriend:
:
getClientIdFriend
,
imFriend
.
getClientIdFriend
()));
}
/**
* 好友通过/拒绝
* @param currentClient
* @param friendClient
...
...
@@ -186,7 +195,7 @@ public class ImFriendService extends BaseServiceImpl<ImFriendMapper, ImFriend> {
if
(
StringUtils
.
isNotEmpty
(
rejectRemark
))
{
friend
.
setRejectRemark
(
rejectRemark
);
}
boolean
ok1
=
this
.
updateByKey
AndClaimer
(
friend
);
boolean
ok1
=
this
.
updateByKey
(
friend
);
// 同时更新我的
ImFriend
my
=
new
ImFriend
();
my
.
setClientId
(
currentClient
.
getClientId
());
...
...
@@ -196,7 +205,7 @@ public class ImFriendService extends BaseServiceImpl<ImFriendMapper, ImFriend> {
if
(
StringUtils
.
isNotEmpty
(
rejectRemark
))
{
my
.
setRejectRemark
(
rejectRemark
);
}
boolean
ok2
=
this
.
updateByKey
AndClaimer
(
my
);
boolean
ok2
=
this
.
updateByKey
(
my
);
friendEventSender
.
sendFriendApproveEventMsg
(
currentClient
,
friendClient
,
agree
,
rejectRemark
);
...
...
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