|
@@ -909,14 +909,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
}
|
|
|
Integer schoolId = musicGroup.getSchoolId();
|
|
|
|
|
|
- List<Integer> subjectIdSet = new ArrayList<>();
|
|
|
-
|
|
|
List<Integer> studentIdList = classGroup4MixDto.getStudents();
|
|
|
List<StudentRegistration> studentList = studentRegistrationService.findStudentListByUserIdList(musicGroupId, studentIdList);
|
|
|
- for (StudentRegistration student : studentList) {
|
|
|
- subjectIdSet.add(student.getSubjectId());
|
|
|
- }
|
|
|
- List<Subject> subjectList = subjectService.findBySubjectByIdList(subjectIdSet);
|
|
|
+
|
|
|
+ List<Integer> subjectIdList = studentList.stream().map(student->student.getActualSubjectId()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<Subject> subjectList = subjectService.findBySubjectByIdList(subjectIdList);
|
|
|
|
|
|
String subjectIds = subjectList.stream().map(subject -> subject.getId().toString()).collect(Collectors.joining(","));
|
|
|
String subjectNames = subjectList.stream().map(subject -> subject.getName()).collect(Collectors.joining("/"));
|
|
@@ -940,6 +938,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
|
|
|
//2、将学生加入新班级(学生注册表,关联表
|
|
|
List<ClassGroupStudentMapper> classGroupStudentMapperList = new ArrayList<>();
|
|
|
+ List<Integer> userIds = new ArrayList<>(); //用户ids
|
|
|
for (StudentRegistration studentRegistration : studentList) {
|
|
|
studentRegistration.setClassGroupId(classGroup.getId());
|
|
|
studentRegistrationService.update(studentRegistration);
|
|
@@ -952,6 +951,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
classGroupStudentMapper.setGroupType(GroupType.MUSIC);
|
|
|
classGroupStudentMapperList.add(classGroupStudentMapper);
|
|
|
+
|
|
|
+ userIds.add(studentRegistration.getUserId());
|
|
|
}
|
|
|
classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMapperList);
|
|
|
|
|
@@ -959,13 +960,16 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
//3、将老师加入关联关系
|
|
|
List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroup4MixDto.getClassGroupTeacherMapperList();
|
|
|
|
|
|
-
|
|
|
for (ClassGroupTeacherMapper classGroupTeacherMapper : classGroupTeacherMapperList) {
|
|
|
classGroupTeacherMapper.setClassGroupId(classGroup.getId());
|
|
|
classGroupTeacherMapper.setMusicGroupId(classGroup4MixDto.getMusicGroupId());
|
|
|
+ userIds.add(classGroupTeacherMapper.getUserId());
|
|
|
}
|
|
|
classGroupTeacherMapperDao.classGroupTeachersInsert(classGroupTeacherMapperList);
|
|
|
|
|
|
+ //创建IM群组
|
|
|
+ addImGroup(classGroup,userIds);
|
|
|
+
|
|
|
//5、插入班级排课信息
|
|
|
LocalDateTime now = LocalDate.parse(classGroup4MixDto.getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
|
|
|
|
|
@@ -1120,14 +1124,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
|
|
|
Integer schoolId = musicGroup.getSchoolId();
|
|
|
|
|
|
- List<Integer> subjectIdSet = new ArrayList<>();
|
|
|
|
|
|
List<Integer> studentIdList = classGroup4MixDto.getStudents();
|
|
|
List<StudentRegistration> studentList = studentRegistrationService.findStudentListByUserIdList(musicGroupId, studentIdList);
|
|
|
- for (StudentRegistration student : studentList) {
|
|
|
- subjectIdSet.add(student.getSubjectId());
|
|
|
- }
|
|
|
- List<Subject> subjectList = subjectService.findBySubjectByIdList(subjectIdSet);
|
|
|
+ List<Integer> subjectIdList = studentList.stream().map(student->student.getActualSubjectId()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<Subject> subjectList = subjectService.findBySubjectByIdList(subjectIdList);
|
|
|
|
|
|
String subjectIds = subjectList.stream().map(subject -> subject.getId().toString()).collect(Collectors.joining(","));
|
|
|
String subjectNames = subjectList.stream().map(subject -> subject.getName()).collect(Collectors.joining("/"));
|
|
@@ -1355,6 +1357,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
|
|
|
|
|
|
//2、将学生加入新班级,关联表
|
|
|
+ List<Integer> userIds = new ArrayList<>();
|
|
|
List<ClassGroupStudentMapper> classGroupStudentMapperList = new ArrayList<>();
|
|
|
for (StudentRegistration studentRegistration : studentList) {
|
|
|
ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
@@ -1365,6 +1368,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
classGroupStudentMapper.setGroupType(GroupType.MUSIC);
|
|
|
classGroupStudentMapperList.add(classGroupStudentMapper);
|
|
|
+ userIds.add(studentRegistration.getUserId());
|
|
|
}
|
|
|
classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMapperList);
|
|
|
|
|
@@ -1375,9 +1379,13 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
for (ClassGroupTeacherMapper classGroupTeacherMapper : classGroupTeacherMapperList) {
|
|
|
classGroupTeacherMapper.setClassGroupId(classGroup.getId());
|
|
|
classGroupTeacherMapper.setMusicGroupId(classGroup4MixDto.getMusicGroupId());
|
|
|
+ userIds.add(classGroupTeacherMapper.getUserId());
|
|
|
}
|
|
|
classGroupTeacherMapperDao.classGroupTeachersInsert(classGroupTeacherMapperList);
|
|
|
|
|
|
+ //创建IM群组
|
|
|
+ addImGroup(classGroup,userIds);
|
|
|
+
|
|
|
//5、插入班级排课信息
|
|
|
LocalDateTime now = LocalDate.parse(classGroup4MixDto.getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
|
|
|
|
|
@@ -1656,9 +1664,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void addStudentIntoClassGroup(String musicGroupId, Integer classGroupId, List<Integer> studentIds) {
|
|
|
- List<ClassGroupStudentMapper> classGroupStudentMappers=new ArrayList<>();
|
|
|
+ List<ClassGroupStudentMapper> classGroupStudentMappers = new ArrayList<>();
|
|
|
for (Integer studentId : studentIds) {
|
|
|
- ClassGroupStudentMapper classGroupStudentMapper=new ClassGroupStudentMapper(musicGroupId,classGroupId,studentId,ClassGroupStudentStatusEnum.NORMAL);
|
|
|
+ ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper(musicGroupId, classGroupId, studentId, ClassGroupStudentStatusEnum.NORMAL);
|
|
|
classGroupStudentMapper.setGroupType(GroupType.VIP);
|
|
|
classGroupStudentMappers.add(classGroupStudentMapper);
|
|
|
}
|
|
@@ -1684,4 +1692,17 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
}
|
|
|
return classGroups;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean addImGroup(ClassGroup classGroup, List<Integer> userIds) {
|
|
|
+ List<ImGroupMember> imGroupMemberList = new ArrayList<>();
|
|
|
+ for (Integer userId : userIds) {
|
|
|
+ imGroupMemberList.add(new ImGroupMember(userId.toString()));
|
|
|
+ }
|
|
|
+ //创建IM群组
|
|
|
+ ImGroupMember[] imGroupMembers = imGroupMemberList.toArray(new ImGroupMember[imGroupMemberList.size()]);
|
|
|
+ // 创建群组
|
|
|
+ imFeignService.groupCreate(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|