|
@@ -5,6 +5,8 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Sets;
|
|
import com.google.common.collect.Sets;
|
|
|
|
+import com.microsvc.toolkit.middleware.im.ImPluginContext;
|
|
|
|
+import com.microsvc.toolkit.middleware.im.message.TencentWrapper;
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
import com.ym.mec.biz.dal.enums.EFriendRoleType;
|
|
import com.ym.mec.biz.dal.enums.EFriendRoleType;
|
|
@@ -16,6 +18,7 @@ import com.ym.mec.biz.dal.wrapper.ImGroupWrapper;
|
|
import com.ym.mec.biz.service.TeacherService;
|
|
import com.ym.mec.biz.service.TeacherService;
|
|
import com.ym.mec.biz.service.im.ImGroupCoreService;
|
|
import com.ym.mec.biz.service.im.ImGroupCoreService;
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -31,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import static com.ym.mec.biz.dal.enums.GroupType.*;
|
|
import static com.ym.mec.biz.dal.enums.GroupType.*;
|
|
|
|
|
|
|
|
+@Slf4j
|
|
@Service
|
|
@Service
|
|
public class ImUserFriendServiceImpl extends BaseServiceImpl<Long, ImUserFriend> implements ImUserFriendService {
|
|
public class ImUserFriendServiceImpl extends BaseServiceImpl<Long, ImUserFriend> implements ImUserFriendService {
|
|
|
|
|
|
@@ -67,6 +71,8 @@ public class ImUserFriendServiceImpl extends BaseServiceImpl<Long, ImUserFriend>
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ImGroupCoreService imGroupCoreService;
|
|
private ImGroupCoreService imGroupCoreService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ImPluginContext imPluginContext;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public BaseDAO<Long, ImUserFriend> getDAO() {
|
|
public BaseDAO<Long, ImUserFriend> getDAO() {
|
|
@@ -185,6 +191,31 @@ public class ImUserFriendServiceImpl extends BaseServiceImpl<Long, ImUserFriend>
|
|
return imUserFriendDto;
|
|
return imUserFriendDto;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取用户详情
|
|
|
|
+ *
|
|
|
|
+ * @param userId 用户ID
|
|
|
|
+ * @return ImUserFriend
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public ImUserFriendDto getImUserProfile(String userId) {
|
|
|
|
+ try {
|
|
|
|
+ TencentWrapper.UserProfile userProfile = imPluginContext.getPluginService().getUserProfile(userId);
|
|
|
|
+ // 返回当前登录用户信息
|
|
|
|
+ ImUserFriendDto imUserFriend = new ImUserFriendDto();
|
|
|
|
+ imUserFriend.setFriendAvatar(userProfile.getAvatar());
|
|
|
|
+ imUserFriend.setFriendNickname(userProfile.getUsername());
|
|
|
|
+ imUserFriend.setImFriendId(userId);
|
|
|
|
+ imUserFriend.setFriendType(ClientEnum.STUDENT.getCode());
|
|
|
|
+ // 设置IM好友ID
|
|
|
|
+ imUserFriend.setImUserId(userId);
|
|
|
|
+ return imUserFriend;
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("getImUserProfile userId={}", userId, e);
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void batchInsert(List<ImUserFriend> imUserFriends) {
|
|
public void batchInsert(List<ImUserFriend> imUserFriends) {
|
|
for (ImUserFriend imUserFriend : imUserFriends) {
|
|
for (ImUserFriend imUserFriend : imUserFriends) {
|