|
@@ -698,11 +698,19 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void delSingle(Integer classGroupId) {
|
|
|
+ ClassGroup classGroup = classGroupDao.get(classGroupId);
|
|
|
+
|
|
|
//删除学员班级关联关系
|
|
|
classGroupStudentMapperDao.deleteByClassId(classGroupId);
|
|
|
studentRegistrationDao.deleteClassGroup(classGroupId);
|
|
|
+
|
|
|
//删除班级跟合奏班关系
|
|
|
- classGroupRelationDao.deleteBySubClassId(classGroupId);
|
|
|
+ if (classGroup.getType().equals(ClassGroupTypeEnum.MIX)) { //合奏班
|
|
|
+ classGroupRelationDao.deleteByClassId(classGroupId);
|
|
|
+ } else {
|
|
|
+ classGroupRelationDao.deleteBySubClassId(classGroupId);
|
|
|
+ }
|
|
|
+
|
|
|
//删除班级未开始课程
|
|
|
List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupId);
|
|
|
if (courseScheduleList.size() > 0) {
|
|
@@ -726,6 +734,15 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
classGroupStudentMapperDao.deleteByClassId(classGroupId);
|
|
|
//删除班级关系
|
|
|
classGroupRelationDao.deleteByClassId(classGroupId);
|
|
|
+ //删除班级未开始课程
|
|
|
+ List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupId);
|
|
|
+ if (courseScheduleList.size() > 0) {
|
|
|
+ List<Long> courseScheduleIds = courseScheduleList.stream().map(courseSchedule -> courseSchedule.getId()).collect(Collectors.toList());
|
|
|
+ courseScheduleDao.batchDeleteCourseSchedules(courseScheduleIds);
|
|
|
+ courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
|
|
|
+ teacherAttendanceDao.batchDeleteByCourseSchedules(courseScheduleIds);
|
|
|
+ courseScheduleStudentPaymentDao.deleteByCourseSchedule(courseScheduleIds);
|
|
|
+ }
|
|
|
//删除合奏班
|
|
|
classGroupDao.delete(classGroupId);
|
|
|
//删除im群组
|
|
@@ -981,6 +998,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
String subjectIds = subjectList.stream().map(subject -> subject.getId().toString()).collect(Collectors.joining(","));
|
|
|
String subjectNames = subjectList.stream().map(subject -> subject.getName()).collect(Collectors.joining("/"));
|
|
|
|
|
|
+ if (classGroup4MixDto.getType() == null) {
|
|
|
+ classGroup4MixDto.setType(ClassGroupTypeEnum.NORMAL);
|
|
|
+ }
|
|
|
//1、新建班级
|
|
|
ClassGroup classGroup = new ClassGroup();
|
|
|
classGroup.setMusicGroupId(classGroup4MixDto.getMusicGroupId());
|
|
@@ -988,7 +1008,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
classGroup.setName(classGroup4MixDto.getClassGroupName());
|
|
|
classGroup.setExpectStudentNum(studentList.size());
|
|
|
classGroup.setStudentNum(studentList.size());
|
|
|
- classGroup.setType(ClassGroupTypeEnum.NORMAL);
|
|
|
+ classGroup.setType(classGroup4MixDto.getType());
|
|
|
classGroup.setDelFlag(0);
|
|
|
classGroup.setGroupType(GroupType.MUSIC);
|
|
|
classGroup.setCurrentClassTimes(0);
|
|
@@ -1002,8 +1022,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
List<ClassGroupStudentMapper> classGroupStudentMapperList = new ArrayList<>();
|
|
|
List<Integer> userIds = new ArrayList<>(); //用户ids
|
|
|
for (StudentRegistration studentRegistration : studentList) {
|
|
|
- studentRegistration.setClassGroupId(classGroup.getId());
|
|
|
- studentRegistrationService.update(studentRegistration);
|
|
|
+ if (classGroup4MixDto.getType().equals(ClassGroupTypeEnum.NORMAL)) {
|
|
|
+ studentRegistration.setClassGroupId(classGroup.getId());
|
|
|
+ studentRegistrationService.update(studentRegistration);
|
|
|
+ }
|
|
|
|
|
|
ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
classGroupStudentMapper.setMusicGroupId(musicGroupId);
|