|
@@ -267,9 +267,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public List<HighClassGroupDto> addHighClassGroup(List<HighClassGroupDto> highClassGroupList) throws Exception {
|
|
|
- String key = "addHighClassGroup";
|
|
|
- long value = Thread.currentThread().getId();
|
|
|
- redisCache.getLocked(key, value, 30);
|
|
|
+ String key = "addHighClassGroup";
|
|
|
+ long value = Thread.currentThread().getId();
|
|
|
+ redisCache.getLocked(key, value, 30);
|
|
|
MusicGroup musicGroup = musicGroupDao.get(highClassGroupList.get(0).getMusicGroupId());
|
|
|
|
|
|
int highClassGroupNum = studentRegistrationDao.findMusicGroupStudentNum(musicGroup.getId()) / 5;
|
|
@@ -532,7 +532,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
//获取分页前的所有的乐团编号和vip编号
|
|
|
params.put("offset", pageInfo.getOffset());
|
|
|
List<String> musicGroupIds = courseScheduleDao.queryMusicGroupIds(params);
|
|
|
- if(queryInfo.isHideOverGroup()){
|
|
|
+ if (queryInfo.isHideOverGroup()) {
|
|
|
musicGroupIds = courseScheduleDao.queryMusicGroupIdsWithoutOverGroup(params);
|
|
|
}
|
|
|
courseListDtos = new ArrayList<>();
|
|
@@ -1198,64 +1198,26 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
if (musicGroup == null) {
|
|
|
throw new Exception("乐团不存在");
|
|
|
}
|
|
|
- ClassGroup classgroup = classGroupDao.get(classGroup4MixDto.getClassGroupId());
|
|
|
- if (classgroup == null) {
|
|
|
+ ClassGroup classGroup = classGroupDao.get(classGroup4MixDto.getClassGroupId());
|
|
|
+ if (classGroup == null) {
|
|
|
throw new Exception("班级不存在");
|
|
|
}
|
|
|
-
|
|
|
Integer schoolId = musicGroup.getSchoolId();
|
|
|
|
|
|
+ List<Subject> subjectList = subjectService.findBySubjectByIdList(classGroup.getSubjectIdList());
|
|
|
|
|
|
- List<Integer> studentIdList = classGroup4MixDto.getStudents();
|
|
|
- List<StudentRegistration> studentList = studentRegistrationService.findStudentListByUserIdList(musicGroupId, studentIdList);
|
|
|
- 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("/"));
|
|
|
|
|
|
- //1、新建班级
|
|
|
- ClassGroup classGroup = new ClassGroup();
|
|
|
- classGroup.setMusicGroupId(classGroup4MixDto.getMusicGroupId());
|
|
|
- classGroup.setSubjectIdList(subjectIds);
|
|
|
- classGroup.setName(classGroup4MixDto.getClassGroupName());
|
|
|
- classGroup.setExpectStudentNum(studentList.size());
|
|
|
- classGroup.setStudentNum(studentList.size());
|
|
|
- classGroup.setType(ClassGroupTypeEnum.NORMAL);
|
|
|
- classGroup.setGroupType(GroupType.MUSIC);
|
|
|
- classGroup.setDelFlag(0);
|
|
|
- classGroup.setCreateTime(date);
|
|
|
- classGroup.setUpdateTime(date);
|
|
|
- classGroupDao.insert(classGroup);
|
|
|
-
|
|
|
-
|
|
|
- //2、将学生加入新班级(学生注册表,关联表
|
|
|
- List<ClassGroupStudentMapper> classGroupStudentMapperList = new ArrayList<>();
|
|
|
- for (StudentRegistration studentRegistration : studentList) {
|
|
|
- studentRegistration.setClassGroupId(classGroup.getId());
|
|
|
- studentRegistrationService.update(studentRegistration);
|
|
|
-
|
|
|
- ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
- classGroupStudentMapper.setClassGroupId(classGroup.getId());
|
|
|
- classGroupStudentMapper.setUserId(studentRegistration.getUserId());
|
|
|
- classGroupStudentMapper.setCreateTime(date);
|
|
|
- classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
- classGroupStudentMapper.setGroupType(GroupType.MUSIC);
|
|
|
- classGroupStudentMapperList.add(classGroupStudentMapper);
|
|
|
- }
|
|
|
- classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMapperList);
|
|
|
-
|
|
|
-
|
|
|
- //3、将老师加入关联关系
|
|
|
+ //1、跟新班级关联老师信息
|
|
|
List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroup4MixDto.getClassGroupTeacherMapperList();
|
|
|
-
|
|
|
- classGroupTeacherMapperList.forEach(classGroupTeacherMapper -> {
|
|
|
- classGroupTeacherMapper.setGroupType(classGroup.getGroupType());
|
|
|
- classGroupTeacherMapper.setClassGroupId(classGroup.getId());
|
|
|
- classGroupTeacherMapper.setMusicGroupId(classGroup4MixDto.getMusicGroupId());
|
|
|
- });
|
|
|
- classGroupTeacherMapperDao.classGroupTeachersInsert(classGroupTeacherMapperList);
|
|
|
+ if (classGroupTeacherMapperList != null && classGroupTeacherMapperList.size() > 0) {
|
|
|
+ classGroupTeacherMapperList.forEach(classGroupTeacherMapper -> {
|
|
|
+ classGroupTeacherMapper.setGroupType(classGroup.getGroupType());
|
|
|
+ classGroupTeacherMapper.setClassGroupId(classGroup.getId());
|
|
|
+ classGroupTeacherMapper.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
+ });
|
|
|
+ classGroupTeacherMapperDao.classGroupTeachersInsert(classGroupTeacherMapperList);
|
|
|
+ }
|
|
|
|
|
|
//5、插入班级排课信息
|
|
|
LocalDateTime now = LocalDate.parse(classGroup4MixDto.getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
|
|
@@ -1348,18 +1310,18 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
courseScheduleTeacherSalary.setUpdateTime(date);
|
|
|
courseScheduleTeacherSalaryList.add(courseScheduleTeacherSalary);
|
|
|
}
|
|
|
- for (StudentRegistration studentRegistration : studentList) {
|
|
|
- CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
|
|
|
- courseScheduleStudentPayment.setGroupType(classGroup.getGroupType());
|
|
|
- courseScheduleStudentPayment.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
- courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
|
|
|
- courseScheduleStudentPayment.setUserId(studentRegistration.getUserId());
|
|
|
- courseScheduleStudentPayment.setExpectPrice(expectPrice);
|
|
|
- courseScheduleStudentPayment.setCreateTime(date);
|
|
|
- courseScheduleStudentPayment.setUpdateTime(date);
|
|
|
- courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
|
|
|
- courseScheduleStudentPaymentList.add(courseScheduleStudentPayment);
|
|
|
- }
|
|
|
+// for (StudentRegistration studentRegistration : studentList) {
|
|
|
+// CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
|
|
|
+// courseScheduleStudentPayment.setGroupType(classGroup.getGroupType());
|
|
|
+// courseScheduleStudentPayment.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
+// courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
|
|
|
+// courseScheduleStudentPayment.setUserId(studentRegistration.getUserId());
|
|
|
+// courseScheduleStudentPayment.setExpectPrice(expectPrice);
|
|
|
+// courseScheduleStudentPayment.setCreateTime(date);
|
|
|
+// courseScheduleStudentPayment.setUpdateTime(date);
|
|
|
+// courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
|
|
|
+// courseScheduleStudentPaymentList.add(courseScheduleStudentPayment);
|
|
|
+// }
|
|
|
if (classGroup4MixDto.getCourseTimes().equals(times)) {
|
|
|
break WhileNode;
|
|
|
}
|
|
@@ -1373,13 +1335,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
//老师结算表
|
|
|
courseScheduleTeacherSalaryService.batchInsert(courseScheduleTeacherSalaryList);
|
|
|
|
|
|
- //加入合奏班
|
|
|
- ClassGroupRelation classGroupRelation = new ClassGroupRelation();
|
|
|
- classGroupRelation.setClassGroupId(classGroup4MixDto.getClassGroupId());
|
|
|
- classGroupRelation.setSubClassGroupId(classGroup.getId());
|
|
|
- classGroupRelation.setCreateTime(date);
|
|
|
- classGroupRelationService.insert(classGroupRelation);
|
|
|
-
|
|
|
//学生结算表
|
|
|
courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPaymentList);
|
|
|
return classGroup;
|