Browse Source

1.处理老师与客服添加好友

yuanliang 1 year ago
parent
commit
fa7ec32a91

+ 5 - 5
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TeacherServiceImpl.java

@@ -407,10 +407,10 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
 
         // 机构老师与学生互加好友关系
         if (Optional.ofNullable(teacher.getTenantId()).orElse(-1L) > 0) {
-            // 自动与机构老师成为好友
+            // 自动与机构学生成为好友
             Set<Long> collect = studentService.lambdaQuery()
                     .eq(Student::getTenantId, teacher.getTenantId()).list().stream()
-                    .map(Student::getUserId).filter(next->!next.equals(teacher.getUserId())).collect(Collectors.toSet());
+                    .map(Student::getUserId).collect(Collectors.toSet());
 
             imUserFriendService.saveUserFriend(teacher.getUserId(), collect);
         }
@@ -423,7 +423,7 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
             queryWrapper.lambda().in(com.yonge.cooleshow.biz.dal.entity.SysUser::getPhone,phones);
             List<com.yonge.cooleshow.biz.dal.entity.SysUser> sysUsers = sysUserMapper.selectList(queryWrapper);
             Set<Long> userIds = sysUsers.stream().map(com.yonge.cooleshow.biz.dal.entity.SysUser::getId).collect(Collectors.toSet());
-            if (userIds.isEmpty()) {
+            if (!userIds.isEmpty()) {
                 imUserFriendService.saveUserTeacherFriend(teacher.getUserId(), userIds);
             }
         }
@@ -1014,10 +1014,10 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
 
         // 机构老师与学生互加好友关系
         if (Optional.ofNullable(updateTenant.getTenantId()).orElse(-1L) > 0) {
-            // 自动与机构老师成为好友
+            // 自动与机构学生成为好友
             Set<Long> collect = studentService.lambdaQuery()
                     .eq(Student::getTenantId, updateTenant.getTenantId()).list().stream()
-                    .map(Student::getUserId).filter(next -> !next.equals(teacher.getUserId()))
+                    .map(Student::getUserId)
                     .collect(Collectors.toSet());
 
             if (!collect.isEmpty()) {