|
@@ -1,13 +1,16 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
|
-import com.ym.mec.biz.dal.dto.CourseTimeDto;
|
|
|
-import com.ym.mec.biz.dal.dto.OnlineMusicGroupCourseDto;
|
|
|
+import com.ym.mec.biz.dal.dto.*;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
|
import com.ym.mec.biz.service.CourseScheduleService;
|
|
|
+import com.ym.mec.biz.service.EduPracticeGroupService;
|
|
|
import com.ym.mec.biz.service.OnlineMusicGroupService;
|
|
|
import com.ym.mec.biz.service.SysConfigService;
|
|
|
import com.ym.mec.common.constant.CommonConstants;
|
|
@@ -18,10 +21,14 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Isolation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.time.LocalDateTime;
|
|
|
+import java.time.*;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
+import java.time.temporal.WeekFields;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@Service
|
|
@@ -55,10 +62,16 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
|
|
|
private TeacherAttendanceDao teacherAttendanceDao;
|
|
|
@Autowired
|
|
|
private TeacherDefaultMusicGroupSalaryDao teacherDefaultMusicGroupSalaryDao;
|
|
|
+ @Autowired
|
|
|
+ private SysUserFeignService sysUserFeignService;
|
|
|
+ @Autowired
|
|
|
+ private TeacherFreeTimeDao teacherFreeTimeDao;
|
|
|
+ @Autowired
|
|
|
+ private EduPracticeGroupService eduPracticeGroupService;
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.DEFAULT)
|
|
|
@Override
|
|
|
- public void createOnlineMusicClassGroup(OnlineMusicGroupCourseDto onlineMusicGroupCourseInfo) {
|
|
|
+ public Map<String, Object> createOnlineMusicClassGroup(OnlineMusicGroupCourseDto onlineMusicGroupCourseInfo) {
|
|
|
if(Objects.isNull(onlineMusicGroupCourseInfo.getMusicGroupId())){
|
|
|
throw new BizException("请指定乐团");
|
|
|
}
|
|
@@ -148,7 +161,7 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
|
|
|
courseSchedule.setTeachMode(TeachModeEnum.ONLINE);
|
|
|
courseSchedule.setType(CourseSchedule.CourseScheduleType.MUSIC_NETWORK);
|
|
|
courseSchedule.setGroupType(GroupType.MUSIC);
|
|
|
- courseSchedule.setIsLock(1);
|
|
|
+ courseSchedule.setIsLock(0);
|
|
|
courseSchedule.setOrganId(student.getOrganId());
|
|
|
}
|
|
|
courseScheduleDao.batchAddCourseSchedules(courses);
|
|
@@ -195,5 +208,314 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
|
|
|
courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
|
|
|
teacherAttendanceDao.batchInsert(teacherAttendances);
|
|
|
|
|
|
+ List<String> courseTimes = courses.stream().map(c -> DateUtil.dateToString(c.getStartClassTime(), "yyyy-MM-dd HH:mm:ss")).collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<String, Object> result=new HashMap<>();
|
|
|
+ result.put("courseTimes", StringUtils.join(courses,","));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<SimpleUserDto> getEnableApplyTeachers(Integer studentId, Integer subjectId) {
|
|
|
+ if (Objects.isNull(subjectId)) {
|
|
|
+ throw new BizException("请选择声部");
|
|
|
+ }
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserById(studentId);
|
|
|
+ if (Objects.isNull(sysUser)) {
|
|
|
+ throw new BizException("用户不存在");
|
|
|
+ }
|
|
|
+ if (Objects.isNull(sysUser.getOrganId())) {
|
|
|
+ throw new BizException("未找到用户分部属性");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Integer> includeTeacherIds = new ArrayList<>();
|
|
|
+ List<ExtendTeacherBasicDto> organAndSubjectTeachers = teacherDao.findTeaTeachersByOrganAndSubject2(sysUser.getOrganId(), subjectId);
|
|
|
+ if (CollectionUtils.isEmpty(organAndSubjectTeachers)) {
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Integer> allTeacherIds = organAndSubjectTeachers.stream().map(TeacherBasicDto::getId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<CourseSchedule> userCourses = courseScheduleDao.findUserCourses2(studentId, allTeacherIds);
|
|
|
+
|
|
|
+ if (!CollectionUtils.isEmpty(userCourses)) {
|
|
|
+ Map<GroupType, List<CourseSchedule>> courseTypeCourseMap = userCourses.stream().collect(Collectors.groupingBy(CourseSchedule::getGroupType));
|
|
|
+
|
|
|
+ List<CourseSchedule> practiceCourses = courseTypeCourseMap.get(GroupType.MUSIC);
|
|
|
+ if (!CollectionUtils.isEmpty(practiceCourses)) {
|
|
|
+ for (CourseSchedule practiceCourse : practiceCourses) {
|
|
|
+ if (!includeTeacherIds.contains(practiceCourse.getTeacherId())) {
|
|
|
+ includeTeacherIds.add(practiceCourse.getTeacherId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<CourseSchedule> vipCourses = courseTypeCourseMap.get(GroupType.VIP);
|
|
|
+ if (!CollectionUtils.isEmpty(vipCourses)) {
|
|
|
+ for (CourseSchedule vipCourse : vipCourses) {
|
|
|
+ if (!includeTeacherIds.contains(vipCourse.getTeacherId())) {
|
|
|
+ includeTeacherIds.add(vipCourse.getTeacherId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<CourseSchedule> singleCourses = courseTypeCourseMap.get(GroupType.MUSIC);
|
|
|
+ if (!CollectionUtils.isEmpty(singleCourses)) {
|
|
|
+ for (CourseSchedule singleCourse : singleCourses) {
|
|
|
+ if (!includeTeacherIds.contains(singleCourse.getTeacherId())) {
|
|
|
+ includeTeacherIds.add(singleCourse.getTeacherId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (ExtendTeacherBasicDto organAndSubjectTeacher : organAndSubjectTeachers) {
|
|
|
+ if (!includeTeacherIds.contains(organAndSubjectTeacher.getId())
|
|
|
+ && 1 == organAndSubjectTeacher.getIsSupportExtraPracticeLesson()) {
|
|
|
+ includeTeacherIds.add(organAndSubjectTeacher.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(new ArrayList<>(includeTeacherIds))) {
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ List<SimpleUserDto> userInfos = new ArrayList<>();
|
|
|
+ Map<Integer, ExtendTeacherBasicDto> idTeacherMap = organAndSubjectTeachers.stream().collect(Collectors.toMap(ExtendTeacherBasicDto::getId, teacher -> teacher));
|
|
|
+ for (Integer includeTeacherId : includeTeacherIds) {
|
|
|
+ ExtendTeacherBasicDto teacher = idTeacherMap.get(includeTeacherId);
|
|
|
+ SimpleUserDto simpleUserDto=new SimpleUserDto(includeTeacherId, teacher.getRealName());
|
|
|
+ simpleUserDto.setAvatar(teacher.getAvatar());
|
|
|
+ simpleUserDto.setIntroduction(teacher.getIntroduction());
|
|
|
+ simpleUserDto.setSubjectNames(teacher.getSubjectNames());
|
|
|
+ userInfos.add(simpleUserDto);
|
|
|
+ }
|
|
|
+
|
|
|
+ return userInfos;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map getTeacherFreeTimes(Integer studentId, Integer teacherId) {
|
|
|
+ if (Objects.isNull(teacherId)) {
|
|
|
+ throw new BizException("请选择教师");
|
|
|
+ }
|
|
|
+ SysUser student = sysUserFeignService.queryUserById(studentId);
|
|
|
+ if (Objects.isNull(student)) {
|
|
|
+ throw new BizException("用户不存在");
|
|
|
+ }
|
|
|
+ if (Objects.isNull(student.getOrganId())) {
|
|
|
+ throw new BizException("未找到用户分部属性");
|
|
|
+ }
|
|
|
+ Teacher teacher = teacherDao.get(teacherId);
|
|
|
+ if (Objects.isNull(teacher)) {
|
|
|
+ throw new BizException("教师不存在");
|
|
|
+ }
|
|
|
+ Map result = new HashMap();
|
|
|
+ Set<Integer> disableApplyWeekDay = new HashSet<>();
|
|
|
+
|
|
|
+ //课程时长暂时与网管课共用
|
|
|
+ SysConfig practiceCourseMinutesConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
|
|
|
+ Integer practiceCourseMinutes = practiceCourseMinutesConfig.getParanValue(Integer.class);
|
|
|
+
|
|
|
+ boolean checkTeacherLeaveDate = true;
|
|
|
+ SysConfig allTeacherLeaveDataConfig = sysConfigService.findByParamName(SysConfigService.TEACHER_LEAVE_DATA);
|
|
|
+ JSONObject allTeacherLeaveData = JSONObject.parseObject(allTeacherLeaveDataConfig.getParanValue());
|
|
|
+ if (Objects.isNull(allTeacherLeaveData)) {
|
|
|
+ checkTeacherLeaveDate = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ TeacherFreeTime teacherFreeTime = teacherFreeTimeDao.findTeacherFreeTime(teacherId);
|
|
|
+ JSONObject teacherFreeTimes=new JSONObject();
|
|
|
+ int holiday = 0;
|
|
|
+ if (Objects.nonNull(teacherFreeTime)) {
|
|
|
+ if (Objects.nonNull(teacherFreeTime.getHoliday())) {
|
|
|
+ holiday = teacherFreeTime.getHoliday();
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(teacherFreeTime.getMonday())){
|
|
|
+ teacherFreeTimes.put(String.valueOf(DayOfWeek.MONDAY.getValue()), JSON.parseArray(teacherFreeTime.getMonday()));
|
|
|
+ }else{
|
|
|
+ disableApplyWeekDay.add(DayOfWeek.MONDAY.getValue());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(teacherFreeTime.getTuesday())){
|
|
|
+ teacherFreeTimes.put(String.valueOf(DayOfWeek.TUESDAY.getValue()), JSON.parseArray(teacherFreeTime.getTuesday()));
|
|
|
+ }else{
|
|
|
+ disableApplyWeekDay.add(DayOfWeek.TUESDAY.getValue());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(teacherFreeTime.getWednesday())){
|
|
|
+ teacherFreeTimes.put(String.valueOf(DayOfWeek.WEDNESDAY.getValue()), JSON.parseArray(teacherFreeTime.getWednesday()));
|
|
|
+ }else{
|
|
|
+ disableApplyWeekDay.add(DayOfWeek.WEDNESDAY.getValue());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(teacherFreeTime.getThursday())){
|
|
|
+ teacherFreeTimes.put(String.valueOf(DayOfWeek.THURSDAY.getValue()), JSON.parseArray(teacherFreeTime.getThursday()));
|
|
|
+ }else{
|
|
|
+ disableApplyWeekDay.add(DayOfWeek.THURSDAY.getValue());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(teacherFreeTime.getFriday())){
|
|
|
+ teacherFreeTimes.put(String.valueOf(DayOfWeek.FRIDAY.getValue()), JSON.parseArray(teacherFreeTime.getFriday()));
|
|
|
+ }else{
|
|
|
+ disableApplyWeekDay.add(DayOfWeek.FRIDAY.getValue());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(teacherFreeTime.getSaturday())){
|
|
|
+ teacherFreeTimes.put(String.valueOf(DayOfWeek.SATURDAY.getValue()), JSON.parseArray(teacherFreeTime.getSaturday()));
|
|
|
+ }else{
|
|
|
+ disableApplyWeekDay.add(DayOfWeek.SATURDAY.getValue());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(teacherFreeTime.getSunday())){
|
|
|
+ teacherFreeTimes.put(String.valueOf(DayOfWeek.SUNDAY.getValue()), JSON.parseArray(teacherFreeTime.getSunday()));
|
|
|
+ }else{
|
|
|
+ disableApplyWeekDay.add(DayOfWeek.SUNDAY.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ DateTimeFormatter ddtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ DateTimeFormatter ddf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
+ DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm:ss");
|
|
|
+ WeekFields weekFields = WeekFields.of(DayOfWeek.MONDAY, 1);
|
|
|
+ ZoneId zoneId = ZoneId.systemDefault();
|
|
|
+
|
|
|
+ LocalDate startDay = LocalDate.now().plusDays(1);
|
|
|
+ LocalDate endDay = startDay.plusDays(14);
|
|
|
+
|
|
|
+ Map<Integer, List<String>> weekNumApplyTimesMap = eduPracticeGroupService.getEnableApplyDatesWithWeek(startDay.getDayOfWeek().getValue());
|
|
|
+ List<CourseSchedule> allTeacherCourses = courseScheduleDao.findTeacherCoursesWithDateRangeWithoutMusicGroup(teacherId, Date.from(startDay.atStartOfDay(zoneId).toInstant()), Date.from(endDay.atStartOfDay(zoneId).toInstant()));
|
|
|
+ allTeacherCourses.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
|
|
|
+
|
|
|
+ JSONObject teacherLeaveData = null;
|
|
|
+ if (checkTeacherLeaveDate) {
|
|
|
+ teacherLeaveData = allTeacherLeaveData.getJSONObject(teacherId.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Objects.isNull(teacherLeaveData)) {
|
|
|
+ checkTeacherLeaveDate = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ weekNumApplyTimesMap.remove(holiday);
|
|
|
+
|
|
|
+ if (teacherId == 100473) {
|
|
|
+ List<String> timeStrs = weekNumApplyTimesMap.get(DateUtil.calendarWeekNumNormalWeekNumMap.get(Calendar.MONDAY));
|
|
|
+ LocalTime noonStartTime = LocalTime.parse("11:30:00", dtf);
|
|
|
+ LocalTime noonEndTime = LocalTime.parse("14:30:00", dtf);
|
|
|
+ LocalTime nightStartTime = LocalTime.parse("20:30:00", dtf);
|
|
|
+ LocalTime defaultApplyTime;
|
|
|
+ Iterator<String> iterator = timeStrs.iterator();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ defaultApplyTime = LocalTime.parse(iterator.next(), dtf);
|
|
|
+ LocalTime defaultApplyEndTime = defaultApplyTime.plusMinutes(practiceCourseMinutes);
|
|
|
+ if (defaultApplyTime.compareTo(noonStartTime) <= 0
|
|
|
+ && defaultApplyEndTime.compareTo(noonEndTime) >= 0) {
|
|
|
+ iterator.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (defaultApplyEndTime.compareTo(nightStartTime) < 0) {
|
|
|
+ iterator.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ weekNumApplyTimesMap.remove(DateUtil.calendarWeekNumNormalWeekNumMap.get(Calendar.SATURDAY));
|
|
|
+ weekNumApplyTimesMap.put(DateUtil.calendarWeekNumNormalWeekNumMap.get(Calendar.MONDAY), timeStrs);
|
|
|
+ weekNumApplyTimesMap.put(DateUtil.calendarWeekNumNormalWeekNumMap.get(Calendar.SUNDAY), timeStrs);
|
|
|
+ } else if (checkTeacherLeaveDate) {
|
|
|
+ for (String dateStr : teacherLeaveData.keySet()) {
|
|
|
+ LocalDate parse = LocalDate.parse(dateStr, ddf);
|
|
|
+ LocalDate tempDate = LocalDate.parse(dateStr, ddf);
|
|
|
+ if (tempDate.compareTo(startDay)<0
|
|
|
+ ||tempDate.compareTo(tempDate)>=0){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<String> applyTimeStrs = weekNumApplyTimesMap.get(parse.getDayOfWeek().getValue());
|
|
|
+ if(CollectionUtils.isEmpty(applyTimeStrs)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Iterator<String> iterator = applyTimeStrs.iterator();
|
|
|
+ JSONObject leaveDateData = teacherLeaveData.getJSONObject(dateStr);
|
|
|
+ LocalTime leaveStartTime = LocalDateTime.parse(leaveDateData.getString("leave_start_time"), ddtf).toLocalTime();
|
|
|
+ LocalTime leaveEndTime = LocalDateTime.parse(leaveDateData.getString("leave_end_time"), ddtf).toLocalTime();
|
|
|
+ LocalTime defaultApplyTime;
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ defaultApplyTime = LocalTime.parse(iterator.next(), dtf);
|
|
|
+ LocalTime defaultApplyEndTime = defaultApplyTime.plusMinutes(practiceCourseMinutes);
|
|
|
+ if (defaultApplyTime.compareTo(leaveEndTime) <= 0
|
|
|
+ && defaultApplyEndTime.compareTo(leaveStartTime) >= 0) {
|
|
|
+ iterator.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!CollectionUtils.isEmpty(applyTimeStrs)){
|
|
|
+ weekNumApplyTimesMap.put(parse.getDayOfWeek().getValue(), applyTimeStrs);
|
|
|
+ }else{
|
|
|
+ weekNumApplyTimesMap.remove(parse.getDayOfWeek().getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Iterator<Integer> weekNumApplyTimeIterator = weekNumApplyTimesMap.keySet().iterator();
|
|
|
+ while (weekNumApplyTimeIterator.hasNext()) {
|
|
|
+ Integer weekNum=weekNumApplyTimeIterator.next();
|
|
|
+ JSONArray teacherWeekDayFreeTimes = teacherFreeTimes.getJSONArray(String.valueOf(weekNum));
|
|
|
+ if(Objects.nonNull(teacherWeekDayFreeTimes)){
|
|
|
+ List<String> applyTimeStrs = weekNumApplyTimesMap.get(weekNum);
|
|
|
+ if(CollectionUtils.isEmpty(applyTimeStrs)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Iterator<String> iterator = applyTimeStrs.iterator();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ LocalTime enableApplyStartTime=LocalTime.parse(iterator.next(), dtf);
|
|
|
+ LocalTime enableApplyEndTime=enableApplyStartTime.plusMinutes(practiceCourseMinutes);
|
|
|
+ boolean isInclude=false;
|
|
|
+ for (Object teacherWeekDayFreeTimeObject : teacherWeekDayFreeTimes) {
|
|
|
+ JSONObject teacherWeekDayFreeTime=JSONObject.parseObject(teacherWeekDayFreeTimeObject.toString());
|
|
|
+ LocalTime teacherFreeStartTime=LocalTime.parse(teacherWeekDayFreeTime.getString("startTime"),DateUtil.timeFormatter);
|
|
|
+ LocalTime teacherFreeEndTime=LocalTime.parse(teacherWeekDayFreeTime.getString("endTime"),DateUtil.timeFormatter);
|
|
|
+ if(enableApplyEndTime.compareTo(teacherFreeEndTime)<=0
|
|
|
+ &&enableApplyStartTime.compareTo(teacherFreeStartTime)>=0){
|
|
|
+ isInclude=true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!isInclude){
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(CollectionUtils.isEmpty(applyTimeStrs)){
|
|
|
+ weekNumApplyTimeIterator.remove();
|
|
|
+ }else{
|
|
|
+ weekNumApplyTimesMap.put(weekNum,applyTimeStrs);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ weekNumApplyTimeIterator.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(allTeacherCourses)) {
|
|
|
+ result.put("teacherFreeDays", weekNumApplyTimesMap);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (CourseSchedule teacherCourse : allTeacherCourses) {
|
|
|
+ LocalDateTime courseStartTime = LocalDateTime.ofInstant(teacherCourse.getStartClassTime().toInstant(), zoneId);
|
|
|
+ LocalDateTime courseEndTime = LocalDateTime.ofInstant(teacherCourse.getEndClassTime().toInstant(), zoneId);
|
|
|
+ List<String> applyTimeStrs = weekNumApplyTimesMap.get(courseStartTime.getDayOfWeek().getValue());
|
|
|
+ if (CollectionUtils.isEmpty(applyTimeStrs)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Iterator<String> iterator = applyTimeStrs.iterator();
|
|
|
+ LocalTime defaultApplyTime;
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ defaultApplyTime = LocalTime.parse(iterator.next(), dtf);
|
|
|
+ LocalTime defaultApplyEndTime = defaultApplyTime.plusMinutes(practiceCourseMinutes);
|
|
|
+ if (defaultApplyTime.compareTo(courseEndTime.toLocalTime()) <= 0
|
|
|
+ && defaultApplyEndTime.compareTo(courseStartTime.toLocalTime()) >= 0) {
|
|
|
+ iterator.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(CollectionUtils.isEmpty(applyTimeStrs)){
|
|
|
+ weekNumApplyTimesMap.remove(courseStartTime.getDayOfWeek().getValue());
|
|
|
+ }else{
|
|
|
+ weekNumApplyTimesMap.put(courseStartTime.getDayOfWeek().getValue(), applyTimeStrs);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.put("teacherFreeDays", weekNumApplyTimesMap);
|
|
|
+ return result;
|
|
|
}
|
|
|
}
|