Explorar o código

历史数据创建群

liujunchi %!s(int64=2) %!d(string=hai) anos
pai
achega
3f19e2626c

+ 19 - 9
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ImGroupServiceImpl.java

@@ -2,6 +2,7 @@ package com.yonge.cooleshow.biz.dal.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.collect.Lists;
+import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.config.RongCloudConfig;
 import com.yonge.cooleshow.biz.dal.dao.CourseScheduleStudentPaymentDao;
@@ -75,6 +76,9 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
     private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 
     @Autowired
+    private SysUserFeignService sysUserFeignService;
+
+    @Autowired
     private StudentStarService studentStarService;
 
     @Autowired
@@ -234,15 +238,7 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
 
         for (Teacher teacher : teacherList) {
 
-            // 查询老师的粉丝,添加到群
-            List<StudentStar> list = studentStarService.lambdaQuery()
-                                                       .eq(StudentStar::getTeacherId, teacher.getUserId())
-                                                       .list();
-            Set<Long> studentIdList = list.stream().map(StudentStar::getStudentId).collect(Collectors.toSet());
-
-            // 老师用户信息
-            SysUser sysUser = sysUserService.findUserById(teacher.getUserId());
-
+            // 已经有群的不操作
             Integer count = this.lambdaQuery()
                                 .eq(ImGroup::getCreateBy, teacher.getUserId())
                                 .eq(ImGroup::getAutoPassFlag, true)
@@ -252,6 +248,20 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
                 continue;
             }
 
+            // 老师用户信息
+            SysUser sysUser = sysUserFeignService.queryUserById(teacher.getUserId());
+            if (sysUser == null) {
+                continue;
+            }
+
+
+            // 查询老师的粉丝,添加到群
+            List<StudentStar> list = studentStarService.lambdaQuery()
+                                                       .eq(StudentStar::getTeacherId, teacher.getUserId())
+                                                       .list();
+            Set<Long> studentIdList = list.stream().map(StudentStar::getStudentId).collect(Collectors.toSet());
+
+
             //创建群聊
             ImGroup imGroup = new ImGroup();
             imGroup.setCreateBy(teacher.getUserId());