cy 3 anos atrás
pai
commit
7ad9cb807b

+ 10 - 0
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/CourseGroupController.java

@@ -173,4 +173,14 @@ public class CourseGroupController extends BaseController {
         search.setStudentId(user.getId());
         return succeed(PageUtil.pageInfo(courseGroupService.selectPianoGroupStudent(PageUtil.getPage(search), search)));
     }
+
+    @PostMapping(value = "/piano/student/detail")
+    public HttpResponseResult<PageInfo<CourseGroupPianoDetailVo>> selectPianoGroupStudentDetail(@Validated @RequestBody CourseGroupDetailSearch search) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        search.setStudentId(user.getId());
+        return succeed(PageUtil.pageInfo(courseGroupService.selectPianoGroupStudentDetail(PageUtil.getPage(search), search)));
+    }
 }

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

@@ -225,5 +225,14 @@ public interface CourseGroupDao extends BaseMapper<CourseGroup> {
      */
     IPage<CourseGroupPianoVo> selectPianoGroupStudent(@Param("page") IPage<CourseGroupPianoVo> page,
                                                       @Param("param") CourseGroupSearch search);
+
+    /**
+     * 查询琴房课详情
+     * @param page
+     * @param search
+     * @return
+     */
+    IPage<CourseGroupPianoDetailVo> selectPianoGroupStudentDetail(@Param("page") IPage<CourseGroupPianoDetailVo> page,
+                                                                  @Param("param") CourseGroupDetailSearch search);
 }
 

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

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yonge.cooleshow.biz.dal.dto.search.MyCourseSearch;
 import com.yonge.cooleshow.biz.dal.vo.CourseRepliedVo;
+import com.yonge.cooleshow.biz.dal.vo.CourseScheduleStudentVo;
 import com.yonge.cooleshow.biz.dal.vo.MyRepliedVo;
 import org.apache.ibatis.annotations.Param;
 import com.yonge.cooleshow.biz.dal.entity.CourseScheduleReplied;
@@ -63,4 +64,6 @@ public interface CourseScheduleRepliedDao extends BaseMapper<CourseScheduleRepli
 	 * @Date: 2022/4/19
 	 */
     CourseRepliedVo selectReplied(CourseScheduleReplied replied);
+
+    void insertBatch(List<CourseScheduleStudentVo> list);
 }

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/CourseGroupDetailSearch.java

@@ -17,7 +17,7 @@ import java.util.List;
 @ApiModel
 public class CourseGroupDetailSearch extends QueryInfo {
     @ApiModelProperty(value = "课程组id")
-    @NotNull
+    @NotNull(message = "课程组id不能为空")
     private Long courseGroupId;
     @ApiModelProperty(value = "课程编号/老师姓名/老师编号/学员姓名/学员编号")
     private String search;

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

@@ -276,5 +276,13 @@ public interface CourseGroupService extends IService<CourseGroup> {
      * @return
      */
     IPage<CourseGroupPianoVo> selectPianoGroupStudent(IPage<CourseGroupPianoVo> page, CourseGroupSearch search);
+
+    /**
+     * 学员管理-琴房课-详情
+     * @param page
+     * @param search
+     * @return
+     */
+    IPage<CourseGroupPianoDetailVo> selectPianoGroupStudentDetail(IPage<CourseGroupPianoDetailVo> page, CourseGroupDetailSearch search);
 }
 

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

@@ -1142,5 +1142,10 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
     public IPage<CourseGroupPianoVo> selectPianoGroupStudent(IPage<CourseGroupPianoVo> page, CourseGroupSearch search) {
         return baseMapper.selectPianoGroupStudent(page, search);
     }
+
+    @Override
+    public IPage<CourseGroupPianoDetailVo> selectPianoGroupStudentDetail(IPage<CourseGroupPianoDetailVo> page, CourseGroupDetailSearch search) {
+        return baseMapper.selectPianoGroupStudentDetail(page,search);
+    }
 }
 

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

@@ -1526,6 +1526,12 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         //课程结束(NOW ≥ 结束时间)
         List<CourseScheduleStudentVo> userList = paymentDao.selectUser();
         if (CollectionUtils.isNotEmpty(userList)) {
+            List<CourseScheduleStudentVo> practiceList = userList.stream().filter(s -> s.getType().equals(CourseScheduleEnum.PRACTICE.getCode())).collect(Collectors.toList());
+            if(CollectionUtils.isNotEmpty(practiceList)){//添加陪练课评论
+                repliedDao.insertBatch(practiceList);
+            }
+
+
             //更新学生最近结课时间
             List<CourseScheduleStudentVo> pianoUserList = userList.stream().filter((CourseScheduleStudentVo s) -> s.getType().equals(CourseScheduleEnum.PIANO_ROOM_CLASS.getCode())).collect(Collectors.toList());
             if (CollectionUtils.isNotEmpty(pianoUserList)) {

+ 11 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/CourseGroupPianoDetailVo.java

@@ -57,6 +57,17 @@ public class CourseGroupPianoDetailVo extends BaseEntity {
     @ApiModelProperty("学生状态 0:异常 1:正常")
     private Integer studentSign;
 
+    @ApiModelProperty("老师状态 0:异常 1:正常")
+    private Integer teacherSign;
+
+    public Integer getTeacherSign() {
+        return teacherSign;
+    }
+
+    public void setTeacherSign(Integer teacherSign) {
+        this.teacherSign = teacherSign;
+    }
+
     public Integer getStudentSign() {
         return studentSign;
     }

+ 11 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/CourseScheduleStudentVo.java

@@ -17,6 +17,9 @@ public class CourseScheduleStudentVo implements Serializable {
     @ApiModelProperty(value = "课程id")
     private Long courseId;
 
+    @ApiModelProperty(value = "课程组id")
+    private Long courseGroupId;
+
     @ApiModelProperty(value = "老师id")
     private Long teacherId;
 
@@ -32,6 +35,14 @@ public class CourseScheduleStudentVo implements Serializable {
     @ApiModelProperty(value = "课程类型")
     private String type;
 
+    public Long getCourseGroupId() {
+        return courseGroupId;
+    }
+
+    public void setCourseGroupId(Long courseGroupId) {
+        this.courseGroupId = courseGroupId;
+    }
+
     public String getType() {
         return type;
     }

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

@@ -799,4 +799,53 @@
             AND g.status_ = #{param.status}
         </if>
     </select>
+    <select id="selectPianoGroupStudentDetail"
+            resultType="com.yonge.cooleshow.biz.dal.vo.CourseGroupPianoDetailVo">
+        SELECT * FROM (
+        SELECT
+        cs.id_ AS courseId,
+        sb.id_ AS subjectId,
+        sb.name_ AS subjectName,
+        cs.teacher_id_ AS teacherId,
+        tu.username_ AS teacherName,
+        tu.real_name_ AS teacherRealName,
+        cs.status_ AS `status`,
+        a.studentCount AS studentCount,
+        (cs.single_course_time_ * a.studentCount) AS course_time_,
+        cs.start_time_ AS startTime,
+        cs.end_time_ AS endTime,
+        p.user_id_ AS userId,
+        (CASE WHEN cs.start_time_ &gt;= ta.sign_in_time_ THEN 1 ELSE 0 END) AS teacherInSign,
+        (CASE WHEN cs.end_time_ &lt;= ta.sign_out_time_ THEN 1 ELSE 0 END) AS teacherOutSign,
+        (CASE WHEN cs.start_time_ &gt;= sa.sign_in_time_ AND cs.end_time_ &lt;= sa.sign_out_time_ THEN 1 ELSE 0 END) AS studentSign,
+        (CASE WHEN cs.start_time_ &gt;= ta.sign_in_time_ AND cs.end_time_ &lt;= ta.sign_out_time_ THEN 1 ELSE 0 END) AS teacherSign
+        FROM course_schedule cs
+        LEFT JOIN course_group cg ON cs.course_group_id_ = cg.id_
+        LEFT JOIN `subject` sb ON cg.subject_id_ = sb.id_
+        LEFT JOIN sys_user tu ON cs.teacher_id_ = tu.id_
+        LEFT JOIN (SELECT course_id_,COUNT(1) AS studentCount FROM course_schedule_student_payment WHERE course_type_='PIANO_ROOM_CLASS' GROUP BY course_id_) a ON cs.id_=a.course_id_
+        LEFT JOIN teacher_attendance ta ON cs.id_=ta.course_schedule_id_
+        LEFT JOIN student_attendance sa ON cs.id_=sa.course_schedule_id_
+        LEFT JOIN course_schedule_student_payment p ON cs.id_=p.course_id_
+        WHERE cs.type_='PIANO_ROOM_CLASS'
+        AND p.user_id_=#{param.studentId}) m
+        <if test="param.search != null and param.search != ''">
+            AND courseId LIKE concat('%',#{param.search},'%')
+        </if>
+        <if test="param.studentSign != null">
+            AND studentSign = #{param.studentSign}
+        </if>
+        <if test="param.teacherSign != null">
+            AND teacherSign = #{param.teacherSign}
+        </if>
+        <if test="param.status != null and param.status != ''">
+            AND `status` = #{param.status}
+        </if>
+        <if test="param.startTime != null">
+            AND startTime &lt;= #{param.startTime}
+        </if>
+        <if test="param.endTime != null">
+            AND endTime &gt;= #{param.endTime}
+        </if>
+    </select>
 </mapper>

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

@@ -76,6 +76,12 @@
             </if>
         </trim>
     </insert>
+    <insert id="insertBatch">
+        INSERT INTO course_schedule_replied (student_id_,course_schedule_id_,course_group_type_,course_group_id_) VALUES
+        <foreach collection="list" item="item" index="index" separator=",">
+            (#{item.studentId},#{item.courseId},#{item.type},#{item.courseGroupId})
+        </foreach>
+    </insert>
 
     <select id="detail" resultType="com.yonge.cooleshow.biz.dal.vo.CourseScheduleRepliedVo">
         SELECT

+ 1 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -150,6 +150,7 @@
     <select id="selectUser" resultType="com.yonge.cooleshow.biz.dal.vo.CourseScheduleStudentVo">
         SELECT
             c.id_ AS courseId,
+            c.course_group_id_ AS courseGroupId,
             c.teacher_id_ AS teacherId,
             p.user_id_ AS studentId,
             c.end_time_ AS endTime,