瀏覽代碼

处理老师端查询视频课bug

cy 3 年之前
父節點
當前提交
0fe554fe0b

+ 3 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleDao.java

@@ -114,5 +114,8 @@ public interface CourseScheduleDao extends BaseMapper<CourseSchedule> {
      *              <p> - type PRACTICE 陪练课 LIVE 直播课
      */
     <T> IPage<T> queryStudentLiveCourse(Page<T> page, @Param("param") Map<String, Object> param);
+
+    //更新lock
+    void updateLock(List<Long> list);
 }
 

+ 149 - 147
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/PracticeScheduleDto.java

@@ -1,10 +1,10 @@
 package com.yonge.cooleshow.biz.dal.dto;
 
-import com.yonge.cooleshow.biz.dal.entity.CourseGroup;
-import com.yonge.cooleshow.biz.dal.entity.CourseSchedule;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.yonge.cooleshow.biz.dal.entity.CourseScheduleDate;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
@@ -17,154 +17,156 @@ import java.util.List;
  */
 @ApiModel(value = "PracticeScheduleDto")
 public class PracticeScheduleDto implements Serializable {
-	@ApiModelProperty(value = "课程组id")
-	private Long groupId;
-	@ApiModelProperty(value = "学生id")
-	private Long studentId;
-	@ApiModelProperty(value = "老师id")
-	private Long teacherId;
-	@ApiModelProperty(value = "类型 practice陪练课 live直播课")
-	private String type;
-	@ApiModelProperty(value = "课程组名称")
-	private String courseGroupName;
-	@ApiModelProperty(value = "声部id")
-	private String subjectId;
-	@ApiModelProperty(value = "单课时长")
-	private Integer singleCourseMinutes;
-	@ApiModelProperty(value = "课程数")
-	private Integer courseNum;
-	@ApiModelProperty(value = "课程介绍")
-	private String courseIntroduce;
-	@ApiModelProperty(value = "课程组售价")
-	private BigDecimal coursePrice;
-	@ApiModelProperty(value = "课程单价")
-	private BigDecimal unitPrice;
-	@ApiModelProperty(value = "课程组状态 ING进行中 COMPLETE已完成 DISSOLVE-未成课(解散课程) CANCEL已取消-未开始报名前可取消 APPLY报名中 NOT_SALE未开售")
-	private String status;
-	@ApiModelProperty(value = "最少成课人数")
-	private Integer mixStudentNum;
-	@ApiModelProperty(value = "课程开始时间")
-	private Date courseStartTime;
-	@ApiModelProperty(value = "上课时间")
-	private List<CourseScheduleDate> classTime;
-
-	public BigDecimal getUnitPrice() {
-		return unitPrice;
-	}
-
-	public void setUnitPrice(BigDecimal unitPrice) {
-		this.unitPrice = unitPrice;
-	}
-
-	public Long getGroupId() {
-		return groupId;
-	}
-
-	public void setGroupId(Long groupId) {
-		this.groupId = groupId;
-	}
-
-	public Long getStudentId() {
-		return studentId;
-	}
-
-	public void setStudentId(Long studentId) {
-		this.studentId = studentId;
-	}
-
-	public Long getTeacherId() {
-		return teacherId;
-	}
-
-	public void setTeacherId(Long teacherId) {
-		this.teacherId = teacherId;
-	}
-
-	public String getType() {
-		return type;
-	}
-
-	public void setType(String type) {
-		this.type = type;
-	}
-
-	public String getCourseGroupName() {
-		return courseGroupName;
-	}
-
-	public void setCourseGroupName(String courseGroupName) {
-		this.courseGroupName = courseGroupName;
-	}
-
-	public String getSubjectId() {
-		return subjectId;
-	}
-
-	public void setSubjectId(String subjectId) {
-		this.subjectId = subjectId;
-	}
-
-	public Integer getSingleCourseMinutes() {
-		return singleCourseMinutes;
-	}
-
-	public void setSingleCourseMinutes(Integer singleCourseMinutes) {
-		this.singleCourseMinutes = singleCourseMinutes;
-	}
-
-	public Integer getCourseNum() {
-		return courseNum;
-	}
-
-	public void setCourseNum(Integer courseNum) {
-		this.courseNum = courseNum;
-	}
-
-	public String getCourseIntroduce() {
-		return courseIntroduce;
-	}
-
-	public void setCourseIntroduce(String courseIntroduce) {
-		this.courseIntroduce = courseIntroduce;
-	}
-
-	public BigDecimal getCoursePrice() {
-		return coursePrice;
-	}
-
-	public void setCoursePrice(BigDecimal coursePrice) {
-		this.coursePrice = coursePrice;
-	}
-
-	public String getStatus() {
-		return status;
-	}
-
-	public void setStatus(String status) {
-		this.status = status;
-	}
-
-	public Integer getMixStudentNum() {
-		return mixStudentNum;
-	}
+    @ApiModelProperty(value = "课程组id")
+    private Long groupId;
+    @ApiModelProperty(value = "学生id")
+    private Long studentId;
+    @ApiModelProperty(value = "老师id")
+    private Long teacherId;
+    @ApiModelProperty(value = "类型 practice陪练课 live直播课")
+    private String type;
+    @ApiModelProperty(value = "课程组名称")
+    private String courseGroupName;
+    @ApiModelProperty(value = "声部id")
+    private String subjectId;
+    @ApiModelProperty(value = "单课时长")
+    private Integer singleCourseMinutes;
+    @ApiModelProperty(value = "课程数")
+    private Integer courseNum;
+    @ApiModelProperty(value = "课程介绍")
+    private String courseIntroduce;
+    @ApiModelProperty(value = "课程组售价")
+    private BigDecimal coursePrice;
+    @ApiModelProperty(value = "课程单价")
+    private BigDecimal unitPrice;
+    @ApiModelProperty(value = "课程组状态 ING进行中 COMPLETE已完成 DISSOLVE-未成课(解散课程) CANCEL已取消-未开始报名前可取消 APPLY报名中 NOT_SALE未开售")
+    private String status;
+    @ApiModelProperty(value = "最少成课人数")
+    private Integer mixStudentNum;
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "课程开始时间")
+    private Date courseStartTime;
+    @ApiModelProperty(value = "上课时间")
+    private List<CourseScheduleDate> classTime;
+
+    public BigDecimal getUnitPrice() {
+        return unitPrice;
+    }
+
+    public void setUnitPrice(BigDecimal unitPrice) {
+        this.unitPrice = unitPrice;
+    }
+
+    public Long getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(Long groupId) {
+        this.groupId = groupId;
+    }
+
+    public Long getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Long studentId) {
+        this.studentId = studentId;
+    }
+
+    public Long getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Long teacherId) {
+        this.teacherId = teacherId;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getCourseGroupName() {
+        return courseGroupName;
+    }
+
+    public void setCourseGroupName(String courseGroupName) {
+        this.courseGroupName = courseGroupName;
+    }
+
+    public String getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(String subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    public Integer getSingleCourseMinutes() {
+        return singleCourseMinutes;
+    }
+
+    public void setSingleCourseMinutes(Integer singleCourseMinutes) {
+        this.singleCourseMinutes = singleCourseMinutes;
+    }
+
+    public Integer getCourseNum() {
+        return courseNum;
+    }
+
+    public void setCourseNum(Integer courseNum) {
+        this.courseNum = courseNum;
+    }
+
+    public String getCourseIntroduce() {
+        return courseIntroduce;
+    }
+
+    public void setCourseIntroduce(String courseIntroduce) {
+        this.courseIntroduce = courseIntroduce;
+    }
+
+    public BigDecimal getCoursePrice() {
+        return coursePrice;
+    }
+
+    public void setCoursePrice(BigDecimal coursePrice) {
+        this.coursePrice = coursePrice;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public Integer getMixStudentNum() {
+        return mixStudentNum;
+    }
 
-	public void setMixStudentNum(Integer mixStudentNum) {
-		this.mixStudentNum = mixStudentNum;
-	}
+    public void setMixStudentNum(Integer mixStudentNum) {
+        this.mixStudentNum = mixStudentNum;
+    }
 
-	public Date getCourseStartTime() {
-		return courseStartTime;
-	}
+    public Date getCourseStartTime() {
+        return courseStartTime;
+    }
 
-	public void setCourseStartTime(Date courseStartTime) {
-		this.courseStartTime = courseStartTime;
-	}
+    public void setCourseStartTime(Date courseStartTime) {
+        this.courseStartTime = courseStartTime;
+    }
 
-	public List<CourseScheduleDate> getClassTime() {
-		return classTime;
-	}
+    public List<CourseScheduleDate> getClassTime() {
+        return classTime;
+    }
 
-	public void setClassTime(List<CourseScheduleDate> classTime) {
-		this.classTime = classTime;
-	}
+    public void setClassTime(List<CourseScheduleDate> classTime) {
+        this.classTime = classTime;
+    }
 }

+ 11 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/VideoLessonGroupSearch.java

@@ -23,6 +23,17 @@ public class VideoLessonGroupSearch extends QueryInfo {
     @ApiModelProperty(value = "学生id")
     private Long studentId;
 
+    @ApiModelProperty(value = "老师id")
+    private Long teacherId;
+
+    public Long getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Long teacherId) {
+        this.teacherId = teacherId;
+    }
+
     public Long getStudentId() {
         return studentId;
     }

+ 9 - 8
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/CourseScheduleService.java

@@ -3,20 +3,17 @@ package com.yonge.cooleshow.biz.dal.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.yonge.cooleshow.biz.dal.dao.CourseScheduleDao;
-import com.yonge.cooleshow.biz.dal.dto.PracticeScheduleDto;
+import com.yonge.cooleshow.biz.dal.dto.req.OrderReq;
 import com.yonge.cooleshow.biz.dal.dto.search.HomeworkSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.MyCourseSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.PracticeTeacherSearch;
 import com.yonge.cooleshow.biz.dal.entity.CourseCalendarEntity;
 import com.yonge.cooleshow.biz.dal.entity.CourseSchedule;
-import com.yonge.cooleshow.biz.dal.vo.CourseStudent;
-import com.yonge.cooleshow.biz.dal.vo.MyCourseVo;
-import com.yonge.cooleshow.biz.dal.vo.PracticeTeacherVo;
-import com.yonge.cooleshow.biz.dal.vo.TeacherLiveCourseInfoVo;
+import com.yonge.cooleshow.biz.dal.vo.*;
+import com.yonge.cooleshow.biz.dal.vo.res.OrderCreateRes;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.page.PageInfo;
-import org.apache.ibatis.annotations.Param;
 
-import javax.validation.Valid;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -179,6 +176,10 @@ public interface CourseScheduleService extends IService<CourseSchedule> {
      */
     PageInfo<CourseStudent> queryStudentLiveCourse(Map<String, Object> param);
 
-    void creatPractice(PracticeScheduleDto scheduleDto);
+    HttpResponseResult<OrderCreateRes> buyPracticeCourse(OrderReq.OrderReqInfo orderReqInfo);
+
+    void buyPracticeCourseSuccess(UserOrderDetailVo orderParam);
+
+    void buyPracticeCourseFailed(String orderNo);
 }
 

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

@@ -1,30 +1,33 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
+import com.alibaba.fastjson.JSON;
 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.fasterxml.jackson.databind.ObjectMapper;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dao.CourseScheduleRepliedDao;
 import com.yonge.cooleshow.biz.dal.dao.CourseScheduleStudentPaymentDao;
 import com.yonge.cooleshow.biz.dal.dao.CourseScheduleDao;
 import com.yonge.cooleshow.biz.dal.dto.PracticeScheduleDto;
+import com.yonge.cooleshow.biz.dal.dto.req.OrderReq;
 import com.yonge.cooleshow.biz.dal.dto.search.HomeworkSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.MyCourseSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.PracticeTeacherSearch;
 import com.yonge.cooleshow.biz.dal.entity.*;
 import com.yonge.cooleshow.biz.dal.enums.CourseGroupEnum;
 import com.yonge.cooleshow.biz.dal.enums.CourseScheduleEnum;
+import com.yonge.cooleshow.biz.dal.enums.GoodTypeEnum;
 import com.yonge.cooleshow.biz.dal.service.*;
 import com.yonge.cooleshow.biz.dal.support.PageUtil;
 import com.yonge.cooleshow.biz.dal.support.WrapperUtil;
-import com.yonge.cooleshow.biz.dal.vo.CourseStudent;
-import com.yonge.cooleshow.biz.dal.vo.MyCourseVo;
-import com.yonge.cooleshow.biz.dal.vo.PracticeTeacherVo;
-import com.yonge.cooleshow.biz.dal.vo.TeacherLiveCourseInfoVo;
+import com.yonge.cooleshow.biz.dal.vo.*;
+import com.yonge.cooleshow.biz.dal.vo.res.OrderCreateRes;
 import com.yonge.cooleshow.common.constant.SysConfigConstant;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.exception.BizException;
 import com.yonge.cooleshow.common.page.PageInfo;
 import com.yonge.toolset.utils.date.DateUtil;
@@ -43,6 +46,7 @@ import java.time.temporal.TemporalAdjusters;
 import java.util.*;
 import java.util.function.BiConsumer;
 import java.util.function.Function;
+import java.util.stream.Collectors;
 
 /**
  * 老师课程表(CourseSchedule)表服务实现类
@@ -787,24 +791,30 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         param.put("endDate", lastDay.toString());
         Page<CourseStudent> pageInfo = PageUtil.getPageInfo(param);
         pageInfo.setAsc(" cs.start_time_");
-       return PageUtil.pageInfo(baseMapper.queryStudentLiveCourse(pageInfo,param));
+        return PageUtil.pageInfo(baseMapper.queryStudentLiveCourse(pageInfo, param));
     }
 
-
     /**
-     * @Description: 创建陪练课
+     * @Description: 学生购买陪练课
      * @Author: cy
-     * @Date: 2022/4/20
+     * @Date: 2022/4/21
      */
     @Transactional(rollbackFor = Exception.class)
-    public void creatPractice(PracticeScheduleDto scheduleDto){
-        //创建单号
-        String orderNo="";
+    public HttpResponseResult<OrderCreateRes> buyPracticeCourse(OrderReq.OrderReqInfo orderReqInfo) {
+        log.info("学生购买陪练课,请求参数:{}", JSON.toJSONString(orderReqInfo));
+        Long studentId = orderReqInfo.getUserId();
+
+//        PracticeScheduleDto scheduleDto= (PracticeScheduleDto) orderReqInfo.getBizContent();
+        ObjectMapper objectMapper = new ObjectMapper();
+        PracticeScheduleDto scheduleDto = objectMapper.convertValue(orderReqInfo.getBizContent(), PracticeScheduleDto.class);
+
+        String orderNo = orderReqInfo.getOrderNo();
         scheduleDto.setType(CourseScheduleEnum.PRACTICE.getCode());
         scheduleDto.setStatus(CourseGroupEnum.NOT_SALE.getCode());
         scheduleDto.setMixStudentNum(1);
+        scheduleDto.setStudentId(studentId);
 
-        //写入course_group
+        //course_group
         baseMapper.addCourseGroup(scheduleDto);
         Long groupId = scheduleDto.getGroupId();
 
@@ -818,12 +828,12 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
             schedule.setEndTime(date.getEndTime());
             schedule.setCourseGroupId(groupId);
             schedule.setType(CourseScheduleEnum.PRACTICE.getCode());
-            schedule.classNum(i+1);
+            schedule.classNum(i + 1);
             schedule.setTeacherId(scheduleDto.getTeacherId());
             schedule.setLock(1);
             schedule.setStatus(CourseScheduleEnum.NOT_START.getCode());
             schedule.setCreatedBy(scheduleDto.getStudentId());
-            //写入course_schedule
+            //course_schedule
             baseMapper.insert(schedule);
 
             Long scheduleId = schedule.getId();
@@ -836,17 +846,65 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
             payment.setOriginalPrice(unitPrice);
             payment.setExpectPrice(unitPrice);
             payment.setActualPrice(unitPrice);
-            //course_schedule_student_payment
+            //course_schedule_student_payment
             courseScheduleStudentPaymentService.save(payment);
         }
+
+        OrderCreateRes orderCreateRes = new OrderCreateRes();
+        orderCreateRes.setRes(true);
+        orderCreateRes.setMerchId(scheduleDto.getTeacherId());
+        orderCreateRes.setBizId(groupId);
+        orderCreateRes.setOriginalPrice(scheduleDto.getCoursePrice());
+        orderCreateRes.setExpectPrice(scheduleDto.getCoursePrice());
+        orderCreateRes.setGoodNum(scheduleDto.getCourseNum());
+        orderCreateRes.setGoodType(GoodTypeEnum.PRACTICE);
+        HttpResponseResult<OrderCreateRes> httpResponseResult = new HttpResponseResult<>();
+        httpResponseResult.setData(orderCreateRes);
+        return httpResponseResult;
     }
 
     /**
-     * 陪练课下单
-     *
-     * 调用下单接口
-     * 成功:将course_schedule中lock_改为0
-     * 失败:回滚以上数据
+     * 学生购买陪练课-成功-回调
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public void buyPracticeCourseSuccess(UserOrderDetailVo orderParam) {
+        log.info("学生购买陪练课-成功-回调,请求参数:{}", JSON.toJSONString(orderParam));
+        String orderNo = orderParam.getOrderNo();
+        List<CourseScheduleStudentPayment> paymentList = paymentDao.selectList(Wrappers.<CourseScheduleStudentPayment>lambdaQuery()
+                .eq(CourseScheduleStudentPayment::getOrderNo, orderNo));
+        if (paymentList.isEmpty()) {
+            throw new BizException("订单不存在!");
+        }
+
+        //course_schedule中lock_改为0
+        List<Long> scheduleIds = paymentList.stream().map(CourseScheduleStudentPayment::getCourseId).collect(Collectors.toList());
+        baseMapper.updateLock(scheduleIds);
+    }
+
+    /**
+     * 学生购买陪练课-失败-回调
      */
+    @Transactional(rollbackFor = Exception.class)
+    public void buyPracticeCourseFailed(String orderNo) {
+        List<CourseScheduleStudentPayment> paymentList = paymentDao.selectList(Wrappers.<CourseScheduleStudentPayment>lambdaQuery()
+                .eq(CourseScheduleStudentPayment::getOrderNo, orderNo));
+        if (paymentList.isEmpty()) {
+            throw new BizException("订单不存在!");
+        }
+
+        List<Long> scheduleIds = paymentList.stream().map(CourseScheduleStudentPayment::getCourseId).collect(Collectors.toList());
+        Long courseGroupId = paymentList.get(0).getCourseGroupId();
+
+        //删除course_schedule_student_payment数据
+        courseScheduleStudentPaymentService.remove(Wrappers.<CourseScheduleStudentPayment>lambdaQuery()
+                .eq(CourseScheduleStudentPayment::getOrderNo, orderNo));
+        //删除course_schedule数据
+        this.removeByIds(scheduleIds);
+        //删除course_group数据
+        courseGroupService.removeById(courseGroupId);
+
+        //修改订单为失败
+    }
+
 }
 

+ 9 - 2
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -430,8 +430,15 @@
 
     <insert id="addCourseGroup" parameterType="com.yonge.cooleshow.biz.dal.dto.PracticeScheduleDto" useGeneratedKeys="true" keyProperty="groupId">
         Insert INTO course_group(teacher_id_,type_,name_,subject_id_,single_course_minutes_,course_num_,course_introduce_,
-        course_price_,status_,created_by_,mix_student_num_,course_start_time_)
+        course_price_,status_,created_by_,mix_student_num_,course_start_time_,pre_student_num_)
         VALUES (#{teacherId},#{type},#{courseGroupName},#{subjectId},#{singleCourseMinutes},#{courseNum},#{courseIntroduce},
-        #{coursePrice},#{status},#{studentId},#{mixStudentNum},#{courseStartTime})
+        #{coursePrice},#{status},#{studentId},#{mixStudentNum},#{courseStartTime},1)
     </insert>
+
+    <update id="updateLock" parameterType="java.util.List">
+        UPDATE course_schedule SET lock_ = 0 WHERE id_ IN
+        <foreach collection="list" item="item" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </update>
 </mapper>

+ 4 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/VideoLessonGroupMapper.xml

@@ -72,7 +72,7 @@
 	</update>
 	<select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupVo">
 		SELECT
-			<include refid="baseColumns"/>,
+			<include refid="baseColumns"/>
 			s.username_ AS username,
 			s.avatar_ AS avatar,
 			(SELECT COUNT(1) FROM video_lesson_purchase_record r WHERE r.video_lesson_group_id_=g.id_) AS countStudent
@@ -85,6 +85,9 @@
 			<if test="param.groupId !=null">
 				AND g.id_ = #{param.groupId}
 			</if>
+			<if test="param.teacherId !=null">
+				AND g.teacher_id_ = #{param.teacherId}
+			</if>
 		</where>
 	</select>
 	<select id="selectStudentPage" resultType="com.yonge.cooleshow.biz.dal.vo.VideoLessonStudentDetailVo">

+ 7 - 0
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/VideoLessonGroupController.java

@@ -13,6 +13,7 @@ import com.yonge.cooleshow.biz.dal.vo.VideoLessonVo;
 import com.yonge.cooleshow.common.page.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.http.HttpStatus;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -50,6 +51,12 @@ public class VideoLessonGroupController extends BaseController {
     @ApiOperation(value = "查询视频课组")
     @PostMapping(value = "/page")
     public HttpResponseResult<PageInfo<VideoLessonGroupVo>> page(@RequestBody VideoLessonGroupSearch query) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null || sysUser.getId() == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+
+        query.setTeacherId(sysUser.getId());
         IPage<VideoLessonGroupVo> pages = videoLessonGroupService.selectPage(PageUtil.getPage(query), query);
         return succeed(PageUtil.pageInfo(pages));
     }