|  | @@ -1,83 +1,19 @@
 | 
	
		
			
				|  |  |  package com.ym.mec.biz.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import java.text.SimpleDateFormat;
 | 
	
		
			
				|  |  | -import java.util.ArrayList;
 | 
	
		
			
				|  |  | -import java.util.Collection;
 | 
	
		
			
				|  |  | -import java.util.Comparator;
 | 
	
		
			
				|  |  | -import java.util.Date;
 | 
	
		
			
				|  |  | -import java.util.HashMap;
 | 
	
		
			
				|  |  | -import java.util.HashSet;
 | 
	
		
			
				|  |  | -import java.util.List;
 | 
	
		
			
				|  |  | -import java.util.Map;
 | 
	
		
			
				|  |  | -import java.util.Objects;
 | 
	
		
			
				|  |  | -import java.util.Set;
 | 
	
		
			
				|  |  | -import java.util.TreeSet;
 | 
	
		
			
				|  |  | -import java.util.stream.Collectors;
 | 
	
		
			
				|  |  | -import java.util.stream.Stream;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import org.apache.commons.collections.ListUtils;
 | 
	
		
			
				|  |  | -import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | -import org.springframework.beans.BeanUtils;
 | 
	
		
			
				|  |  | -import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | -import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | -import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | -import org.springframework.util.CollectionUtils;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  |  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.auth.api.entity.SysUserRole;
 | 
	
		
			
				|  |  |  import com.ym.mec.auth.api.enums.SysUserType;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.ClassGroupDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.CourseScheduleComplaintsDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.CourseScheduleDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.StudentAttendanceDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.SubjectDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.SysConfigDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.TeacherAttendanceDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.TeacherDefaultVipGroupSalaryDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.VipGroupDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.CourseAttendanceDetailHeadInfoDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.CourseScheduleDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.IntegerAndIntegerListDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.Mapper;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.TeacherAttendanceDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.TeacherClassCourseSchudeleDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.ClassGroup;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.CourseSchedule;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.CourseScheduleComplaints;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.StudentAttendance;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.TeacherDefaultVipGroupSalary;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.VipGroup;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.AuditStatusEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.GroupType;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.ParamEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.TeachTypeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.VipGroupStatusEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.*;
 | 
	
		
			
				|  |  | +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.dal.page.CourseScheduleQueryInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.page.StudentCourseScheduleRecordQueryInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.page.VipGroupQueryInfo;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.ClassGroupService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.ClassGroupTeacherMapperService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.CourseScheduleService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.SysConfigService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.SysMessageService;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.service.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.dal.BaseDAO;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.exception.BizException;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.page.PageInfo;
 | 
	
	
		
			
				|  | @@ -85,6 +21,18 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 | 
	
		
			
				|  |  |  import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.collection.MapUtil;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.date.DateUtil;
 | 
	
		
			
				|  |  | +import org.apache.commons.collections.ListUtils;
 | 
	
		
			
				|  |  | +import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | +import org.springframework.beans.BeanUtils;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | +import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | +import org.springframework.util.CollectionUtils;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import java.text.SimpleDateFormat;
 | 
	
		
			
				|  |  | +import java.util.*;
 | 
	
		
			
				|  |  | +import java.util.stream.Collectors;
 | 
	
		
			
				|  |  | +import java.util.stream.Stream;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @Service
 | 
	
		
			
				|  |  |  public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSchedule>  implements CourseScheduleService {
 | 
	
	
		
			
				|  | @@ -208,6 +156,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 | 
	
		
			
				|  |  |          classGroupService.batchUpdateClassCourseTimes(classGroupIds);
 | 
	
		
			
				|  |  |          //创建学生单节课的缴费记录,乐团课的缴费为0
 | 
	
		
			
				|  |  |  		courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentByCourseSchedules(courseSchedules);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	@Override
 | 
	
	
		
			
				|  | @@ -290,7 +239,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 | 
	
		
			
				|  |  |  		Map<String,Object> result=new HashMap<>(3);
 | 
	
		
			
				|  |  |  		result.put("vipAppealDaysRange",sysConfigDao.findConfigValue(SysConfigService.VIP_APPEAL_DAYS_RANGE));
 | 
	
		
			
				|  |  |  		result.put("advanceLeaveHours",Integer.parseInt(sysConfigDao.findConfigValue(SysConfigService.ADVANCE_LEAVE_HOURS)));
 | 
	
		
			
				|  |  | -		List<CourseScheduleDto> studentCourseSchedulesWithDate = courseScheduleDao.getStudentCourseSchedulesWithDate(classDate, user.getId().longValue());
 | 
	
		
			
				|  |  | +//		List<Integer> quitClassGroupIds=classGroupStudentMapperDao.findClassGroupIdByUserAndCourseDateAndStatus(user.getId(),classDate, ClassGroupStudentStatusEnum.QUIT.getCode());
 | 
	
		
			
				|  |  | +		List<CourseScheduleDto> studentCourseSchedulesWithDate = courseScheduleDao.getStudentCourseSchedulesWithDate(classDate, user.getId().longValue(),null);
 | 
	
		
			
				|  |  |  		List<Long> courseScheduleIds = studentCourseSchedulesWithDate.stream()
 | 
	
		
			
				|  |  |  				.filter(cs -> cs.getType().equals(CourseSchedule.CourseScheduleType.VIP) || cs.getType().equals(CourseSchedule.CourseScheduleType.DEMO))
 | 
	
		
			
				|  |  |  				.map(CourseScheduleDto::getId).collect(Collectors.toList());
 | 
	
	
		
			
				|  | @@ -381,9 +331,16 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 | 
	
		
			
				|  |  |  	@Override
 | 
	
		
			
				|  |  |  	public void checkNewCourseSchedules(List<CourseSchedule> courseSchedules,boolean checkExistCourseSchedule){
 | 
	
		
			
				|  |  |  		//第一节课
 | 
	
		
			
				|  |  | -		CourseSchedule firstCourseSchedule = courseSchedules.stream().min(Comparator.comparing(CourseSchedule::getStartClassTime)).get();
 | 
	
		
			
				|  |  | +		CourseSchedule firstCourseSchedule;
 | 
	
		
			
				|  |  |  		//最后一节课
 | 
	
		
			
				|  |  | -		CourseSchedule latestCourseSchedule = courseSchedules.stream().max(Comparator.comparing(CourseSchedule::getStartClassTime)).get();
 | 
	
		
			
				|  |  | +		CourseSchedule latestCourseSchedule;
 | 
	
		
			
				|  |  | +		if(courseSchedules.size()==1){
 | 
	
		
			
				|  |  | +			firstCourseSchedule = courseSchedules.get(0);
 | 
	
		
			
				|  |  | +			latestCourseSchedule = courseSchedules.get(0);
 | 
	
		
			
				|  |  | +		}else{
 | 
	
		
			
				|  |  | +			firstCourseSchedule = courseSchedules.stream().min(Comparator.comparing(CourseSchedule::getStartClassTime)).get();
 | 
	
		
			
				|  |  | +			latestCourseSchedule = courseSchedules.stream().max(Comparator.comparing(CourseSchedule::getEndClassTime)).get();
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  |  		//获取第一节课和最后一节课所包含的时间段内已存在的课程
 | 
	
		
			
				|  |  |  		List<CourseSchedule> existCourseSchedules = courseScheduleDao.findByDateZone(firstCourseSchedule.getStartClassTime(), latestCourseSchedule.getEndClassTime());
 | 
	
		
			
				|  |  |  
 |