Forráskód Böngészése

增加 学生购买老师陪练课课程日历查询

hgw 3 éve
szülő
commit
d7496cc0b1

+ 9 - 5
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleDao.java

@@ -42,12 +42,16 @@ public interface CourseScheduleDao extends BaseMapper<CourseSchedule> {
     List<StudentTotalVo> queryStudentTotal();
 
     /**
-     * 根据学生id查询大于当前时间并未开始的课程
-     *
-     * @param studentId 学生id
-     * @param classDate 年月日
+     * 根据学生id查询课程
+     * @param param 传入参数
+     *              <p> - studentId 学生id
+     *              <p> - status 课程状态 NOT_START未开始 ING进行中 COMPLETE已完成
+     *              <p> - classDate  年月日
+     *              <p> - startClassDate 开始时间-年月日
+     *              <p> - endClassDate 结束时间-年月日
+     *              <p> - greaterDate 上课时间大于该时间-年月日时分秒
      */
-    List<CourseSchedule> queryStudentCourse(@Param("studentId") Long studentId, @Param("classDate") String classDate);
+    List<CourseSchedule> queryStudentCourse(@Param("param") Map<String, Object> param);
 
     /**
      * 查询老师直播课程

+ 9 - 21
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/CourseCalendarEntity.java

@@ -19,16 +19,15 @@ public class CourseCalendarEntity implements Serializable {
     @ApiModelProperty(value = "是否是节假日  0:不是 1是")
     private Integer holiday;
 
+    @ApiModelProperty(value = "是否跳过节假日  0:不跳过 1跳过")
+    private Integer skipHoliday;
+
     @ApiModelProperty(value = "当日课程是否排满  0:未满 1满")
     private Integer fullCourse;
 
     @ApiModelProperty(value = "当日课程时间-满课或跳过节假日的无数据")
     private List<CourseTimeEntity> courseTime;
 
-    public static CourseCalendarEntity build() {
-        return new CourseCalendarEntity();
-    }
-
     public String getDate() {
         return date;
     }
@@ -37,11 +36,6 @@ public class CourseCalendarEntity implements Serializable {
         this.date = date;
     }
 
-    public CourseCalendarEntity date(String date) {
-        this.date = date;
-        return this;
-    }
-
     public Integer getHoliday() {
         return holiday;
     }
@@ -50,10 +44,6 @@ public class CourseCalendarEntity implements Serializable {
         this.holiday = holiday;
     }
 
-    public CourseCalendarEntity holiday(Integer holiday) {
-        this.holiday = holiday;
-        return this;
-    }
 
     public Integer getFullCourse() {
         return fullCourse;
@@ -63,11 +53,6 @@ public class CourseCalendarEntity implements Serializable {
         this.fullCourse = fullCourse;
     }
 
-    public CourseCalendarEntity fullCourse(Integer fullCourse) {
-        this.fullCourse = fullCourse;
-        return this;
-    }
-
     public List<CourseTimeEntity> getCourseTime() {
         return courseTime;
     }
@@ -76,8 +61,11 @@ public class CourseCalendarEntity implements Serializable {
         this.courseTime = courseTime;
     }
 
-    public CourseCalendarEntity courseTime(List<CourseTimeEntity> courseTime) {
-        this.courseTime = courseTime;
-        return this;
+    public Integer getSkipHoliday() {
+        return skipHoliday;
+    }
+
+    public void setSkipHoliday(Integer skipHoliday) {
+        this.skipHoliday = skipHoliday;
     }
 }

+ 13 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/CourseScheduleService.java

@@ -120,6 +120,19 @@ public interface CourseScheduleService extends IService<CourseSchedule> {
      */
     List<CourseCalendarEntity> createLiveCourseCalendar(Map<String, Object> param);
 
+    /**
+     * 生成陪练课日历-用于学生购买指定老师陪练课
+     *
+     * @param param 传入参数
+     *              <p> - teacherId 老师id
+     *              <p> - studentId 学生id
+     *              <p> - year 年
+     *              <p> - month 月
+     *              <p> - day 日
+     * @return 返回传入时间当月每日的剩余时间段
+     */
+    List<CourseCalendarEntity> createPracticeCourseCalender(Map<String, Object> param);
+
     IPage<MyCourseVo> myCourse(IPage<MyCourseVo> page, MyCourseSearch search);
 }
 

+ 193 - 47
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java

@@ -1,26 +1,25 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
-import com.yonge.cooleshow.biz.dal.dto.search.MyCourseSearch;
-import com.yonge.cooleshow.biz.dal.vo.MyCourseVo;
-import com.yonge.cooleshow.common.constant.SysConfigConstant;
 import com.yonge.cooleshow.biz.dal.dao.CourseScheduleDao;
-import com.yonge.cooleshow.biz.dal.entity.CourseCalendarEntity;
-import com.yonge.cooleshow.biz.dal.entity.CourseSchedule;
-import com.yonge.cooleshow.biz.dal.entity.CourseTimeEntity;
-import com.yonge.cooleshow.biz.dal.entity.HolidaysFestivals;
+import com.yonge.cooleshow.biz.dal.dto.search.MyCourseSearch;
+import com.yonge.cooleshow.biz.dal.entity.*;
 import com.yonge.cooleshow.biz.dal.enums.CourseScheduleEnum;
 import com.yonge.cooleshow.biz.dal.service.CourseScheduleService;
 import com.yonge.cooleshow.biz.dal.service.HolidaysFestivalsService;
 import com.yonge.cooleshow.biz.dal.service.SysConfigService;
+import com.yonge.cooleshow.biz.dal.service.TeacherFreeTimeService;
 import com.yonge.cooleshow.biz.dal.support.PageUtil;
 import com.yonge.cooleshow.biz.dal.support.WrapperUtil;
+import com.yonge.cooleshow.biz.dal.vo.MyCourseVo;
 import com.yonge.cooleshow.biz.dal.vo.TeacherLiveCourseInfoVo;
+import com.yonge.cooleshow.common.constant.SysConfigConstant;
 import com.yonge.cooleshow.common.exception.BizException;
 import com.yonge.cooleshow.common.page.PageInfo;
 import com.yonge.toolset.utils.date.DateUtil;
@@ -37,6 +36,7 @@ import javax.validation.Valid;
 import java.time.LocalDate;
 import java.time.temporal.TemporalAdjusters;
 import java.util.*;
+import java.util.function.BiConsumer;
 import java.util.function.Function;
 
 /**
@@ -57,6 +57,8 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
     private HolidaysFestivalsService holidaysFestivalsService;
     @Autowired
     private SysConfigService sysConfigService;
+    @Autowired
+    private TeacherFreeTimeService teacherFreeTimeService;
 
     @Override
     public CourseScheduleDao getDao() {
@@ -108,7 +110,12 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         //获取日期-目前上课没有跨天情况
         String ymd = DateUtil.format(startTime, DateUtil.DEFAULT_PATTERN);
         //查询大于当前时间并未开始的课程
-        List<CourseSchedule> list = baseMapper.queryStudentCourse(studentId, ymd);
+        Map<String, Object> param = new HashMap<>();
+        param.put("studentId", studentId);
+        param.put("greaterDate", new Date());
+        param.put("classDate", ymd);
+        param.put("status", CourseScheduleEnum.NOT_START.getCode());
+        List<CourseSchedule> list = baseMapper.queryStudentCourse(param);
         return checkCourseTime(list, CourseSchedule::getStartTime, CourseSchedule::getEndTime, startTime, endTime);
     }
 
@@ -155,8 +162,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
      * @param endTime      新增课程结束时间
      * @return true 有交集 false 没有交集
      */
-    public <T> boolean checkCourseTime(List<T> list, Function<T, Date> startTimeFun, Function<T, Date> endTimeFun,
-                                       Date startTime, Date endTime) {
+    public <T> boolean checkCourseTime(List<T> list, Function<T, Date> startTimeFun, Function<T, Date> endTimeFun, Date startTime, Date endTime) {
         WrapperUtil.checkObj(startTime, "开始时间不能为空!");
         WrapperUtil.checkObj(endTime, "结束时间不能为空!");
         // 如果没有课程,直接返回false
@@ -241,12 +247,25 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         LocalDate lastDay = firstDay.with(TemporalAdjusters.lastDayOfMonth());
         //获取老师的课程  key:日期-年月日 value:课程时间-开始时间,结束时间
         Map<String, List<CourseTimeEntity>> nowCourseMap = getTeacherCourseTime(teacherId, firstDay.toString(), lastDay.toString());
-        //储存节假日数据,避免重复查询
-        Map<Integer, List<String>> holidayMap = new HashMap<>();
         //生成日历数据
         List<CourseCalendarEntity> courseCalendarEntities = generateCourseData(firstDay, lastDay, singleCourseMinutes);
+        //对比课程数据,筛选出空余的课程时间
+        opsCourseCalendarData(nowCourseMap, courseCalendarEntities, 0);
+        return courseCalendarEntities;
+    }
+
+    /**
+     * 对比课程数据,筛选出空余的课程时间
+     *
+     * @param nowCourseMap           现有课程
+     * @param courseCalendarEntities 课程时间日历
+     * @param skipHoliday            是否跳过节假日  0:不跳过 1跳过
+     */
+    private void opsCourseCalendarData(Map<String, List<CourseTimeEntity>> nowCourseMap, List<CourseCalendarEntity> courseCalendarEntities, Integer skipHoliday) {
+        //储存节假日数据,避免重复查询
+        Map<Integer, List<String>> holidayMap = new HashMap<>();
         courseCalendarEntities.forEach(calendarEntity -> {
-            //获取课程数据,并剔除交集时间段数据,
+            //获取课程数据,并剔除交集时间段数据
             List<CourseTimeEntity> nowCourse = nowCourseMap.get(calendarEntity.getDate());
             if (CollectionUtils.isEmpty(nowCourse)) {
                 //当日没课
@@ -280,9 +299,8 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
                     });
             //是否是节假日  0:不是 1是
             calendarEntity.setHoliday(holiday.contains(calendarEntity.getDate()) ? 1 : 0);
+            calendarEntity.setSkipHoliday(skipHoliday);//直播课日历只展示节假日 不跳过节假日
         });
-
-        return courseCalendarEntities;
     }
 
     /**
@@ -300,23 +318,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
                 .ge(CourseSchedule::getClassDate, startDate)
                 .le(CourseSchedule::getClassDate, endDate)
         );
-        //老师课程 key:日期-年月日  value:课程
-        Map<String, List<CourseTimeEntity>> nowCourse = new HashMap<>();
-        if (CollectionUtils.isNotEmpty(courseList)) {
-            WrapperUtil.groupList(courseList, CourseSchedule::getClassDate)
-                    .forEach((k, v) -> {
-                                List<CourseTimeEntity> value = new ArrayList<>();
-                                v.forEach(course -> {
-                                    CourseTimeEntity courseTimeEntity = new CourseTimeEntity();
-                                    courseTimeEntity.setStartTime(course.getStartTime());
-                                    courseTimeEntity.setEndTime(course.getEndTime());
-                                    value.add(courseTimeEntity);
-                                });
-                                nowCourse.put(DateUtil.dateToString(k), value);
-                            }
-                    );
-        }
-        return nowCourse;
+        return getCourseListMap(courseList);
     }
 
     /**
@@ -348,14 +350,8 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
             List<CourseTimeEntity> times = new ArrayList<>();
             //获取当前日期
             entity.setDate(firstDay.toString());
-            int finalAddDay = addDay;
-            dayTime.forEach(time -> {
-                CourseTimeEntity courseTimeEntity = new CourseTimeEntity();
-                courseTimeEntity.setStartTime(DateUtil.addDays(time.getStartTime(), finalAddDay));
-                courseTimeEntity.setEndTime(DateUtil.addDays(time.getEndTime(), finalAddDay));
-                times.add(courseTimeEntity);
-            });
-            entity.courseTime(times);
+            //将每日上课时间时间添加到日历中
+            opsCourseDayTime(addDay, entity, times, dayTime);
             list.add(entity);
             firstDay = firstDay.plusDays(1L);
             addDay++;
@@ -411,18 +407,168 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
     }
 
     /**
-     * 生成陪练课日历
+     * 生成陪练课日历-用于学生购买指定老师陪练课
+     *
+     * @param param 传入参数
+     *              <p> - teacherId 老师id
+     *              <p> - studentId 学生id
+     *              <p> - year 年
+     *              <p> - month 月
+     *              <p> - day 日
+     * @return 返回传入时间当月每日的剩余时间段
      */
-    public void generatePracticeCourseCalender() {
-        //todo 注意:如果是陪练课的日历需要查询老师设置的陪练课时间有哪些,不能直接根据时间段来
-        //获取周 int value = calendarDay.getDayOfWeek().getValue();
+    public List<CourseCalendarEntity> createPracticeCourseCalender(Map<String, Object> param) {
+        //校验数据
+        Long teacherId = WrapperUtil.toLong(param, "teacherId", "老师id不能为空!");
+        Long studentId = WrapperUtil.toLong(param, "teacherId", "学生id不能为空!");
+        Integer year = WrapperUtil.toInt(param, "year", "日历的时间年份不能为空!");
+        Integer month = WrapperUtil.toInt(param, "month", "日历的时间月份不能为空!");
+        Integer day = WrapperUtil.toInt(param, "month", "日历的时间日期不能为空!");
+
+        //传入的日期+1天开始
+        LocalDate firstDay = LocalDate.of(year, month, day).plusDays(1L);
+        //根据firstDay计算出该月的最后一天
+        LocalDate lastDay = firstDay.with(TemporalAdjusters.lastDayOfMonth());
+        //查询老师陪练课设置
+        TeacherFreeTime teacherTime = teacherFreeTimeService.getOne(Wrappers.<TeacherFreeTime>lambdaQuery()
+                .eq(TeacherFreeTime::getDefaultFlag, true)
+                .eq(TeacherFreeTime::getTeacherId, teacherId)
+        );
+        Optional.ofNullable(teacherTime).orElseThrow(() -> new BizException("未查询到老师陪练课设置!"));
+        //根据老师设置的陪练课时间生成当月日历
+        List<CourseCalendarEntity> courseCalendarEntities = generatePracticeCalendar(teacherTime, firstDay, lastDay);
+        //查询老师及当前学生的课时
+        Map<String, List<CourseTimeEntity>> nowCourseMap = getAllPracticeCourseTime(teacherId, studentId, firstDay.toString(), lastDay.toString());
+        //和生成的日历对比,筛选出空余的课程时间
+        opsCourseCalendarData(nowCourseMap, courseCalendarEntities, teacherTime.getSkipHolidayFlag() ? 1 : 0);
+        return courseCalendarEntities;
     }
 
-    private SysUser getSysUser() {
-        return Optional.ofNullable(sysUserFeignService.queryUserInfo())
-                .orElseThrow(() -> new BizException("用户不存在"));
+    /**
+     * 生成老师陪练课日历
+     * <p>陪练课的日历需要查询老师设置的陪练课时间,根据设置的时间来生成日历
+     */
+    private List<CourseCalendarEntity> generatePracticeCalendar(TeacherFreeTime teacherTime, LocalDate firstDay, LocalDate lastDay) {
+        //将老师设置的陪练课时间结构化   key::数字周几 1~7  value:具体的时间 开始时间-结束时间
+        Map<Integer, List<CourseTimeEntity>> teacherPracticeTime = getTeacherPracticeTime(teacherTime);
+        //每日日期数据
+        List<CourseCalendarEntity> list = new ArrayList<>();
+        //添加的天数
+        int addDay = 0;
+        //获取每日日期数据
+        while (firstDay.isBefore(lastDay) || firstDay.isEqual(lastDay)) {
+            CourseCalendarEntity entity = new CourseCalendarEntity();
+            List<CourseTimeEntity> times = new ArrayList<>();
+            //获取当前日期
+            entity.setDate(firstDay.toString());
+            //获取当前日期周几
+            int weekNum = firstDay.getDayOfWeek().getValue();
+            List<CourseTimeEntity> timeEntities = teacherPracticeTime.get(weekNum);
+            if (CollectionUtils.isNotEmpty(timeEntities)) {
+                //将每日上课时间时间添加到日历中
+                opsCourseDayTime(addDay, entity, times, timeEntities);
+            }
+            list.add(entity);
+            firstDay = firstDay.plusDays(1L);
+            addDay++;
+        }
+        return list;
     }
 
+    /**
+     * 将每日上课时间时间添加到日历中
+     *
+     * @param addDay       添加的天数
+     * @param entity       实体数据
+     * @param times        课程数据集合
+     * @param timeEntities 每日上课时间集合
+     */
+    private void opsCourseDayTime(int addDay, CourseCalendarEntity entity, List<CourseTimeEntity> times, List<CourseTimeEntity> timeEntities) {
+        timeEntities.forEach(time -> {
+            CourseTimeEntity courseTimeEntity = new CourseTimeEntity();
+            courseTimeEntity.setStartTime(DateUtil.addDays(time.getStartTime(), addDay));
+            courseTimeEntity.setEndTime(DateUtil.addDays(time.getEndTime(), addDay));
+            times.add(courseTimeEntity);
+        });
+        entity.setCourseTime(times);
+    }
+
+    /**
+     * 将老师设置的陪练课时间结构化
+     *
+     * @return key::数字周几 1~7  value:具体的时间 开始时间-结束时间
+     */
+    private Map<Integer, List<CourseTimeEntity>> getTeacherPracticeTime(TeacherFreeTime teacherTime) {
+        Map<Integer, List<CourseTimeEntity>> teacherPracticeTime = new HashMap<>();
+        //将老师设置的陪练课时间放入map中
+        BiConsumer<String, Integer> timeCon = (timeStr, weekNum) -> {
+            if (StringUtils.isBlank(timeStr)) {
+                return;
+            }
+            List<CourseTimeEntity> timeEntityList = new ArrayList<>(JSONObject.parseArray(timeStr, CourseTimeEntity.class));
+            teacherPracticeTime.put(weekNum, timeEntityList);
+        };
+        timeCon.accept(teacherTime.getMonday(), 1);
+        timeCon.accept(teacherTime.getTuesday(), 2);
+        timeCon.accept(teacherTime.getWednesday(), 3);
+        timeCon.accept(teacherTime.getThursday(), 4);
+        timeCon.accept(teacherTime.getFriday(), 5);
+        timeCon.accept(teacherTime.getSaturday(), 6);
+        timeCon.accept(teacherTime.getSunday(), 7);
+        return teacherPracticeTime;
+    }
+
+    /**
+     * 查询老师及当前学生的课时
+     *
+     * @param teacherId 老师id
+     * @param studentId 学员id
+     */
+    private Map<String, List<CourseTimeEntity>> getAllPracticeCourseTime(Long teacherId, Long studentId, String startDate, String endDate) {
+        //查询该老师指定时间段的课程
+        List<CourseSchedule> courseList = this.list(Wrappers.<CourseSchedule>lambdaQuery()
+                .eq(CourseSchedule::getTeacherId, teacherId)
+                .ge(CourseSchedule::getClassDate, startDate)
+                .le(CourseSchedule::getClassDate, endDate)
+        );
+        if (CollectionUtils.isEmpty(courseList)) {
+            courseList = new ArrayList<>();
+        }
+        //查询学生的课程
+        Map<String, Object> param = new HashMap<>();
+        param.put("studentId", studentId);
+        param.put("startClassDate", startDate);
+        param.put("endClassDate", endDate);
+        List<CourseSchedule> studentCourse = baseMapper.queryStudentCourse(param);
+        //将数据合并
+        if (CollectionUtils.isNotEmpty(studentCourse)) {
+            courseList.addAll(studentCourse);
+        }
+        return getCourseListMap(courseList);
+    }
+
+    private Map<String, List<CourseTimeEntity>> getCourseListMap(List<CourseSchedule> courseList) {
+        //key:课程日期-年月日  value:课程
+        Map<String, List<CourseTimeEntity>> nowCourse = new HashMap<>();
+        if (CollectionUtils.isNotEmpty(courseList)) {
+            WrapperUtil.groupList(courseList, CourseSchedule::getClassDate)
+                    .forEach((k, v) -> {
+                        List<CourseTimeEntity> value = new ArrayList<>();
+                        v.forEach(course -> {
+                            CourseTimeEntity courseTimeEntity = new CourseTimeEntity();
+                            courseTimeEntity.setStartTime(course.getStartTime());
+                            courseTimeEntity.setEndTime(course.getEndTime());
+                            value.add(courseTimeEntity);
+                        });
+                        nowCourse.put(DateUtil.dateToString(k), value);
+                    });
+        }
+        return nowCourse;
+    }
+
+    private SysUser getSysUser() {
+        return Optional.ofNullable(sysUserFeignService.queryUserInfo()).orElseThrow(() -> new BizException("用户不存在"));
+    }
 
     /**
      * @Description: 老师端-首页-我的课程-陪练课

+ 18 - 4
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -91,10 +91,24 @@
                b.updated_time_
         from course_schedule_student_payment as a
                  left join course_schedule as b on a.course_id_ = b.id_
-        where b.start_time_ > now()
-          and b.class_date_ = #{classDate}
-          and b.status_ = 'NOT_START'
-          and a.user_id_ = #{studentId}
+        <where>
+            a.user_id_ = #{param.studentId}
+            <if test="param.greaterDate != null">
+                AND <![CDATA[ b.start_time_ > #{param.greaterDate} ]]>
+            </if>
+            <if test="param.startClassDate != null">
+                AND <![CDATA[ b.class_date_  >= #{param.startClassDate} ]]>
+            </if>
+            <if test="param.endClassDate != null">
+                AND <![CDATA[ b.class_date_  <= #{param.endClassDate} ]]>
+            </if>
+            <if test="param.classDate != null">
+                AND b.class_date_ = #{param.classDate}
+            </if>
+            <if test="param.status != null">
+                AND b.status_ = #{param.status}
+            </if>
+        </where>
         order by b.start_time_ desc
     </select>
 

+ 14 - 3
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/CourseScheduleController.java

@@ -5,13 +5,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dto.search.MyCourseSearch;
-import com.yonge.cooleshow.biz.dal.dto.search.VideoLessonGroupSearch;
 import com.yonge.cooleshow.biz.dal.entity.CourseCalendarEntity;
 import com.yonge.cooleshow.biz.dal.service.CourseScheduleService;
 import com.yonge.cooleshow.biz.dal.support.PageUtil;
 import com.yonge.cooleshow.biz.dal.vo.MyCourseVo;
 import com.yonge.cooleshow.biz.dal.vo.TeacherLiveCourseInfoVo;
-import com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupVo;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.page.PageInfo;
@@ -70,10 +68,23 @@ public class CourseScheduleController extends BaseController {
     })
     @ApiOperation("直播课创建时的日历数据")
     @PostMapping("/createLiveCourseCalendar")
-    public HttpResponseResult<List<CourseCalendarEntity>> createLiveCourseCalendar(Map<String, Object> param) {
+    public HttpResponseResult<List<CourseCalendarEntity>> createLiveCourseCalendar(@RequestBody Map<String, Object> param) {
         return succeed(courseScheduleService.createLiveCourseCalendar(param));
     }
 
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "teacherId", dataType = "Long", value = "老师id"),
+            @ApiImplicitParam(name = "studentId", dataType = "Long", value = "学生id"),
+            @ApiImplicitParam(name = "year", dataType = "Integer", value = "年"),
+            @ApiImplicitParam(name = "month", dataType = "Integer", value = "月"),
+            @ApiImplicitParam(name = "day", dataType = "Integer", value = "日"),
+    })
+    @ApiOperation("陪练课日历-用于学生购买指定老师陪练课")
+    @PostMapping("/createPracticeCourseCalendar")
+    public HttpResponseResult<List<CourseCalendarEntity>> generatePracticeCourseCalender(@RequestBody Map<String, Object> param) {
+        return succeed(courseScheduleService.createPracticeCourseCalender(param));
+    }
+
     @ApiOperation("老师端-首页-我的课程-陪练课")
     @PostMapping("/myCourse")
     public HttpResponseResult<PageInfo<MyCourseVo>> myCourse(@RequestBody MyCourseSearch search) {