liujc пре 1 месец
родитељ
комит
d10771d3fc

+ 1 - 11
cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/ImUserFriendController.java

@@ -115,17 +115,7 @@ public class ImUserFriendController extends BaseController {
 
 
         // 用户ID
-        long id = Long.parseLong(imGroupService.analysisImUserId(userId));
-
-        SysUser byUserId = sysUserMapper.getByUserId(id);
-
-        ImUserFriendVO.ImMessageUser imMessageUser = new ImUserFriendVO.ImMessageUser();
-        imMessageUser.setImUserId(userId);
-        imMessageUser.setDelFlag(true);
-        if (byUserId !=null) {
-            imMessageUser.setUserId(byUserId.getId());
-            imMessageUser.setDelFlag(byUserId.getDelFlag());
-        }
+        ImUserFriendVO.ImMessageUser imMessageUser = imUserFriendService.getImMessageUser(userId);
         return succeed(imMessageUser);
 
     }

+ 2 - 11
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/ImUserFriendController.java

@@ -20,6 +20,7 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -115,17 +116,7 @@ public class ImUserFriendController extends BaseController {
 
 
         // 用户ID
-        long id = Long.parseLong(imGroupService.analysisImUserId(userId));
-
-        SysUser byUserId = sysUserMapper.getByUserId(id);
-
-        ImUserFriendVO.ImMessageUser imMessageUser = new ImUserFriendVO.ImMessageUser();
-        imMessageUser.setImUserId(userId);
-        imMessageUser.setDelFlag(true);
-        if (byUserId !=null) {
-            imMessageUser.setUserId(byUserId.getId());
-            imMessageUser.setDelFlag(byUserId.getDelFlag());
-        }
+        ImUserFriendVO.ImMessageUser imMessageUser = imUserFriendService.getImMessageUser(userId);
         return succeed(imMessageUser);
 
     }

+ 2 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/ImUserFriendService.java

@@ -76,5 +76,7 @@ public interface ImUserFriendService extends IService<ImUserFriend> {
     void delStudentFriendByTenantId(Long tenantId, Long userId, String clientType);
 
     void refreshCustomer(Long userId, ClientEnum userClientType, List<Long> friendIds, ClientEnum friendClientType);
+
+    ImUserFriendVO.ImMessageUser getImMessageUser(String imUserId);
 }
 

+ 18 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ImUserFriendServiceImpl.java

@@ -655,5 +655,23 @@ public class ImUserFriendServiceImpl extends ServiceImpl<ImUserFriendDao, ImUser
                 .eq(ImUserFriend::getFriendType, userClientType)
                 .update();*/
     }
+
+    @Override
+    public ImUserFriendVO.ImMessageUser getImMessageUser(String imUserId) {
+        long id = Long.parseLong(imGroupService.analysisImUserId(imUserId));
+
+        SysUser byUserId = sysUserMapper.getByUserId(id);
+
+        ImUserFriendVO.ImMessageUser imMessageUser = new ImUserFriendVO.ImMessageUser();
+        imMessageUser.setImUserId(imUserId);
+        imMessageUser.setDelFlag(true);
+        if (byUserId !=null) {
+            imMessageUser.setUserId(byUserId.getId());
+            imMessageUser.setDelFlag(byUserId.getDelFlag());
+            imMessageUser.setUsername(byUserId.getUsername());
+            imMessageUser.setAvatar(byUserId.getAvatar());
+        }
+        return imMessageUser;
+    }
 }
 

+ 6 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/im/ImUserFriendVO.java

@@ -145,6 +145,12 @@ public class ImUserFriendVO {
         @ApiModelProperty(value = "imUserId")
         private String imUserId;
 
+        @ApiModelProperty("用户名称")
+        private String username;
+
+        @ApiModelProperty("用户头像")
+        private String avatar;
+
         @ApiModelProperty("是否注销")
         private Boolean delFlag = false;
     }