Commit bbed644e by lixiaozhong

对外的好友id都采用str的clientId

parent 5c032cbe
...@@ -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);
} }
......
...@@ -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, currentClientId); 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());
......
...@@ -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);
} }
...@@ -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);
} }
...@@ -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);
}
} }
...@@ -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>
...@@ -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 fk_client_id = #{clientId} and state = 2 where friend.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">
......
...@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment