|
@@ -3,22 +3,18 @@ package com.ym.mec.biz.service.impl;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
-import com.ym.mec.biz.dal.dao.CourseScheduleDao;
|
|
|
-import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
|
|
|
+import com.ym.mec.biz.dal.dao.*;
|
|
|
import com.ym.mec.biz.dal.dto.StudentClassInfoDto;
|
|
|
+import com.ym.mec.biz.dal.entity.CooperationOrgan;
|
|
|
import com.ym.mec.biz.dal.enums.FivePlusGradeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.GradeTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.SixPlusGradeEnum;
|
|
|
-import com.ym.mec.common.page.QueryInfo;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
-import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
|
|
|
-import com.ym.mec.biz.dal.dao.StudentDao;
|
|
|
import com.ym.mec.biz.dal.dto.StudentCourseTimesDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentTeacherCourseDto;
|
|
|
import com.ym.mec.biz.dal.entity.CourseSchedule;
|
|
@@ -44,6 +40,12 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
|
|
|
@Autowired
|
|
|
private StudentRegistrationDao studentRegistrationDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupDao musicGroupDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PracticeGroupDao practiceGroupDao;
|
|
|
+
|
|
|
@Override
|
|
|
public BaseDAO<Integer, Student> getDAO() {
|
|
|
return studentDao;
|
|
@@ -205,35 +207,50 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
|
|
|
@Override
|
|
|
public void updateStudentTeacherAndSubject() {
|
|
|
List<Student> noTeacherOrNoSubjectStudent = studentDao.getNoTeacherOrNoSubjectStudent();
|
|
|
- if(CollectionUtils.isEmpty(noTeacherOrNoSubjectStudent)){
|
|
|
+ if (CollectionUtils.isEmpty(noTeacherOrNoSubjectStudent)) {
|
|
|
return;
|
|
|
}
|
|
|
List<Integer> studentIds = noTeacherOrNoSubjectStudent.stream().map(Student::getUserId).collect(Collectors.toList());
|
|
|
List<StudentClassInfoDto> studentClassInfo = studentRegistrationDao.getStudentClassInfo(studentIds);
|
|
|
- if(CollectionUtils.isEmpty(studentClassInfo)){
|
|
|
+ if (CollectionUtils.isEmpty(studentClassInfo)) {
|
|
|
return;
|
|
|
}
|
|
|
List<Student> needUpdateStudents = new ArrayList<>();
|
|
|
Map<Integer, List<StudentClassInfoDto>> scm = studentClassInfo.stream().collect(Collectors.groupingBy(StudentClassInfoDto::getStudentId));
|
|
|
for (Student student : noTeacherOrNoSubjectStudent) {
|
|
|
- if(!scm.containsKey(student.getUserId())){
|
|
|
+ if (!scm.containsKey(student.getUserId())) {
|
|
|
continue;
|
|
|
}
|
|
|
List<StudentClassInfoDto> studentClassInfoDtos = scm.get(student.getUserId());
|
|
|
StudentClassInfoDto studentClassInfoDto = studentClassInfoDtos.stream().max(Comparator.comparing(StudentClassInfoDto::getClassGroupId)).get();
|
|
|
- if(Objects.isNull(student.getTeacherId())){
|
|
|
+ if (Objects.isNull(student.getTeacherId())) {
|
|
|
student.setTeacherId(studentClassInfoDto.getMainTeacherId());
|
|
|
}
|
|
|
- if(StringUtils.isBlank(student.getSubjectIdList())){
|
|
|
+ if (StringUtils.isBlank(student.getSubjectIdList())) {
|
|
|
student.setSubjectIdList(studentClassInfoDto.getSubjectId().toString());
|
|
|
}
|
|
|
- if(Objects.isNull(student.getCooperationOrganId())){
|
|
|
+ if (Objects.isNull(student.getCooperationOrganId())) {
|
|
|
student.setCooperationOrganId(studentClassInfoDto.getCooperationOrganId());
|
|
|
}
|
|
|
needUpdateStudents.add(student);
|
|
|
}
|
|
|
- if(!CollectionUtils.isEmpty(needUpdateStudents)){
|
|
|
+ if (!CollectionUtils.isEmpty(needUpdateStudents)) {
|
|
|
studentDao.batchUpdate(needUpdateStudents);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CooperationOrgan getStudentEduTeacher(Integer userId) {
|
|
|
+ CooperationOrgan cooperationOrgan = musicGroupDao.findUserMusicGroupCooperationOrgan(userId);
|
|
|
+ if (cooperationOrgan != null) {
|
|
|
+ return cooperationOrgan;
|
|
|
+ }
|
|
|
+ cooperationOrgan = new CooperationOrgan();
|
|
|
+ String studentEduTeacher = courseScheduleStudentPaymentDao.getStudentEduTeacher(userId);
|
|
|
+ if (studentEduTeacher == null) {
|
|
|
+ studentEduTeacher = practiceGroupDao.getStudentEduTeacher(userId);
|
|
|
+ }
|
|
|
+ cooperationOrgan.setLinkman(studentEduTeacher);
|
|
|
+ return cooperationOrgan;
|
|
|
+ }
|
|
|
}
|