Sfoglia il codice sorgente

完成管理端视频课

cy 3 anni fa
parent
commit
d6923c88b2

+ 55 - 13
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/VideoLessonController.java

@@ -1,9 +1,16 @@
 package com.yonge.cooleshow.admin.controller;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yonge.cooleshow.biz.dal.dto.search.VideoLessonSearch;
+import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupDetail;
+import com.yonge.cooleshow.biz.dal.service.VideoLessonGroupDetailService;
 import com.yonge.cooleshow.biz.dal.service.VideoLessonGroupService;
 import com.yonge.cooleshow.biz.dal.support.PageUtil;
+import com.yonge.cooleshow.biz.dal.valid.AddGroup;
+import com.yonge.cooleshow.biz.dal.valid.SelectGroup;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonPurchaseVo;
 import com.yonge.cooleshow.biz.dal.vo.VideoLessonStudentDetailVo;
+import com.yonge.cooleshow.biz.dal.vo.VideoLessonTeacherVo;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.page.PageInfo;
@@ -14,25 +21,60 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 /**
-* @Author: cy
-* @Date: 2022/4/2
-*/
+ * @Author: cy
+ * @Date: 2022/4/2
+ */
 @RestController
 @RequestMapping("/videoLesson")
 @Api(tags = "视频课")
 @Validated
 public class VideoLessonController extends BaseController {
-	@Autowired
-	private VideoLessonGroupService lessonGroupService;
+    @Autowired
+    private VideoLessonGroupService lessonGroupService;
+    @Autowired
+    private VideoLessonGroupDetailService videoLessonGroupDetailService;
 
     /**
-    * @Description: 查询学员购买视频课
-    * @Author: cy
-    * @Date: 2022/4/2
-    */
-    @ApiOperation(value = "查询学员购买视频课")
-    @PostMapping(value = "/student/page")
-    public HttpResponseResult<PageInfo<VideoLessonStudentDetailVo>> selectStudentPage(@RequestBody VideoLessonSearch query) {
-        return succeed(PageUtil.pageInfo(lessonGroupService.selectStudentPage(PageUtil.getPage(query), query)));
+     * @Description: 学员详情-查询视频课列表
+     * @Author: cy
+     * @Date: 2022/4/2
+     */
+    @ApiOperation(value = "学员详情-查询视频课列表")
+    @PostMapping(value = "/student")
+    public HttpResponseResult<PageInfo<VideoLessonStudentDetailVo>> selectStudentPage(@Validated(AddGroup.class) @RequestBody VideoLessonSearch search) {
+        return succeed(PageUtil.pageInfo(lessonGroupService.selectStudentPage(PageUtil.getPage(search), search)));
+    }
+
+    /**
+     * @Description: 老师详情-查询视频课列表
+     * @Author: cy
+     * @Date: 2022/4/6
+     */
+    @ApiOperation(value = "老师详情-查询视频课列表")
+    @PostMapping(value = "/teacher")
+    public HttpResponseResult<PageInfo<VideoLessonTeacherVo>> selectTeacherPage(@Validated(AddGroup.class) @RequestBody VideoLessonSearch search) {
+        return succeed(PageUtil.pageInfo(lessonGroupService.selectTeacherPage(PageUtil.getPage(search), search)));
+    }
+
+    /**
+     * @Description: 老师详情-视频课详情-查询购买学员列表
+     * @Author: cy
+     * @Date: 2022/4/6
+     */
+    @ApiOperation(value = "老师详情-视频课详情-查询购买学员列表", httpMethod = "POST", consumes = "application/json", produces = "application/json")
+    @PostMapping(value = "/teacher/purchaseStudent", consumes = "application/json", produces = "application/json")
+    public HttpResponseResult<PageInfo<VideoLessonPurchaseVo>> selectPurchaseStudent(@Validated(SelectGroup.class) @RequestBody VideoLessonSearch search) {
+        return succeed(PageUtil.pageInfo(lessonGroupService.selectPurchaseStudent(PageUtil.getPage(search), search)));
+    }
+
+    /**
+     * @Description: 老师详情-视频课详情-教学计划
+     * @Author: cy
+     * @Date: 2022/4/6
+     */
+    @ApiOperation(value = "老师详情-视频课详情-教学计划", httpMethod = "POST", consumes = "application/json", produces = "application/json")
+    @PostMapping(value = "/teacher/plan", consumes = "application/json", produces = "application/json")
+    public HttpResponseResult<PageInfo<VideoLessonGroupDetail>> page(@Validated(SelectGroup.class) @RequestBody VideoLessonSearch search) {
+        return succeed(PageUtil.pageInfo(videoLessonGroupDetailService.selectPage(PageUtil.getPage(search), search)));
     }
 }

+ 10 - 6
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/VideoLessonGroupDao.java

@@ -5,9 +5,7 @@ import com.yonge.cooleshow.biz.dal.dto.search.VideoLessonGroupSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.VideoLessonSearch;
 import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroup;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupUpVo;
-import com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupVo;
-import com.yonge.cooleshow.biz.dal.vo.VideoLessonStudentDetailVo;
+import com.yonge.cooleshow.biz.dal.vo.*;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -20,11 +18,17 @@ import java.util.List;
  **/
 public interface VideoLessonGroupDao extends BaseMapper<VideoLessonGroup> {
     //查询视频课组
-    List<VideoLessonGroupVo> selectPage(IPage page,@Param("param")  VideoLessonGroupSearch query);
+    List<VideoLessonGroupVo> selectPage(IPage page, @Param("param") VideoLessonGroupSearch query);
 
     //修改视频课组
     void updateGroup(VideoLessonGroupUpVo lessonGroupUpVo);
 
-    //查询学员购买视频课
-    List<VideoLessonStudentDetailVo> selectStudentPage(IPage page,@Param("param") VideoLessonSearch videoLessonSearch);
+    //学员详情-查询视频课列表
+    List<VideoLessonStudentDetailVo> selectStudentPage(IPage page, @Param("param") VideoLessonSearch videoLessonSearch);
+
+    //老师详情-查询视频课列表
+    List<VideoLessonTeacherVo> selectTeacherPage(IPage page, @Param("param") VideoLessonSearch videoLessonSearch);
+
+    //老师详情-视频课详情-查询购买学员列表
+    List<VideoLessonPurchaseVo> selectPurchaseStudent(IPage page, @Param("param") VideoLessonSearch search);
 }

+ 15 - 9
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/VideoLessonSearch.java

@@ -1,12 +1,14 @@
 package com.yonge.cooleshow.biz.dal.dto.search;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
-import com.yonge.cooleshow.biz.dal.enums.AuditEnum;
+import com.yonge.cooleshow.biz.dal.valid.AddGroup;
+import com.yonge.cooleshow.biz.dal.valid.SelectGroup;
 import com.yonge.cooleshow.common.page.QueryInfo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import javax.validation.constraints.NotNull;
 import java.util.Date;
 
 /**
@@ -14,14 +16,16 @@ import java.util.Date;
  * @date: 2022/3/30 11:32
  */
 @ApiModel(value = "VideoLessonGroupSearch", description = "视频课组列表查询")
-public class VideoLessonSearch extends QueryInfo{
+public class VideoLessonSearch extends QueryInfo {
     @ApiModelProperty(value = "视频组id")
+    @NotNull(groups = {SelectGroup.class}, message = "视频组id不能为空")
     private Long videoLessonGroupId;
 
-    @ApiModelProperty(value = "学生id")
-    private Long studentId;
+    @ApiModelProperty(value = "用户id")
+    @NotNull(groups = {AddGroup.class}, message = "用户id不能为空")
+    private Long userId;
 
-    @ApiModelProperty(value = "课程编号/老师编号/老师姓名/老师手机")
+    @ApiModelProperty(value = "课程编号/课程组名称/老师编号/老师姓名/老师手机")
     private String search;
 
     @ApiModelProperty(value = "订单号")
@@ -51,18 +55,20 @@ public class VideoLessonSearch extends QueryInfo{
         this.videoLessonGroupId = videoLessonGroupId;
     }
 
-    public Long getStudentId() {
-        return studentId;
+    public Long getUserId() {
+        return userId;
     }
 
-    public void setStudentId(Long studentId) {
-        this.studentId = studentId;
+    public void setUserId(Long userId) {
+        this.userId = userId;
     }
 
+    @Override
     public String getSearch() {
         return search;
     }
 
+    @Override
     public void setSearch(String search) {
         this.search = search;
     }

+ 4 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/VideoLessonGroupService.java

@@ -24,4 +24,8 @@ public interface VideoLessonGroupService extends IService<VideoLessonGroup> {
     void add(VideoLessonVo lessonVo, SysUser sysUser);
 
     IPage<VideoLessonStudentDetailVo> selectStudentPage(IPage<VideoLessonStudentDetailVo> page, VideoLessonSearch search);
+
+    IPage<VideoLessonTeacherVo> selectTeacherPage(IPage<VideoLessonTeacherVo> page, VideoLessonSearch search);
+
+    IPage<VideoLessonPurchaseVo> selectPurchaseStudent(IPage<VideoLessonPurchaseVo> page, VideoLessonSearch search);
 }

+ 44 - 27
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/VideoLessonGroupServiceImpl.java

@@ -9,10 +9,7 @@ import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroup;
 import com.yonge.cooleshow.biz.dal.dao.VideoLessonGroupDao;
 import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupDetail;
 import com.yonge.cooleshow.biz.dal.service.VideoLessonGroupService;
-import com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupUpVo;
-import com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupVo;
-import com.yonge.cooleshow.biz.dal.vo.VideoLessonStudentDetailVo;
-import com.yonge.cooleshow.biz.dal.vo.VideoLessonVo;
+import com.yonge.cooleshow.biz.dal.vo.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -29,7 +26,7 @@ import java.util.List;
  * @version v1.0
  **/
 @Service
-public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao,VideoLessonGroup> implements VideoLessonGroupService {
+public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao, VideoLessonGroup> implements VideoLessonGroupService {
 
     private final static Logger log = LoggerFactory.getLogger(VideoLessonGroupServiceImpl.class);
 
@@ -43,20 +40,20 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
     }
 
     /**
-    * @Description: 查询视频课组
-    * @Author: cy
-    * @Date: 2022/3/31
-    */
+     * @Description: 查询视频课组
+     * @Author: cy
+     * @Date: 2022/3/31
+     */
     @Override
     public IPage<VideoLessonGroupVo> selectPage(IPage<VideoLessonGroupVo> page, VideoLessonGroupSearch query) {
-        return page.setRecords(baseMapper.selectPage(page,query));
+        return page.setRecords(baseMapper.selectPage(page, query));
     }
 
     /**
-    * @Description: 修改视频课组
-    * @Author: cy
-    * @Date: 2022/3/31
-    */
+     * @Description: 修改视频课组
+     * @Author: cy
+     * @Date: 2022/3/31
+     */
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void updateGroup(VideoLessonGroupUpVo lessonGroupUpVo) {
@@ -64,10 +61,10 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
     }
 
     /**
-    * @Description: 删除视频课
-    * @Author: cy
-    * @Date: 2022/3/31
-    */
+     * @Description: 删除视频课
+     * @Author: cy
+     * @Date: 2022/3/31
+     */
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void deleteGroup(Long id) {
@@ -76,10 +73,10 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
     }
 
     /**
-    * @Description: 新增视频课组&视频课
-    * @Author: cy
-    * @Date: 2022/4/1
-    */
+     * @Description: 新增视频课组&视频课
+     * @Author: cy
+     * @Date: 2022/4/1
+     */
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void add(VideoLessonVo lessonVo, SysUser sysUser) {
@@ -105,12 +102,32 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
     }
 
     /**
-    * @Description: 查询学员购买视频课
-    * @Author: cy
-    * @Date: 2022/4/2
-    */
+     * @Description: 学员详情-查询视频课列表
+     * @Author: cy
+     * @Date: 2022/4/2
+     */
     @Override
     public IPage<VideoLessonStudentDetailVo> selectStudentPage(IPage<VideoLessonStudentDetailVo> page, VideoLessonSearch search) {
-        return page.setRecords(baseMapper.selectStudentPage(page,search));
+        return page.setRecords(baseMapper.selectStudentPage(page, search));
+    }
+
+    /**
+     * @Description: 老师详情-查询视频课列表
+     * @Author: cy
+     * @Date: 2022/4/6
+     */
+    @Override
+    public IPage<VideoLessonTeacherVo> selectTeacherPage(IPage<VideoLessonTeacherVo> page, VideoLessonSearch search) {
+        return page.setRecords(baseMapper.selectTeacherPage(page, search));
+    }
+
+    /**
+     * @Description: 老师详情-视频课详情-查询购买学员列表
+     * @Author: cy
+     * @Date: 2022/4/6
+     */
+    @Override
+    public IPage<VideoLessonPurchaseVo> selectPurchaseStudent(IPage<VideoLessonPurchaseVo> page, VideoLessonSearch search) {
+        return page.setRecords(baseMapper.selectPurchaseStudent(page, search));
     }
 }

+ 8 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/valid/SelectGroup.java

@@ -0,0 +1,8 @@
+package com.yonge.cooleshow.biz.dal.valid;
+
+/**
+* @Author: cy
+* @Date: 2022/4/6
+*/
+public interface SelectGroup {
+}

+ 67 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/VideoLessonPurchaseVo.java

@@ -0,0 +1,67 @@
+package com.yonge.cooleshow.biz.dal.vo;
+
+import com.yonge.cooleshow.common.entity.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @author: cy
+ * @date: 2022/3/30 11:39
+ */
+@ApiModel(value = "VideoLessonPurchaseVo对象")
+public class VideoLessonPurchaseVo extends BaseEntity {
+    @ApiModelProperty("学员编号")
+    private String studentId;
+
+    @ApiModelProperty("学员姓名")
+    private String username;
+
+    @ApiModelProperty(value = "支付金额")
+    private String payMoney;
+
+    @ApiModelProperty(value = "订单号")
+    private String orderNo;
+
+    @ApiModelProperty(value = "购买时间")
+    private String purchaseTime;
+
+    public String getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(String studentId) {
+        this.studentId = studentId;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPayMoney() {
+        return payMoney;
+    }
+
+    public void setPayMoney(String payMoney) {
+        this.payMoney = payMoney;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public String getPurchaseTime() {
+        return purchaseTime;
+    }
+
+    public void setPurchaseTime(String purchaseTime) {
+        this.purchaseTime = purchaseTime;
+    }
+}

+ 111 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/VideoLessonTeacherVo.java

@@ -0,0 +1,111 @@
+package com.yonge.cooleshow.biz.dal.vo;
+
+import com.yonge.cooleshow.common.entity.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @author: cy
+ * @date: 2022/4/6 10:45
+ */
+@ApiModel(value = "VideoLessonTeacherVo对象")
+public class VideoLessonTeacherVo extends BaseEntity {
+    @ApiModelProperty(value = "课程组编号")
+    private String groupId;
+
+    @ApiModelProperty("课程名称")
+    private String lessonName;
+
+    @ApiModelProperty("课程声部")
+    private String lessonSubject;
+
+    @ApiModelProperty("课时数")
+    private Integer lessonCount;
+
+    @ApiModelProperty("销售价格")
+    private String lessonPrice;
+
+    @ApiModelProperty("购买人数")
+    private Integer countStudent;
+
+    @ApiModelProperty("审核状态(0:待审核 1:通过 2:未通过)")
+    private Integer auditStatus;
+
+    @ApiModelProperty("创建时间")
+    private String createTime;
+
+    @ApiModelProperty("课程介绍")
+    private String lessonDesc;
+
+    public String getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(String groupId) {
+        this.groupId = groupId;
+    }
+
+    public String getLessonName() {
+        return lessonName;
+    }
+
+    public void setLessonName(String lessonName) {
+        this.lessonName = lessonName;
+    }
+
+    public String getLessonSubject() {
+        return lessonSubject;
+    }
+
+    public void setLessonSubject(String lessonSubject) {
+        this.lessonSubject = lessonSubject;
+    }
+
+    public Integer getLessonCount() {
+        return lessonCount;
+    }
+
+    public void setLessonCount(Integer lessonCount) {
+        this.lessonCount = lessonCount;
+    }
+
+    public String getLessonPrice() {
+        return lessonPrice;
+    }
+
+    public void setLessonPrice(String lessonPrice) {
+        this.lessonPrice = lessonPrice;
+    }
+
+    public Integer getCountStudent() {
+        return countStudent;
+    }
+
+    public void setCountStudent(Integer countStudent) {
+        this.countStudent = countStudent;
+    }
+
+    public Integer getAuditStatus() {
+        return auditStatus;
+    }
+
+    public void setAuditStatus(Integer auditStatus) {
+        this.auditStatus = auditStatus;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getLessonDesc() {
+        return lessonDesc;
+    }
+
+    public void setLessonDesc(String lessonDesc) {
+        this.lessonDesc = lessonDesc;
+    }
+}

+ 64 - 3
cooleshow-user/user-biz/src/main/resources/config/mybatis/VideoLessonGroupMapper.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yonge.cooleshow.biz.dal.dao.VideoLessonGroupDao">
 	<resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.VideoLessonGroup">
@@ -86,8 +86,8 @@
 		LEFT JOIN video_lesson_purchase_record p ON g.id_ = p.video_lesson_group_id_
 		LEFT JOIN sys_user s ON g.teacher_id_ = s.id_
 		<where>
-			<if test="param.studentId !=null">
-				AND p.student_id_ = #{param.studentId}
+			<if test="param.userId !=null">
+				AND p.student_id_ = #{param.userId}
 			</if>
 			<if test="null != param.search and '' != param.search">
 				AND (
@@ -114,4 +114,65 @@
 			</if>
 		</where>
 	</select>
+	<select id="selectTeacherPage" resultType="com.yonge.cooleshow.biz.dal.vo.VideoLessonTeacherVo">
+		SELECT
+			g.id_ AS groupId,
+			g.lesson_name_ AS lessonName,
+			g.lesson_subject_ AS lessonSubject,
+			g.lesson_count_ AS lessonCount,
+			g.lesson_price_ AS lessonPrice,
+			g.audit_status_ AS auditStatus,
+			(SELECT COUNT(1) FROM video_lesson_purchase_record r WHERE r.video_lesson_group_id_=g.id_) AS countStudent,
+			g.create_time_ AS createTime,
+			g.lesson_desc_ AS lessonDesc
+		FROM video_lesson_group g
+		<where>
+			<if test="param.userId !=null">
+				AND g.teacher_id_ = #{param.userId}
+			</if>
+			<if test="null != param.search and '' != param.search">
+				AND (
+				g.id_ LIKE CONCAT('%', #{param.search}, '%') OR
+				g.lesson_name_ LIKE CONCAT('%', #{param.search}, '%')
+				)
+			</if>
+			<if test="null != param.lessonSubject and '' != param.lessonSubject">
+				AND g.lesson_subject_ = #{param.lessonSubject}
+			</if>
+			<if test="param.auditStatus !=null">
+				AND g.audit_status_ = #{param.auditStatus}
+			</if>
+		</where>
+	</select>
+	<select id="selectPurchaseStudent" resultType="com.yonge.cooleshow.biz.dal.vo.VideoLessonPurchaseVo">
+		SELECT
+			p.student_id_ AS studentId,
+			u.username_ AS username,
+			p.pay_money_ AS payMoney,
+			p.order_no_ AS orderNo,
+			p.purchase_time_ AS purchaseTime
+		FROM video_lesson_purchase_record p
+		LEFT JOIN sys_user u ON p.student_id_ = u.id_
+		<where>
+			<if test="param.videoLessonGroupId !=null">
+				AND p.video_lesson_group_id_ = #{param.videoLessonGroupId}
+			</if>
+			<if test="null != param.search and '' != param.search">
+				AND (
+				u.id_ LIKE CONCAT('%', #{param.search}, '%') OR
+				u.username_ LIKE CONCAT('%', #{param.search}, '%') OR
+				u.phone_ LIKE CONCAT('%', #{param.search}, '%')
+				)
+			</if>
+			<if test="null != param.orderNo and '' != param.orderNo">
+				AND p.order_no_ = #{param.orderNo}
+			</if>
+			<if test="param.startTime !=null">
+				<![CDATA[AND p.purchase_time_ >= #{param.startTime} ]]>
+			</if>
+			<if test="param.endTime !=null">
+				<![CDATA[AND p.purchase_time_ <= #{param.endTime} ]]>
+			</if>
+		</where>
+	</select>
 </mapper>