|
@@ -86,7 +86,7 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
private CourseScheduleDao courseScheduleDao;
|
|
|
@Autowired
|
|
|
private ClassGroupDao classGroupDao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
|
|
|
|
|
@@ -104,7 +104,7 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public boolean delClassGroupStudent(Integer userId, Integer classGroupId,Boolean quitMusicGroup) {
|
|
|
+ public boolean delClassGroupStudent(Integer userId, Integer classGroupId, Boolean quitMusicGroup) {
|
|
|
ClassGroup classGroup = classGroupService.get(classGroupId);
|
|
|
Integer studentNum = classGroupStudentMapperDao.countClassGroupNormalStudentNum(classGroupId);
|
|
|
/*if (!quitMusicGroup && classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) && studentNum <= 3) {
|
|
@@ -131,9 +131,9 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupId);
|
|
|
if (courseScheduleList.size() > 0) {
|
|
|
|
|
|
- List<Long> tempMergedCourseIdList = courseScheduleList.stream().map(CourseSchedule :: getId).collect(Collectors.toList());
|
|
|
- if(tempMergedCourseIdList != null && tempMergedCourseIdList.size() > 0){
|
|
|
- courseScheduleStudentPaymentDao.deleteStudentCourseSchedule(userId, tempMergedCourseIdList);
|
|
|
+ List<Long> tempMergedCourseIdList = courseScheduleList.stream().map(CourseSchedule::getId).collect(Collectors.toList());
|
|
|
+ if (tempMergedCourseIdList != null && tempMergedCourseIdList.size() > 0) {
|
|
|
+ courseScheduleStudentPaymentDao.deleteStudentCourseSchedule(userId, tempMergedCourseIdList);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -153,8 +153,8 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
}
|
|
|
Map<CourseSchedule.CourseScheduleType, TeacherDefaultMusicGroupSalary> collect = teacherSalaryList.stream().collect(Collectors.toMap(TeacherDefaultMusicGroupSalary::getCourseScheduleType, teacherDefaultMusicGroupSalary -> teacherDefaultMusicGroupSalary));
|
|
|
TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary = collect.get(CourseSchedule.CourseScheduleType.HIGH_ONLINE);
|
|
|
- if(studentNum>5){
|
|
|
- studentNum=5;
|
|
|
+ if (studentNum > 5) {
|
|
|
+ studentNum = 5;
|
|
|
}
|
|
|
BigDecimal salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum.toString());
|
|
|
|
|
@@ -321,8 +321,8 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
}
|
|
|
Map<CourseSchedule.CourseScheduleType, TeacherDefaultMusicGroupSalary> collect = teacherSalaryList.stream().collect(Collectors.toMap(TeacherDefaultMusicGroupSalary::getCourseScheduleType, teacherDefaultMusicGroupSalary -> teacherDefaultMusicGroupSalary));
|
|
|
TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary = collect.get(courseSchedule.getType());
|
|
|
- if(studentNum>5){
|
|
|
- studentNum=5;
|
|
|
+ if (studentNum > 5) {
|
|
|
+ studentNum = 5;
|
|
|
}
|
|
|
BigDecimal salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum.toString());
|
|
|
|
|
@@ -342,7 +342,7 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
courseScheduleTeacherSalaryService.batchInsert(courseScheduleTeacherSalaryList);
|
|
|
|
|
|
List<Integer> studentIds = userIdStrSet.stream().map(e -> Integer.parseInt(e)).collect(Collectors.toList());
|
|
|
- studentDao.updateStudentServiceTag(null,studentIds, YesOrNoEnum.YES.getCode());
|
|
|
+ studentDao.updateStudentServiceTag(null, studentIds, YesOrNoEnum.YES.getCode());
|
|
|
}
|
|
|
|
|
|
//乐团在合奏班
|
|
@@ -381,11 +381,11 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
public void updateClassGroupStudents(Long classGroupId, Set<Integer> studentIds) {
|
|
|
ClassGroup classGroup = classGroupDao.lockClassGroup(classGroupId.intValue());
|
|
|
- if(Objects.isNull(classGroup)){
|
|
|
+ if (Objects.isNull(classGroup)) {
|
|
|
throw new BizException("班级信息错误");
|
|
|
}
|
|
|
|
|
|
- if(ClassGroupTypeEnum.MUSIC_NETWORK.equals(classGroup.getType())){
|
|
|
+ if (ClassGroupTypeEnum.MUSIC_NETWORK.equals(classGroup.getType())) {
|
|
|
String subjectName = classGroup.getName().split("•")[0];
|
|
|
List<String> studentNames = studentDao.getStudentNames(new ArrayList<>(studentIds));
|
|
|
classGroup.setName(subjectName + "•" + studentNames);
|
|
@@ -393,17 +393,28 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
|
|
|
List<ClassGroupStudentMapper> classGroupStudents = classGroupStudentMapperDao.findAllByClassGroup(classGroupId);
|
|
|
|
|
|
+ if (classGroupStudents.size() <= 0 && (classGroup.getType().equals(ClassGroupTypeEnum.HIGH) ||
|
|
|
+ classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE))) {
|
|
|
+ String errTips = classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) ? "线上基础技能班" : "基础技能班";
|
|
|
+ if (studentIds.size() < 3) {
|
|
|
+ throw new BizException(errTips + "人数不能小于3人");
|
|
|
+ }
|
|
|
+ if (studentIds.size() > 6) {
|
|
|
+ throw new BizException(errTips + "人数不能大于6人");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Set<Integer> allStudentIds = new HashSet<>();
|
|
|
Set<Integer> oldStudentIds = new HashSet<>();
|
|
|
Set<Integer> oldNormalStudentIds = new HashSet<>();
|
|
|
Set<Integer> addStudentIds;
|
|
|
Set<Integer> removeStudentIds;
|
|
|
|
|
|
- if(!CollectionUtils.isEmpty(studentIds)){
|
|
|
+ if (!CollectionUtils.isEmpty(studentIds)) {
|
|
|
allStudentIds = studentIds;
|
|
|
}
|
|
|
|
|
|
- if(!CollectionUtils.isEmpty(classGroupStudents)){
|
|
|
+ if (!CollectionUtils.isEmpty(classGroupStudents)) {
|
|
|
oldStudentIds = classGroupStudents.stream().map(ClassGroupStudentMapper::getUserId).collect(Collectors.toSet());
|
|
|
oldNormalStudentIds = classGroupStudents.stream().filter(s -> ClassGroupStudentStatusEnum.NORMAL.equals(s.getStatus())).map(ClassGroupStudentMapper::getUserId).collect(Collectors.toSet());
|
|
|
}
|
|
@@ -415,24 +426,24 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
List<ClassGroupStudentMapper> needUpdateClassGroupStudents = new ArrayList<>();
|
|
|
|
|
|
for (ClassGroupStudentMapper classGroupStudent : classGroupStudents) {
|
|
|
- if(addStudentIds.contains(classGroupStudent.getUserId())&&!classGroupStudent.getStatus().equals(ClassGroupStudentStatusEnum.NORMAL)){
|
|
|
+ if (addStudentIds.contains(classGroupStudent.getUserId()) && !classGroupStudent.getStatus().equals(ClassGroupStudentStatusEnum.NORMAL)) {
|
|
|
classGroupStudent.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
- }else if(removeStudentIds.contains(classGroupStudent.getUserId())&&!classGroupStudent.getStatus().equals(ClassGroupStudentStatusEnum.QUIT)){
|
|
|
+ } else if (removeStudentIds.contains(classGroupStudent.getUserId()) && !classGroupStudent.getStatus().equals(ClassGroupStudentStatusEnum.QUIT)) {
|
|
|
classGroupStudent.setStatus(ClassGroupStudentStatusEnum.QUIT);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
continue;
|
|
|
}
|
|
|
needUpdateClassGroupStudents.add(classGroupStudent);
|
|
|
}
|
|
|
|
|
|
- if(!CollectionUtils.isEmpty(needUpdateClassGroupStudents)){
|
|
|
+ if (!CollectionUtils.isEmpty(needUpdateClassGroupStudents)) {
|
|
|
classGroupStudentMapperDao.batchUpdate(needUpdateClassGroupStudents);
|
|
|
}
|
|
|
|
|
|
Date now = new Date();
|
|
|
List<ClassGroupStudentMapper> classGroupStudentMappers = new ArrayList<>();
|
|
|
for (Integer addStudentId : addStudentIds) {
|
|
|
- if(oldStudentIds.contains(addStudentId)){
|
|
|
+ if (oldStudentIds.contains(addStudentId)) {
|
|
|
continue;
|
|
|
}
|
|
|
ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
@@ -452,11 +463,11 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
classGroupService.updateClassStudentNum(classGroupId.intValue(), allStudentIds.size());
|
|
|
|
|
|
List<CourseSchedule> classGroupNotStartCourse = courseScheduleDao.findCoursesByClassGroupId(classGroupId.intValue(), CourseStatusEnum.NOT_START);
|
|
|
- if(CollectionUtils.isEmpty(classGroupNotStartCourse)){
|
|
|
+ if (CollectionUtils.isEmpty(classGroupNotStartCourse)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if(ClassGroupTypeEnum.MUSIC_NETWORK.equals(classGroup.getType())){
|
|
|
+ if (ClassGroupTypeEnum.MUSIC_NETWORK.equals(classGroup.getType())) {
|
|
|
for (CourseSchedule courseSchedule : classGroupNotStartCourse) {
|
|
|
courseSchedule.setName(classGroup.getName());
|
|
|
}
|
|
@@ -467,7 +478,7 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
|
|
|
//4、调整未上课课酬
|
|
|
List<ClassGroupTeacherMapper> classGroupTeachers = classGroupTeacherMapperService.getClassGroupTeachers(classGroupId.intValue());
|
|
|
- if ((classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE)||classGroup.getType().equals(ClassGroupTypeEnum.HIGH)) && classGroupNotStartCourse.size() > 0) {
|
|
|
+ if ((classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) || classGroup.getType().equals(ClassGroupTypeEnum.HIGH)) && classGroupNotStartCourse.size() > 0) {
|
|
|
Date nowDate = new Date();
|
|
|
List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaryList = new ArrayList<>();
|
|
|
List<Long> courseScheduleIds = classGroupNotStartCourse.stream().map(CourseSchedule::getId).collect(Collectors.toList());
|
|
@@ -482,11 +493,11 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary = collect.get(CourseSchedule.CourseScheduleType.HIGH_ONLINE);
|
|
|
|
|
|
int studentNum = studentIds.size();
|
|
|
- if(studentNum>5){
|
|
|
- studentNum=5;
|
|
|
+ if (studentNum > 5) {
|
|
|
+ studentNum = 5;
|
|
|
}
|
|
|
|
|
|
- BigDecimal salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum+"");
|
|
|
+ BigDecimal salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum + "");
|
|
|
|
|
|
CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
|
|
|
courseScheduleTeacherSalary.setCourseScheduleId(courseSchedule.getId());
|
|
@@ -504,7 +515,7 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
courseScheduleTeacherSalaryService.batchInsert(courseScheduleTeacherSalaryList);
|
|
|
}
|
|
|
|
|
|
- if(!CollectionUtils.isEmpty(removeStudentIds)){
|
|
|
+ if (!CollectionUtils.isEmpty(removeStudentIds)) {
|
|
|
courseScheduleDao.deleteMusicGroupCourseSchedulesWithStudents(courseIds, new ArrayList<>(removeStudentIds));
|
|
|
List<ImGroupMember> imGroupMemberList = new ArrayList<>();
|
|
|
for (Integer addStudentId : addStudentIds) {
|
|
@@ -515,7 +526,7 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
imFeignService.groupQuit(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
|
|
|
}
|
|
|
|
|
|
- if(!CollectionUtils.isEmpty(addStudentIds)){
|
|
|
+ if (!CollectionUtils.isEmpty(addStudentIds)) {
|
|
|
courseScheduleStudentPaymentService.createForMusicGroup(classGroup.getMusicGroupId(), classGroupNotStartCourse, new ArrayList<>(addStudentIds));
|
|
|
List<ImGroupMember> imGroupMemberList = new ArrayList<>();
|
|
|
for (Integer addStudentId : addStudentIds) {
|