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
bbed644e
Commit
bbed644e
authored
Jan 13, 2022
by
lixiaozhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对外的好友id都采用str的clientId
parent
5c032cbe
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
46 additions
and
17 deletions
+46
-17
core/src/main/java/com/wecloud/im/friend/controller/ImFriendController.java
+1
-1
core/src/main/java/com/wecloud/im/friend/service/ImFriendService.java
+13
-2
core/src/main/java/com/wecloud/im/mapper/ImClientMapper.java
+2
-0
core/src/main/java/com/wecloud/im/service/ImClientService.java
+2
-0
core/src/main/java/com/wecloud/im/service/impl/ImClientServiceImpl.java
+5
-0
core/src/main/resources/mapper/ImClientMapper.xml
+8
-1
core/src/main/resources/mapper/ImFriendMapper.xml
+13
-11
core/src/main/resources/mapper/ImFriendRecommendMapper.xml
+2
-2
No files found.
core/src/main/java/com/wecloud/im/friend/controller/ImFriendController.java
View file @
bbed644e
...
@@ -95,7 +95,7 @@ public class ImFriendController extends BaseController {
...
@@ -95,7 +95,7 @@ public class ImFriendController extends BaseController {
if
(
currentClient
==
null
)
{
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
}
Paging
<
ImFriendApplyDto
>
friendInfo
=
imFriendService
.
getUnsureFriends
(
currentClient
.
getId
()
);
Paging
<
ImFriendApplyDto
>
friendInfo
=
imFriendService
.
getUnsureFriends
(
currentClient
);
return
ApiResult
.
ok
(
friendInfo
);
return
ApiResult
.
ok
(
friendInfo
);
}
}
...
...
core/src/main/java/com/wecloud/im/friend/service/ImFriendService.java
View file @
bbed644e
...
@@ -34,6 +34,7 @@ import java.util.ArrayList;
...
@@ -34,6 +34,7 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
/**
* @Description 好友关系处理逻辑
* @Description 好友关系处理逻辑
...
@@ -62,11 +63,16 @@ public class ImFriendService extends BaseServiceImpl<ImFriendMapper, ImFriend> {
...
@@ -62,11 +63,16 @@ public class ImFriendService extends BaseServiceImpl<ImFriendMapper, ImFriend> {
return
imFriendMapper
.
getFriendInfo
(
curentClientId
,
friendClientId
);
return
imFriendMapper
.
getFriendInfo
(
curentClientId
,
friendClientId
);
}
}
public
Paging
<
ImFriendApplyDto
>
getUnsureFriends
(
Long
currentClientId
)
{
/**
* 获取待验证的好友列表
* @param currentClient
* @return
*/
public
Paging
<
ImFriendApplyDto
>
getUnsureFriends
(
ImClient
currentClient
)
{
ImFriendPageParam
pageParam
=
new
ImFriendPageParam
();
ImFriendPageParam
pageParam
=
new
ImFriendPageParam
();
pageParam
.
setPageSize
(
1000L
);
pageParam
.
setPageSize
(
1000L
);
Page
<
ImFriendApplyDto
>
page
=
new
PageInfo
(
pageParam
,
OrderItem
.
desc
(
getLambdaColumn
(
ImFriend:
:
getCreateTime
)));
Page
<
ImFriendApplyDto
>
page
=
new
PageInfo
(
pageParam
,
OrderItem
.
desc
(
getLambdaColumn
(
ImFriend:
:
getCreateTime
)));
IPage
<
ImFriendApplyDto
>
pageList
=
imFriendMapper
.
getUnsureFriendPageList
(
page
,
currentClient
Id
);
IPage
<
ImFriendApplyDto
>
pageList
=
imFriendMapper
.
getUnsureFriendPageList
(
page
,
currentClient
.
getId
()
);
return
new
Paging
<>(
pageList
);
return
new
Paging
<>(
pageList
);
}
}
...
@@ -216,6 +222,11 @@ public class ImFriendService extends BaseServiceImpl<ImFriendMapper, ImFriend> {
...
@@ -216,6 +222,11 @@ public class ImFriendService extends BaseServiceImpl<ImFriendMapper, ImFriend> {
imFriendRecommendMapper
.
batchDeleteRecommend
(
currentClient
.
getId
(),
currentClient
.
getFkAppid
(),
friendClientIds
);
imFriendRecommendMapper
.
batchDeleteRecommend
(
currentClient
.
getId
(),
currentClient
.
getFkAppid
(),
friendClientIds
);
}
}
/**
* 批量创建好友推荐
* @param currentClient
* @param recommendFriends
*/
public
void
batchCreateRecommend
(
ImClient
currentClient
,
List
<
ImFriendRecommendDto
>
recommendFriends
)
{
public
void
batchCreateRecommend
(
ImClient
currentClient
,
List
<
ImFriendRecommendDto
>
recommendFriends
)
{
// 自己不推荐给自己
// 自己不推荐给自己
List
<
ImFriendRecommendDto
>
friends
=
recommendFriends
.
stream
().
filter
(
p
->
!
currentClient
.
getClientId
().
equals
(
p
.
getFriendClientId
())).
collect
(
Collectors
.
toList
());
List
<
ImFriendRecommendDto
>
friends
=
recommendFriends
.
stream
().
filter
(
p
->
!
currentClient
.
getClientId
().
equals
(
p
.
getFriendClientId
())).
collect
(
Collectors
.
toList
());
...
...
core/src/main/java/com/wecloud/im/mapper/ImClientMapper.java
View file @
bbed644e
...
@@ -47,4 +47,6 @@ public interface ImClientMapper extends BaseMapper<ImClient> {
...
@@ -47,4 +47,6 @@ public interface ImClientMapper extends BaseMapper<ImClient> {
List
<
GetInfoListVo
>
getInfoList
(
@Param
(
"appId"
)
Long
appId
,
@Param
(
"conversationId"
)
Long
conversationId
,
@Param
(
"clientIds"
)
List
<
String
>
clientIds
);
List
<
GetInfoListVo
>
getInfoList
(
@Param
(
"appId"
)
Long
appId
,
@Param
(
"conversationId"
)
Long
conversationId
,
@Param
(
"clientIds"
)
List
<
String
>
clientIds
);
List
<
ImClientSimpleDto
>
getSimpleClients
(
@Param
(
"appId"
)
Long
appId
,
@Param
(
"clientIds"
)
List
<
String
>
clientIds
);
List
<
ImClientSimpleDto
>
getSimpleClients
(
@Param
(
"appId"
)
Long
appId
,
@Param
(
"clientIds"
)
List
<
String
>
clientIds
);
List
<
ImClientSimpleDto
>
getSimpleClientsByIds
(
@Param
(
"ids"
)
List
<
Long
>
ids
);
}
}
core/src/main/java/com/wecloud/im/service/ImClientService.java
View file @
bbed644e
...
@@ -125,4 +125,6 @@ public interface ImClientService extends BaseService<ImClient> {
...
@@ -125,4 +125,6 @@ public interface ImClientService extends BaseService<ImClient> {
* @return
* @return
*/
*/
List
<
ImClientSimpleDto
>
getSimpleClients
(
Long
applicationId
,
List
<
String
>
clientId
);
List
<
ImClientSimpleDto
>
getSimpleClients
(
Long
applicationId
,
List
<
String
>
clientId
);
List
<
ImClientSimpleDto
>
getSimpleClients
(
List
<
Long
>
ids
);
}
}
core/src/main/java/com/wecloud/im/service/impl/ImClientServiceImpl.java
View file @
bbed644e
...
@@ -253,4 +253,9 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
...
@@ -253,4 +253,9 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
return
imClientMapper
.
getSimpleClients
(
applicationId
,
clientId
);
return
imClientMapper
.
getSimpleClients
(
applicationId
,
clientId
);
}
}
@Override
public
List
<
ImClientSimpleDto
>
getSimpleClients
(
List
<
Long
>
ids
)
{
return
imClientMapper
.
getSimpleClientsByIds
(
ids
);
}
}
}
core/src/main/resources/mapper/ImClientMapper.xml
View file @
bbed644e
...
@@ -48,10 +48,17 @@
...
@@ -48,10 +48,17 @@
</select>
</select>
<select
id=
"getSimpleClients"
resultType=
"com.wecloud.im.param.ImClientSimpleDto"
>
<select
id=
"getSimpleClients"
resultType=
"com.wecloud.im.param.ImClientSimpleDto"
>
select id, fk_appid,
attributes,
client_id from im_client where fk_appi = #{appId} and client_id in
select id, fk_appid, client_id from im_client where fk_appi = #{appId} and client_id in
<foreach
collection=
"clientIds"
item=
"clientId"
index=
"index"
open=
"("
close=
")"
separator=
","
>
<foreach
collection=
"clientIds"
item=
"clientId"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{clientId}
#{clientId}
</foreach>
</foreach>
</select>
</select>
<select
id=
"getSimpleClientsByIds"
resultType=
"com.wecloud.im.param.ImClientSimpleDto"
>
select id, fk_appid, client_id from im_client where id in
<foreach
collection=
"ids"
item=
"id"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{id}
</foreach>
</select>
</mapper>
</mapper>
core/src/main/resources/mapper/ImFriendMapper.xml
View file @
bbed644e
...
@@ -9,25 +9,27 @@
...
@@ -9,25 +9,27 @@
<select
id=
"getFriendInfo"
resultType=
"com.wecloud.im.friend.param.ImFriendApplyDto"
>
<select
id=
"getFriendInfo"
resultType=
"com.wecloud.im.friend.param.ImFriendApplyDto"
>
select
select
id, fk_client_id_friend as friendClientId, friend_name, fk_client_id_claimer as claimerClientId,
friend.id, client.client_id as friendClientId, friend.friend_name, claimer.client_id as claimerClientId,
reject_remark, request_remark, state, create_time, update_time
friend.reject_remark, friend.request_remark, friend.state, friend.create_time
from im_friend
from im_friend friend inner join im_client client on friend.fk_client_id_friend = client.id
where fk_client_id = #{clientId} and fk_client_id_friend = #{friendClientId} and state = 2
inner join im_client claimer on friend.fk_client_id_claimer = claimer.id
where friend.fk_client_id = #{clientId} and fk_client_id_friend = #{friendClientId} and friend.state = 2
</select>
</select>
<select
id=
"getImFriendPageList"
resultType=
"com.wecloud.im.friend.param.ImFriendBaseDto"
>
<select
id=
"getImFriendPageList"
resultType=
"com.wecloud.im.friend.param.ImFriendBaseDto"
>
select
select
id, fk_client_id_friend as friendClientId, friend_name,
state
friend.id, client.client_id as friendClientId, friend.friend_name, friend.
state
from im_friend
from im_friend
friend inner join im_client client on friend.fk_client_id_friend = client.id
where f
k_client_id = #{clientId} and
state = 2
where f
riend.fk_client_id = #{clientId} and friend.
state = 2
</select>
</select>
<select
id=
"getUnsureFriendPageList"
resultType=
"com.wecloud.im.friend.param.ImFriendApplyDto"
>
<select
id=
"getUnsureFriendPageList"
resultType=
"com.wecloud.im.friend.param.ImFriendApplyDto"
>
select
select
id, fk_client_id_friend as friendClientId, friend_name, fk_client_id_claimer as claimerClientId,
friend.id, client.client_id as friendClientId, friend.friend_name, claimer.client_id as claimerClientId,
reject_remark, request_remark, state, create_time
friend.reject_remark, friend.request_remark, friend.state, friend.create_time
from im_friend
from im_friend friend inner join im_client client on friend.fk_client_id_friend = client.id
where fk_client_id = #{clientId} and state = 1
inner join im_client claimer on friend.fk_client_id_claimer = claimer.id
where friend.fk_client_id = #{clientId} and friend.state = 1
</select>
</select>
<select
id=
"filterNegativeFriends"
resultType=
"java.lang.Long"
>
<select
id=
"filterNegativeFriends"
resultType=
"java.lang.Long"
>
...
...
core/src/main/resources/mapper/ImFriendRecommendMapper.xml
View file @
bbed644e
...
@@ -9,8 +9,8 @@
...
@@ -9,8 +9,8 @@
<select
id=
"getImFriendRecommendPageList"
resultType=
"com.wecloud.im.friend.param.ImFriendRecommendDto"
>
<select
id=
"getImFriendRecommendPageList"
resultType=
"com.wecloud.im.friend.param.ImFriendRecommendDto"
>
select
select
id, fk_client_id_friend as friendClientId, source,
del_flag
recommend.id, client.client_id as friendClientId, recommend.source, recommend.
del_flag
from im_friend_recommend
from im_friend_recommend
recommend inner join im_client client on recommend.fk_client_id_friend = client.id
where fk_client_id = #{clientId}
where fk_client_id = #{clientId}
</select>
</select>
...
...
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