|
@@ -32,6 +32,7 @@ import com.yonge.cooleshow.common.page.PageInfo;
|
|
|
import com.yonge.toolset.utils.date.DateUtil;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
import org.redisson.api.RMap;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -216,7 +217,8 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
* <p> - teacherId 老师id
|
|
|
* <p> - year 年
|
|
|
* <p> - month 月
|
|
|
- * <p> - singleCourseMinutes 单课时时长(包含休息时间)
|
|
|
+ * <p> - singleCourseMinutes 单课时时长(不包含休息时间)
|
|
|
+ * <p> - freeCourseMinutes 单课时休息时长
|
|
|
* @return 返回传入时间当月每日的剩余时间段
|
|
|
*/
|
|
|
public List<CourseCalendarEntity> createLiveCourseCalendar(Map<String, Object> param) {
|
|
@@ -225,6 +227,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
Integer year = WrapperUtil.toInt(param, "year", "日历的时间年份不能为空!");
|
|
|
Integer month = WrapperUtil.toInt(param, "month", "日历的时间月份不能为空!");
|
|
|
Integer singleCourseMinutes = WrapperUtil.toInt(param, "singleCourseMinutes", "单课时时长不能为空!");
|
|
|
+ Integer freeCourseMinutes = WrapperUtil.toInt(param, "freeCourseMinutes");
|
|
|
if (singleCourseMinutes < 25) {
|
|
|
throw new BizException("单课时时长不能小于25分钟!");
|
|
|
}
|
|
@@ -235,7 +238,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
//获取老师的课程 key:日期-年月日 value:课程时间-开始时间,结束时间
|
|
|
Map<String, List<CourseTimeEntity>> nowCourseMap = getTeacherCourseTime(teacherId, firstDay.toString(), lastDay.toString());
|
|
|
//生成日历数据
|
|
|
- List<CourseCalendarEntity> courseCalendarEntities = generateCourseData(firstDay, lastDay, singleCourseMinutes);
|
|
|
+ List<CourseCalendarEntity> courseCalendarEntities = generateCourseData(firstDay, lastDay, singleCourseMinutes, freeCourseMinutes);
|
|
|
//对比课程数据,筛选出空余的课程时间
|
|
|
opsCourseCalendarData(nowCourseMap, courseCalendarEntities, 0);
|
|
|
return courseCalendarEntities;
|
|
@@ -314,8 +317,9 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
* @param firstDay 开始日期年月日
|
|
|
* @param lastDay 最后一天的日期年月日
|
|
|
* @param singleCourseMinutes 单结课时长
|
|
|
+ * @param freeCourseMinutes 单课时休息时长
|
|
|
*/
|
|
|
- public List<CourseCalendarEntity> generateCourseData(LocalDate firstDay, LocalDate lastDay, Integer singleCourseMinutes) {
|
|
|
+ public List<CourseCalendarEntity> generateCourseData(LocalDate firstDay, LocalDate lastDay, Integer singleCourseMinutes, Integer freeCourseMinutes) {
|
|
|
//获取上课的最早时间和最晚时间,将每日时间切片
|
|
|
String sysStartTime = sysConfigService.findConfigValue(SysConfigConstant.COURSE_START_SETTING);
|
|
|
String sysEndTime = sysConfigService.findConfigValue(SysConfigConstant.COURSE_END_SETTING);
|
|
@@ -329,7 +333,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
//每日日期数据
|
|
|
List<CourseCalendarEntity> list = new ArrayList<>();
|
|
|
//生成每日课程时间段 -根据单节课时长 及每日最早最晚时间 生成一天的时间切片
|
|
|
- List<CourseTimeEntity> dayTime = generateDayTime(singleCourseMinutes, dayStartTime, dayEndTime);
|
|
|
+ List<CourseTimeEntity> dayTime = generateDayTime(singleCourseMinutes, freeCourseMinutes, dayStartTime, dayEndTime);
|
|
|
int addDay = 0;
|
|
|
//获取每日日期数据
|
|
|
while (firstDay.isBefore(lastDay) || firstDay.isEqual(lastDay)) {
|
|
@@ -352,10 +356,11 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
* <p>根据单节课时长 及每日最早最晚时间 生成一天的时间切片
|
|
|
*
|
|
|
* @param singleCourseMinutes 单节课时长
|
|
|
+ * @param freeCourseMinutes 单课时休息时长
|
|
|
* @param startTime 每日最早上课时间
|
|
|
* @param endTime 每日最晚下课时间
|
|
|
*/
|
|
|
- public List<CourseTimeEntity> generateDayTime(Integer singleCourseMinutes, Date startTime, Date endTime) {
|
|
|
+ public List<CourseTimeEntity> generateDayTime(Integer singleCourseMinutes, Integer freeCourseMinutes, Date startTime, Date endTime) {
|
|
|
List<CourseTimeEntity> result = new ArrayList<>();
|
|
|
//划分每日课程时间
|
|
|
Date edate = startTime;
|
|
@@ -369,6 +374,8 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
//加时间得到课程结束时间
|
|
|
edate = DateUtil.addMinutes(edate, singleCourseMinutes);
|
|
|
timeEntity.setEndTime(edate);
|
|
|
+ //再加上单节课休息时间
|
|
|
+ edate = DateUtil.addMinutes(edate, freeCourseMinutes);
|
|
|
result.add(timeEntity);
|
|
|
}
|
|
|
}
|
|
@@ -741,13 +748,6 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
*/
|
|
|
@Override
|
|
|
public IPage<PracticeTeacherVo> teacherList(IPage<PracticeTeacherVo> page, PracticeTeacherSearch search) {
|
|
|
- String collation = search.getCollation();//排序规则
|
|
|
- String sortField = search.getSortField();//排序字段
|
|
|
- if (StringUtils.isNotBlank(sortField)) {
|
|
|
- if (StringUtils.isNotBlank(collation)) {
|
|
|
- search.setSort(sortField + " " + collation);
|
|
|
- } else search.setSort(sortField);
|
|
|
- }
|
|
|
return page.setRecords(baseMapper.teacherList(page, search));
|
|
|
}
|
|
|
|
|
@@ -976,4 +976,13 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
homePage.setVideoList(baseMapper.selectVideo());
|
|
|
return homePage;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 查询老师陪练课配置
|
|
|
+ * @Author: cy
|
|
|
+ * @Date: 2022/4/26
|
|
|
+ */
|
|
|
+ public TeacherSubjectPrice teacherSubjectPrice(Long teacherId,Long subjectId){
|
|
|
+ return teacherFreeTimeDao.selectSubjectPrice(teacherId,subjectId);
|
|
|
+ }
|
|
|
}
|