|
@@ -777,21 +777,6 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
log.info("buyLiveCourseSuccess ok");
|
|
|
//课程购买成功后进行消息推送
|
|
|
buyLiveSendMessage(studentPayment, courseGroup);
|
|
|
-
|
|
|
- //创建群聊
|
|
|
- try {
|
|
|
- ImGroup imGroup = imGroupService.getDao().selectOne(Wrappers.<ImGroup>lambdaQuery().eq(ImGroup::getCourseGroupId, courseGroup.getId()));
|
|
|
- if (imGroup == null) {//群组不存在->创建群组
|
|
|
- imGroupService.autoCreate(courseGroup.getId(), CourseScheduleEnum.LIVE.getCode());
|
|
|
- } else {//存在->加入当前学员
|
|
|
- String imGroupId = imGroup.getId();
|
|
|
- Set<Long> userIds = new HashSet<>(Collections.singletonList(studentPayment.getUserId()));
|
|
|
- imGroupMemberService.initGroupMembers(imGroupId, userIds, ImGroupMemberRoleType.STUDENT);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("直播课程组id:{},创建群聊失败:{}", courseGroup.getId(), e);
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1050,8 +1035,14 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
if (courseGroup.getPreStudentNum() >= courseGroup.getMixStudentNum()) {
|
|
|
//人数达标则修改课程组为进行中状态
|
|
|
courseGroup.setStatus(CourseGroupEnum.ING.getCode());
|
|
|
- //建立群组
|
|
|
+ //创建群聊 并添加人员到群中
|
|
|
String imGroupId = imGroupService.autoCreate(courseGroup.getId(), courseGroup.getType());
|
|
|
+ List<CourseScheduleStudentPayment> list = courseScheduleStudentPaymentService.list(Wrappers.<CourseScheduleStudentPayment>lambdaQuery()
|
|
|
+ .eq(CourseScheduleStudentPayment::getCourseGroupId, courseGroup.getId()));
|
|
|
+ Set<Long> userIds = list.stream().map(CourseScheduleStudentPayment::getUserId).collect(Collectors.toSet());
|
|
|
+ imGroupMemberService.initGroupMembers(imGroupId, userIds, ImGroupMemberRoleType.STUDENT);
|
|
|
+ //添加老师进群
|
|
|
+ imGroupMemberService.initGroupMembers(imGroupId, Collections.singleton(courseGroup.getTeacherId()), ImGroupMemberRoleType.TEACHER);
|
|
|
courseGroup.setImGroupId(imGroupId);
|
|
|
} else {
|
|
|
//人数未达标则修改课程组为取消状态
|