|
@@ -167,36 +167,54 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
classGroup.setCreateTime(date);
|
|
classGroup.setCreateTime(date);
|
|
classGroup.setUpdateTime(date);
|
|
classGroup.setUpdateTime(date);
|
|
- classGroup.setType(ClassGroupTypeEnum.NORMAL);
|
|
|
|
classGroup.setExpectStudentNum(userIdStrSet.size());
|
|
classGroup.setExpectStudentNum(userIdStrSet.size());
|
|
classGroup.setStudentNum(userIdStrSet.size());
|
|
classGroup.setStudentNum(userIdStrSet.size());
|
|
|
|
+ //创建班级
|
|
insert(classGroup);
|
|
insert(classGroup);
|
|
|
|
+
|
|
|
|
+ //设置班级上的老师
|
|
|
|
+ List<ClassGroupTeacherMapper> teacherMapperList = classGroup.getTeacherMapperList();
|
|
|
|
+ for(ClassGroupTeacherMapper tm : teacherMapperList){
|
|
|
|
+ tm.setClassGroupId(classGroup.getId());
|
|
|
|
+ tm.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
|
+ tm.setGroupType(classGroup.getGroupType());
|
|
|
|
+ tm.setCreateTime(date);
|
|
|
|
+ tm.setUpdateTime(date);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(teacherMapperList.size() > 0){
|
|
|
|
+ classGroupTeacherMapperDao.classGroupTeachersInsert(teacherMapperList);
|
|
|
|
+ }
|
|
|
|
|
|
//2、插入班级学生关联关系
|
|
//2、插入班级学生关联关系
|
|
- List<Integer> userIdList = new ArrayList<>();
|
|
|
|
- List<ClassGroupStudentMapper> classGroupStudentList = new ArrayList<>();
|
|
|
|
- for (String userId : userIdStrSet) {
|
|
|
|
- ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
|
- classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
|
- classGroupStudentMapper.setClassGroupId(classGroup.getId());
|
|
|
|
- classGroupStudentMapper.setUserId(Integer.parseInt(userId));
|
|
|
|
- classGroupStudentMapper.setCreateTime(date);
|
|
|
|
- classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
|
- classGroupStudentMapper.setGroupType(GroupType.MUSIC);
|
|
|
|
- classGroupStudentList.add(classGroupStudentMapper);
|
|
|
|
-
|
|
|
|
- StudentRegistration studentRegistration = new StudentRegistration();
|
|
|
|
- studentRegistration.setClassGroupId(classGroup.getId());
|
|
|
|
- studentRegistration.setUserId(Integer.parseInt(userId));
|
|
|
|
- studentRegistration.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
|
- studentRegistrationDao.updateByUserIdAndMusicGroupId(studentRegistration);
|
|
|
|
-
|
|
|
|
- userIdList.add(Integer.parseInt(userId));
|
|
|
|
- }
|
|
|
|
- classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentList);
|
|
|
|
|
|
+ List<Integer> userIdList = new ArrayList<>();
|
|
|
|
+ List<ClassGroupStudentMapper> classGroupStudentList = new ArrayList<>();
|
|
|
|
+ for (String userId : userIdStrSet) {
|
|
|
|
+ ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
|
+ classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
|
+ classGroupStudentMapper.setClassGroupId(classGroup.getId());
|
|
|
|
+ classGroupStudentMapper.setUserId(Integer.parseInt(userId));
|
|
|
|
+ classGroupStudentMapper.setCreateTime(date);
|
|
|
|
+ classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
|
+ classGroupStudentMapper.setGroupType(GroupType.MUSIC);
|
|
|
|
+ classGroupStudentList.add(classGroupStudentMapper);
|
|
|
|
+
|
|
|
|
+ StudentRegistration studentRegistration = new StudentRegistration();
|
|
|
|
+ studentRegistration.setClassGroupId(classGroup.getId());
|
|
|
|
+ studentRegistration.setUserId(Integer.parseInt(userId));
|
|
|
|
+ studentRegistration.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
|
+ studentRegistrationDao.updateByUserIdAndMusicGroupId(studentRegistration);
|
|
|
|
+
|
|
|
|
+ userIdList.add(Integer.parseInt(userId));
|
|
|
|
+ }
|
|
|
|
+ if (classGroupStudentList.size() > 0) {
|
|
|
|
+ classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentList);
|
|
|
|
+ }
|
|
|
|
|
|
- //加入IM群组
|
|
|
|
- addImGroup(classGroup, userIdList);
|
|
|
|
|
|
+ // 加入IM群组
|
|
|
|
+ if (userIdList.size() > 0) {
|
|
|
|
+ addImGroup(classGroup, userIdList);
|
|
|
|
+ }
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|