cy 3 лет назад
Родитель
Сommit
05b0941e28

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

@@ -3,6 +3,7 @@ package com.yonge.cooleshow.biz.dal.dao;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.yonge.cooleshow.biz.dal.dto.PracticeScheduleDto;
 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;
@@ -99,6 +100,9 @@ public interface CourseScheduleDao extends BaseMapper<CourseSchedule> {
     //学生端-课表-日历-用户
     List<CourseStudent> queryCourseTeacher(@Param("param") MyCourseSearch search);
 
+    //新增组
+    void addCourseGroup(PracticeScheduleDto scheduleDto);
+
     /**
      * 学生-查询直播课
      *

+ 170 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/PracticeScheduleDto.java

@@ -0,0 +1,170 @@
+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.yonge.cooleshow.biz.dal.entity.CourseScheduleDate;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Author: cy
+ * @Date: 2022/4/20
+ */
+@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;
+	}
+
+	public void setMixStudentNum(Integer mixStudentNum) {
+		this.mixStudentNum = mixStudentNum;
+	}
+
+	public Date getCourseStartTime() {
+		return courseStartTime;
+	}
+
+	public void setCourseStartTime(Date courseStartTime) {
+		this.courseStartTime = courseStartTime;
+	}
+
+	public List<CourseScheduleDate> getClassTime() {
+		return 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

@@ -20,6 +20,17 @@ public class VideoLessonGroupSearch extends QueryInfo {
     @ApiModelProperty(value = "筛选条件")
     private String search;
 
+    @ApiModelProperty(value = "学生id")
+    private Long studentId;
+
+    public Long getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Long studentId) {
+        this.studentId = studentId;
+    }
+
     public AuthStatusEnum getAuditStatus() {
         return auditStatus;
     }

+ 56 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/CourseScheduleDate.java

@@ -0,0 +1,56 @@
+package com.yonge.cooleshow.biz.dal.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Author: cy
+ * @Date: 2022/4/20
+ */
+@ApiModel(value = "CourseScheduleDate")
+public class CourseScheduleDate implements Serializable {
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @ApiModelProperty(value = "上课日期")
+    private Date classDate;
+
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "上课时间")
+    private Date startTime;
+
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "下课时间")
+    private Date endTime;
+
+    public Date getClassDate() {
+        return classDate;
+    }
+
+    public void setClassDate(Date classDate) {
+        this.classDate = classDate;
+    }
+
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+}
+

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

@@ -3,6 +3,7 @@ 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.search.HomeworkSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.MyCourseSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.PracticeTeacherSearch;
@@ -165,6 +166,9 @@ public interface CourseScheduleService extends IService<CourseSchedule> {
 
     IPage<PracticeTeacherVo> teacherList(IPage<PracticeTeacherVo> page, PracticeTeacherSearch search);
 
+//    Map<String,Object> queryCourseTeacher(MyCourseSearch search);
+
+    void creatPractice(PracticeScheduleDto scheduleDto);
     Map<String, Object> queryCourseTeacher(MyCourseSearch search);
 
     /**

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

@@ -42,4 +42,6 @@ public interface VideoLessonGroupService extends IService<VideoLessonGroup> {
     IPage<LessonGroupVo> selectLessonGroup(IPage<LessonGroupVo> page, VideoLessonGroupSearch query);
 
     IPage<VideoLessonAuthGroup> queryGroupList(IPage<VideoLessonAuthGroup> page, VideoGroupSearch query);
+
+    IPage<LessonGroupVo> selectLessonGroupById(IPage<LessonGroupVo> page, VideoLessonGroupSearch query);
 }

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

@@ -10,10 +10,12 @@ 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.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.service.*;
 import com.yonge.cooleshow.biz.dal.support.PageUtil;
@@ -28,16 +30,14 @@ 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;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.validation.annotation.Validated;
 
-import javax.validation.Valid;
+import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.temporal.TemporalAdjusters;
 import java.util.*;
@@ -69,7 +69,6 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
     private TeacherFreeTimeService teacherFreeTimeService;
     @Autowired
     private CourseGroupService courseGroupService;
-
     @Autowired
     private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
 
@@ -791,5 +790,63 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
        return PageUtil.pageInfo(baseMapper.queryStudentLiveCourse(pageInfo,param));
     }
 
+
+    /**
+     * @Description: 创建陪练课
+     * @Author: cy
+     * @Date: 2022/4/20
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public void creatPractice(PracticeScheduleDto scheduleDto){
+        //创建单号
+        String orderNo="";
+        scheduleDto.setType(CourseScheduleEnum.PRACTICE.getCode());
+        scheduleDto.setStatus(CourseGroupEnum.NOT_SALE.getCode());
+        scheduleDto.setMixStudentNum(1);
+
+        //写入course_group
+        baseMapper.addCourseGroup(scheduleDto);
+        Long groupId = scheduleDto.getGroupId();
+
+        BigDecimal unitPrice = scheduleDto.getUnitPrice();
+        List<CourseScheduleDate> classTime = scheduleDto.getClassTime();
+        for (int i = 0; i < classTime.size(); i++) {
+            CourseScheduleDate date = classTime.get(i);
+            CourseSchedule schedule = new CourseSchedule();
+            schedule.setClassDate(date.getClassDate());
+            schedule.setStartTime(date.getStartTime());
+            schedule.setEndTime(date.getEndTime());
+            schedule.setCourseGroupId(groupId);
+            schedule.setType(CourseScheduleEnum.PRACTICE.getCode());
+            schedule.classNum(i+1);
+            schedule.setTeacherId(scheduleDto.getTeacherId());
+            schedule.setLock(1);
+            schedule.setStatus(CourseScheduleEnum.NOT_START.getCode());
+            schedule.setCreatedBy(scheduleDto.getStudentId());
+            //写入course_schedule
+            baseMapper.insert(schedule);
+
+            Long scheduleId = schedule.getId();
+            CourseScheduleStudentPayment payment = new CourseScheduleStudentPayment();
+            payment.setUserId(scheduleDto.getStudentId());
+            payment.setCourseId(scheduleId);
+            payment.setCourseGroupId(groupId);
+            payment.setCourseType(CourseScheduleEnum.PRACTICE.getCode());
+            payment.setOrderNo(orderNo);
+            payment.setOriginalPrice(unitPrice);
+            payment.setExpectPrice(unitPrice);
+            payment.setActualPrice(unitPrice);
+            //写course_schedule_student_payment
+            courseScheduleStudentPaymentService.save(payment);
+        }
+    }
+
+    /**
+     * 陪练课下单
+     *
+     * 调用下单接口
+     * 成功:将course_schedule中lock_改为0
+     * 失败:回滚以上数据
+     */
 }
 

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

@@ -231,4 +231,14 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
     public IPage<VideoLessonAuthGroup> queryGroupList(IPage<VideoLessonAuthGroup> page, VideoGroupSearch query) {
         return page.setRecords(baseMapper.queryGroupList(page, query));
     }
+
+    /**
+     * @Description: 学生端-我的-我的课程-购买的视频课组
+     * @Author: cy
+     * @Date: 2022/4/20
+     */
+    @Override
+    public IPage<LessonGroupVo> selectLessonGroupById(IPage<LessonGroupVo> page, VideoLessonGroupSearch query) {
+        return page.setRecords(baseMapper.selectLessonGroup(page, query));
+    }
 }

+ 6 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -428,4 +428,10 @@
         </if>
     </select>
 
+    <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_)
+        VALUES (#{teacherId},#{type},#{courseGroupName},#{subjectId},#{singleCourseMinutes},#{courseNum},#{courseIntroduce},
+        #{coursePrice},#{status},#{studentId},#{mixStudentNum},#{courseStartTime})
+    </insert>
 </mapper>

+ 7 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/VideoLessonGroupMapper.xml

@@ -220,6 +220,10 @@
 			<if test="param.auditStatus !=null">
 				AND g.audit_status_ = #{param.auditStatus}
 			</if>
+			<if	test="param.studentId != null">
+				g.id_ IN
+				(SELECT video_lesson_group_id_ FROM video_lesson_purchase_record WHERE student_id_=#{param.studentId} AND order_status_=1)
+			</if>
 		</where>
 	</select>
 	<select id="queryGroupList" resultType="com.yonge.cooleshow.biz.dal.vo.VideoLessonAuthGroup">
@@ -258,4 +262,7 @@
 			</if>
 		</where>
 	</select>
+	<select id="selectLessonGroupById" resultType="com.yonge.cooleshow.biz.dal.vo.LessonGroupVo">
+
+	</select>
 </mapper>

+ 13 - 0
cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/VideoLessonController.java

@@ -20,6 +20,7 @@ import com.yonge.cooleshow.common.page.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -94,4 +95,16 @@ public class VideoLessonController extends BaseController {
         IPage<LessonGroupVo> pages = videoLessonGroupService.selectLessonGroup(PageUtil.getPage(query), query);
         return succeed(PageUtil.pageInfo(pages));
     }
+
+    @ApiOperation(value = "学生端-我的-我的课程-购买的视频课组")
+    @PostMapping("/selectMyGroup")
+    public HttpResponseResult<PageInfo<LessonGroupVo>> myLessonGroup(@RequestBody VideoLessonGroupSearch query) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        query.setStudentId(user.getId());
+        IPage<LessonGroupVo> pages = videoLessonGroupService.selectLessonGroupById(PageUtil.getPage(query), query);
+        return succeed(PageUtil.pageInfo(pages));
+    }
 }