Browse Source

vip定制课

zouxuan 7 months ago
parent
commit
4975777c41

+ 20 - 29
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/TeacherCourseGroupController.java

@@ -1,35 +1,28 @@
 package com.yonge.cooleshow.teacher.controller;
 
 
-import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
-import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yonge.cooleshow.biz.dal.dto.CheckCourseTimeDto;
 import com.yonge.cooleshow.biz.dal.dto.LiveCourseGroupDto;
 import com.yonge.cooleshow.biz.dal.entity.CourseTimeEntity;
 import com.yonge.cooleshow.biz.dal.service.AppVersionInfoService;
 import com.yonge.cooleshow.biz.dal.service.CourseGroupService;
+import com.yonge.cooleshow.biz.dal.service.SysUserService;
 import com.yonge.cooleshow.biz.dal.support.WrapperUtil;
 import com.yonge.cooleshow.biz.dal.vo.CourseGroupVo;
 import com.yonge.cooleshow.biz.dal.vo.LiveCourseInfoVo;
+import com.yonge.cooleshow.biz.dal.vo.MyCourseVo;
+import com.yonge.cooleshow.biz.dal.wrapper.course.CourseGroupWrapper;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.enums.YesOrNoEnum;
-import com.yonge.toolset.base.exception.BizException;
 import com.yonge.toolset.base.page.PageInfo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+import com.yonge.toolset.mybatis.support.PageUtil;
+import io.swagger.annotations.*;
 import org.apache.commons.collections.MapUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
@@ -45,15 +38,13 @@ import java.util.Optional;
 @RestController
 @RequestMapping("${app-config.url.teacher:}/courseGroup")
 public class TeacherCourseGroupController extends BaseController {
-    /**
-     * 服务对象
-     */
-    @Autowired
+    @Resource
     private CourseGroupService courseGroupService;
-    @Autowired
-    private SysUserFeignService sysUserFeignService;
 
-    @Autowired
+    @Resource
+    private SysUserService sysUserService;
+
+    @Resource
     private AppVersionInfoService appVersionInfoService;
     @ApiOperation("直播课详情")
     @GetMapping("/queryLiveCourseInfo")
@@ -79,7 +70,7 @@ public class TeacherCourseGroupController extends BaseController {
         Boolean myself = MapUtils.getBoolean(param,"myself");
         if (myself == null || myself) {
             Long teacherId = WrapperUtil.toLong(param, "teacherId");
-            teacherId = Optional.ofNullable(teacherId).orElseGet(() -> getSysUser().getId());
+            teacherId = Optional.ofNullable(teacherId).orElseGet(() -> sysUserService.getUserId());
             param.put("teacherId", teacherId);
         } else {
             YesOrNoEnum auditVersion = YesOrNoEnum.NO;
@@ -144,12 +135,12 @@ public class TeacherCourseGroupController extends BaseController {
         return succeed(courseGroupService.getLiveLockTimeCache(teacherId).get(teacherId));
     }
 
-    private SysUser getSysUser() {
-        return Optional.ofNullable(sysUserFeignService.queryUserInfo())
-                .orElseThrow(() -> new BizException("用户不存在"));
+    @ApiOperation("老师端我的课程组")
+    @PostMapping("/myCourseGroup")
+    public HttpResponseResult<PageInfo<CourseGroupWrapper.TeacherCourseGroupDto>> myCourseGroup(@RequestBody CourseGroupWrapper.TeacherCourseGroupQuery query) {
+        query.setTeacherId(sysUserService.getUserId());
+        IPage<CourseGroupWrapper.TeacherCourseGroupDto> pages = courseGroupService.myCourseGroup(PageUtil.getPage(query), query);
+        return succeed(PageUtil.pageInfo(pages));
     }
-
-
-
 }
 

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

@@ -8,6 +8,7 @@ import com.yonge.cooleshow.biz.dal.entity.CourseGroup;
 import com.yonge.cooleshow.biz.dal.entity.Subject;
 import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupDetail;
 import com.yonge.cooleshow.biz.dal.vo.*;
+import com.yonge.cooleshow.biz.dal.wrapper.course.CourseGroupWrapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -263,5 +264,8 @@ public interface CourseGroupDao extends BaseMapper<CourseGroup> {
      * @return
      */
     List<Subject> selectLiveSubject();
+
+    List<CourseGroupWrapper.TeacherCourseGroupDto> myCourseGroup(@Param("page") IPage<CourseGroupWrapper.TeacherCourseGroupDto> page,
+                                                                 @Param("param") CourseGroupWrapper.TeacherCourseGroupQuery query);
 }
 

+ 4 - 87
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/MyCourseSearch.java

@@ -3,6 +3,7 @@ package com.yonge.cooleshow.biz.dal.dto.search;
 import com.yonge.toolset.base.page.QueryInfo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 import java.util.List;
 
@@ -11,6 +12,7 @@ import java.util.List;
  * @Date: 2022/4/11
  */
 @ApiModel(value = "MyCourseSearch")
+@Data
 public class MyCourseSearch extends QueryInfo {
     @ApiModelProperty(value = "课程状态(NOT_START:未开始 ING:进行中 COMPLETE:已完成 CANCEL:已取消)")
     private String status;
@@ -45,91 +47,6 @@ public class MyCourseSearch extends QueryInfo {
     @ApiModelProperty(value = "结束时间")
     private String endDate;
 
-    public String getStartDate() {
-        return startDate;
-    }
-
-    public void setStartDate(String startDate) {
-        this.startDate = startDate;
-    }
-
-    public String getEndDate() {
-        return endDate;
-    }
-
-    public void setEndDate(String endDate) {
-        this.endDate = endDate;
-    }
-
-    public Long getStudentId() {
-        return studentId;
-    }
-
-    public void setStudentId(Long studentId) {
-        this.studentId = studentId;
-    }
-
-    public String getClassMonth() {
-        return classMonth;
-    }
-
-    public void setClassMonth(String classMonth) {
-        this.classMonth = classMonth;
-    }
-
-    public String getStudentName() {
-        return studentName;
-    }
-
-    public void setStudentName(String studentName) {
-        this.studentName = studentName;
-    }
-
-    public Integer getReplied() {
-        return replied;
-    }
-
-    public void setReplied(Integer replied) {
-        this.replied = replied;
-    }
-
-    public List<Long> getRepliedIds() {
-        return repliedIds;
-    }
-
-    public void setRepliedIds(List<Long> repliedIds) {
-        this.repliedIds = repliedIds;
-    }
-
-    public Long getTeacherId() {
-        return teacherId;
-    }
-
-    public void setTeacherId(Long teacherId) {
-        this.teacherId = teacherId;
-    }
-
-    public String getStatus() {
-        return status;
-    }
-
-    public void setStatus(String status) {
-        this.status = status;
-    }
-
-    public String getClassDate() {
-        return classDate;
-    }
-
-    public void setClassDate(String classDate) {
-        this.classDate = classDate;
-    }
-
-    public Integer getSubjectId() {
-        return subjectId;
-    }
-
-    public void setSubjectId(Integer subjectId) {
-        this.subjectId = subjectId;
-    }
+    @ApiModelProperty(value = "课程类型")
+    private String courseType = "PRACTICE";
 }

+ 5 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/CourseGroupService.java

@@ -15,6 +15,7 @@ import com.yonge.cooleshow.biz.dal.vo.*;
 import com.yonge.cooleshow.biz.dal.vo.res.OrderCreateRes;
 import com.yonge.cooleshow.biz.dal.vo.res.RefundCreateRes;
 import com.yonge.cooleshow.biz.dal.wrapper.UserPaymentOrderWrapper;
+import com.yonge.cooleshow.biz.dal.wrapper.course.CourseGroupWrapper;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.toolset.base.page.PageInfo;
 import org.redisson.api.RMap;
@@ -358,5 +359,9 @@ public interface CourseGroupService extends IService<CourseGroup> {
      *
      */
     void buyLiveCourse(UserPaymentOrderWrapper.OrderGoodsInfo orderGoodsInfo);
+
+    //老师端-我的课程组
+    IPage<CourseGroupWrapper.TeacherCourseGroupDto> myCourseGroup(IPage<CourseGroupWrapper.TeacherCourseGroupDto> page,
+                                                                  CourseGroupWrapper.TeacherCourseGroupQuery query);
 }
 

+ 14 - 3
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseGroupServiceImpl.java

@@ -26,6 +26,7 @@ import com.yonge.cooleshow.biz.dal.vo.*;
 import com.yonge.cooleshow.biz.dal.vo.res.OrderCreateRes;
 import com.yonge.cooleshow.biz.dal.wrapper.UserPaymentOrderWrapper;
 import com.yonge.cooleshow.biz.dal.wrapper.coupon.CouponOrderWrapper;
+import com.yonge.cooleshow.biz.dal.wrapper.course.CourseGroupWrapper;
 import com.yonge.cooleshow.common.constant.SysConfigConstant;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.enums.EPaymentVersion;
@@ -116,9 +117,6 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
     @Autowired
     private UserPaymentCoreService userPaymentCoreService;
 
-    @Autowired
-    private RedisCacheService redisCacheService;
-
     @Override
     public CourseGroupDao getDao() {
         return this.baseMapper;
@@ -407,6 +405,19 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
 
     }
 
+    @Override
+    public IPage<CourseGroupWrapper.TeacherCourseGroupDto> myCourseGroup(IPage<CourseGroupWrapper.TeacherCourseGroupDto> page,
+                                                                         CourseGroupWrapper.TeacherCourseGroupQuery query) {
+        List<CourseGroupWrapper.TeacherCourseGroupDto> records = this.baseMapper.myCourseGroup(page, query);
+        if (CollectionUtils.isNotEmpty(records)) {
+            List<Long> subjectIds = records.stream().map(CourseGroupWrapper.TeacherCourseGroupDto::getSubjectId).distinct().collect(Collectors.toList());
+            List<Subject> subjectList = subjectService.findBySubjectByIdList(subjectIds);
+            Map<Long, String> subjectMap = subjectList.stream().collect(Collectors.toMap(Subject::getId, Subject::getName));
+            records.forEach(e -> e.setSubjectName(subjectMap.get(e.getSubjectId())));
+        }
+        return page.setRecords(records);
+    }
+
     /**
      * 取消课程组-下架课程组
      *

+ 54 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/course/CourseGroupWrapper.java

@@ -0,0 +1,54 @@
+package com.yonge.cooleshow.biz.dal.wrapper.course;
+
+import com.yonge.toolset.base.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+public class CourseGroupWrapper {
+
+    @Data
+    public static class TeacherCourseGroupQuery extends QueryInfo {
+
+        @ApiModelProperty(value = "课程组状态")
+        private String status;
+
+        @ApiModelProperty("声部")
+        private Long subjectId;
+
+        @ApiModelProperty("老师编号")
+        private Long teacherId;
+
+        @ApiModelProperty("课程组类型")
+        private String courseType;
+    }
+
+    @Data
+    public static class TeacherCourseGroupDto {
+        @ApiModelProperty(value = "课程组id")
+        private Long courseGroupId;
+
+        @ApiModelProperty(value = "名称")
+        private String courseGroupName;
+
+        @ApiModelProperty(value = "声部名称")
+        private String subjectName;
+
+        @ApiModelProperty(value = "声部id")
+        private Long subjectId;
+
+        @ApiModelProperty(value = "课程组状态")
+        private String status;
+
+        @ApiModelProperty(value = "已完成课程数")
+        private Integer completeCourseNum;
+
+        @ApiModelProperty(value = "课程数")
+        private Integer courseNum;
+
+        @ApiModelProperty(value = "学员姓名")
+        private String studentName;
+
+        @ApiModelProperty(value = "学员头像")
+        private String studentAvatar;
+    }
+}

+ 24 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseGroupMapper.xml

@@ -1001,4 +1001,28 @@
         left join subject s on cg.subject_id_ = s.id_
         where cg.status_ = 'APPLY' and cg.type_ = 'LIVE'
     </select>
+    <select id="myCourseGroup"
+            resultType="com.yonge.cooleshow.biz.dal.wrapper.course.CourseGroupWrapper$TeacherCourseGroupDto">
+        select cg.name_ courseGroupName,su.username_ studentName,cg.status_ status,
+               su.avatar_ studentAvatar,cg.subject_id_ subjectId,
+               cg.complete_course_num_ completeCourseNum,cg.course_num_ courseNum,cg.id_ courseGroupId
+        from course_group cg
+        LEFT JOIN course_schedule_student_payment cssp ON cssp.course_group_id_ = cg.id_
+        LEFT JOIN sys_user su ON cssp.user_id_ = su.id_
+        <where>
+            <if test="param.teacherId != null">
+                AND cg.teacher_id_ = #{param.teacherId}
+            </if>
+            <if test="param.status != null and param.status != ''">
+                AND cg.status_ = #{param.status}
+            </if>
+            <if test="param.subjectId != null">
+                AND cg.subject_id_ = #{param.subjectId}
+            </if>
+            <if test="param.courseType != null and param.courseType != ''">
+                AND cg.type_ = #{param.courseType}
+            </if>
+        </where>
+        group by cg.id_
+    </select>
 </mapper>

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

@@ -207,7 +207,7 @@
         LEFT JOIN `subject` sb ON g.subject_id_=sb.id_
         LEFT JOIN course_schedule_replied r ON cs.id_=r.course_schedule_id_
         WHERE p.course_id_ IN
-        (SELECT s.id_ FROM course_schedule s WHERE s.type_='PRACTICE' AND lock_=0 AND s.teacher_id_=#{param.teacherId})
+        (SELECT s.id_ FROM course_schedule s WHERE s.type_ = #{param.courseType} AND lock_=0 AND s.teacher_id_=#{param.teacherId})
         <if test="param.status !=null and param.status !=''">
             AND cs.status_ = #{param.status}
         </if>
@@ -273,7 +273,7 @@
         WHERE s.teacher_id_=#{teacherId}
         AND s.lock_=0
         AND s.status_ IN ('ING','COMPLETE','NOT_START')
-        AND p.course_type_ IN ('PIANO_ROOM_CLASS','PRACTICE')
+        AND p.course_type_ IN ('PIANO_ROOM_CLASS','PRACTICE','VIP')
         <![CDATA[ AND s.class_date_  >= #{startDate} ]]>
         <![CDATA[ AND s.class_date_  <= #{endDate} ]]>
         UNION
@@ -397,7 +397,7 @@
         LEFT JOIN course_schedule_replied r ON cs.id_ = r.course_schedule_id_
         WHERE cs.lock_=0
         AND cs.status_ IN ('ING','COMPLETE','NOT_START')
-        AND p.course_id_ IN (SELECT s.id_ FROM course_schedule s WHERE s.type_='PRACTICE' AND s.teacher_id_=#{param.teacherId})
+        AND p.course_id_ IN (SELECT s.id_ FROM course_schedule s WHERE s.type_ IN ('PRACTICE','VIP') AND s.teacher_id_=#{param.teacherId})
         AND cs.class_date_=#{param.classDate}
         ORDER BY startTime
     </select>