|
@@ -6,9 +6,7 @@ import com.ym.mec.biz.dal.dto.HighClassGroup;
|
|
import com.ym.mec.biz.dal.dto.TeacherMusicClassInfoDto;
|
|
import com.ym.mec.biz.dal.dto.TeacherMusicClassInfoDto;
|
|
import com.ym.mec.biz.dal.dto.TeacherVipClassInfoDto;
|
|
import com.ym.mec.biz.dal.dto.TeacherVipClassInfoDto;
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
-import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
|
|
|
|
-import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
|
|
|
|
-import com.ym.mec.biz.dal.enums.TeachTypeEnum;
|
|
|
|
|
|
+import com.ym.mec.biz.dal.enums.*;
|
|
import com.ym.mec.biz.dal.page.VipClassQueryInfo;
|
|
import com.ym.mec.biz.dal.page.VipClassQueryInfo;
|
|
import com.ym.mec.biz.service.*;
|
|
import com.ym.mec.biz.service.*;
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
@@ -20,7 +18,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
+import java.time.Instant;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
|
+import java.time.ZoneId;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -39,7 +40,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
@Autowired
|
|
@Autowired
|
|
private TeacherDefaultMusicGroupSalaryService teacherDefaultMusicGroupSalaryService;
|
|
private TeacherDefaultMusicGroupSalaryService teacherDefaultMusicGroupSalaryService;
|
|
@Autowired
|
|
@Autowired
|
|
- private MusicGroupService musicGroupService;
|
|
|
|
|
|
+ private CourseScheduleService courseScheduleService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public BaseDAO<Integer, ClassGroup> getDAO() {
|
|
public BaseDAO<Integer, ClassGroup> getDAO() {
|
|
@@ -148,7 +149,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public List<HighClassGroup> addHighClassGroup(List<HighClassGroup> highClassGroupList) throws Exception {
|
|
public List<HighClassGroup> addHighClassGroup(List<HighClassGroup> highClassGroupList) throws Exception {
|
|
- LocalDate now = LocalDate.now();
|
|
|
|
for (HighClassGroup highClassGroup : highClassGroupList) {
|
|
for (HighClassGroup highClassGroup : highClassGroupList) {
|
|
//1、插入班级信息
|
|
//1、插入班级信息
|
|
Date date;
|
|
Date date;
|
|
@@ -171,15 +171,36 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
classGroupTeacherMapperService.insert(classGroupTeacherMapper);
|
|
classGroupTeacherMapperService.insert(classGroupTeacherMapper);
|
|
|
|
|
|
//3、插入班级排课信息
|
|
//3、插入班级排课信息
|
|
|
|
+ List<CourseSchedule> courseScheduleList = new ArrayList<>();
|
|
int i = 0;
|
|
int i = 0;
|
|
|
|
+ LocalDateTime now = LocalDateTime.ofInstant(highClassGroup.getStartDate().toInstant(), ZoneId.systemDefault());
|
|
while (true) {
|
|
while (true) {
|
|
- int dayOfWeek = now.plusDays(1).getDayOfWeek().getValue();
|
|
|
|
- if (highClassGroup.getDayOfWeek().equals(dayOfWeek)) {
|
|
|
|
|
|
+ now = now.plusDays(i);
|
|
|
|
+ int dayOfWeek = now.getDayOfWeek().getValue();
|
|
|
|
|
|
|
|
+ if (highClassGroup.getDayOfWeek().equals(dayOfWeek)) {
|
|
|
|
+ CourseSchedule courseSchedule = new CourseSchedule();
|
|
|
|
+ Instant instant = now.atZone(ZoneId.systemDefault()).toInstant();
|
|
|
|
+ Date classDate = Date.from(instant);
|
|
|
|
+
|
|
|
|
+ courseSchedule.setClassGroupId(classGroupId.intValue());
|
|
|
|
+ courseSchedule.setStatus(CourseStatusEnum.NOT_START);
|
|
|
|
+ courseSchedule.setClassDate(classDate);
|
|
|
|
+ courseSchedule.setStartClassTime(highClassGroup.getStartClassTime());
|
|
|
|
+ courseSchedule.setEndClassTime(highClassGroup.getEndClassTime());
|
|
|
|
+ courseSchedule.setTeacherId(highClassGroup.getUserId().longValue());
|
|
|
|
+ courseSchedule.setActualTeacherId(highClassGroup.getUserId().longValue());
|
|
|
|
+ courseSchedule.setCreateTime(date);
|
|
|
|
+ courseSchedule.setUpdateTime(date);
|
|
|
|
+ courseSchedule.setTeachMode(TeachModeEnum.OFFLINE);
|
|
|
|
+ courseScheduleList.add(courseSchedule);
|
|
|
|
+ i++;
|
|
|
|
+ }
|
|
|
|
+ if (highClassGroup.getCourseTimes().equals(i)) {
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ courseScheduleService.batchAddCourseSchedule(courseScheduleList);
|
|
}
|
|
}
|
|
return highClassGroupList;
|
|
return highClassGroupList;
|
|
}
|
|
}
|
|
@@ -188,10 +209,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
public List<TeacherMusicClassInfoDto> getTeacherMusicClass(Integer teacherId) {
|
|
public List<TeacherMusicClassInfoDto> getTeacherMusicClass(Integer teacherId) {
|
|
List<TeacherMusicClassInfoDto> teacherMusicClassInfoDtos = classGroupDao.queryGroupCourses(teacherId);
|
|
List<TeacherMusicClassInfoDto> teacherMusicClassInfoDtos = classGroupDao.queryGroupCourses(teacherId);
|
|
Teacher teacher = teacherDao.get(teacherId);
|
|
Teacher teacher = teacherDao.get(teacherId);
|
|
- if(teacher == null){
|
|
|
|
|
|
+ if (teacher == null) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
- teacherMusicClassInfoDtos.forEach(e->{
|
|
|
|
|
|
+ teacherMusicClassInfoDtos.forEach(e -> {
|
|
e.setJobNature(teacher.getJobNature());
|
|
e.setJobNature(teacher.getJobNature());
|
|
});
|
|
});
|
|
return teacherMusicClassInfoDtos;
|
|
return teacherMusicClassInfoDtos;
|