ソースを参照

Merge branch 'zx_online_update_1218' of http://git.dayaedu.com/yonge/cooleshow into test

zouxuan 7 ヶ月 前
コミット
cad4f838e4

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

@@ -276,5 +276,7 @@ public interface CourseGroupDao extends BaseMapper<CourseGroup> {
     void updateExposureNum(@Param("groupId") Long groupId, @Param("exposureNum") Integer exposureNum);
 
     int updateLockNum(@Param("groupId") Long groupId, @Param("num") int num);
+
+    void updateCourseStartTime(@Param("groupId") Long groupId);
 }
 

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

@@ -174,6 +174,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
         result.setSalesStartDate(group.getSalesStartDate());
         result.setSalesEndDate(group.getSalesEndDate());
         result.setMixStudentNum(group.getMixStudentNum());
+        result.setMaxStudentNum(group.getMaxStudentNum());
         result.setImGroupId(group.getImGroupId());
         result.setAuditVersion(group.getAuditVersion());
         SysUser teacherUser = sysUserService.getByUserId(group.getTeacherId());

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

@@ -1508,6 +1508,10 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         List<Long> studentIds = studentPayments.stream().map(CourseScheduleStudentPayment::getUserId).collect(Collectors.toList());
         this.batchCheckStudentCourseTime(studentIds, timeList, CourseTimeEntity::getStartTime, CourseTimeEntity::getEndTime);
         baseMapper.courseAdjust(adjustVo);
+        if(StringUtils.equals("GROUP",schedule.getType())){
+            //更新开课时间
+            courseGroupService.getDao().updateCourseStartTime(schedule.getCourseGroupId());
+        }
         // 课程调整后给学生发消息
         sendCourseAdjustMessage(teacherId,studentIds,adjustVo.getCourseId(),adjustVo.getStartTime(),oldStartTime);
     }
@@ -2939,6 +2943,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         //获取所有学生列表
         List<CourseScheduleStudentPayment> studentPayments = courseScheduleStudentPaymentService.lambdaQuery()
                 .in(CourseScheduleStudentPayment::getCourseId, courseScheduleIds)
+                .orderByDesc(CourseScheduleStudentPayment::getId)
                 .list();
         if (CollectionUtils.isEmpty(studentPayments)) {
             return Lists.newArrayList();

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

@@ -1126,4 +1126,8 @@
         set lock_num_ = lock_num_ + #{num}
         where id_ = #{groupId} and lock_num_ + #{num} &lt;= max_student_num_ and lock_num_ + #{num} &gt;= 0
     </update>
+    <update id="updateCourseStartTime">
+        update course_group set course_start_time_ =
+        (select MIN(start_time_) from course_schedule where course_group_id_ = #{groupId}) WHERE id_ = #{groupId}
+    </update>
 </mapper>

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

@@ -372,7 +372,6 @@
         else 'REVIEWED' end ) as homeworkStatus,
         (select group_concat(s2.name_) from subject s2
         where find_in_set(s2.id_,st.subject_id_) and s2.del_flag_ = 0 ) as subjectName
-
         from course_schedule_student_payment cssp
         left join sys_user s on cssp.user_id_ = s.id_
         left  join student st on st.user_id_ = s.id_
@@ -382,6 +381,7 @@
                 and cssp.course_id_ = #{courseId}
             </if>
         </where>
+        ORDER BY cssp.id_ DESC
     </select>
 
 	<select id="selectAbsenteeism" resultType="com.yonge.cooleshow.biz.dal.vo.CourseHomeworkVo">

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

@@ -60,7 +60,8 @@
                 sum(if(a.end_time_ &lt;= now(),1,0)) as expTime,
                 sum(if(a.end_time_ &gt; now(),1,0)) as unExpTime
             from course_schedule a
-            where a.lock_ = 0 and a.type_ in ('PRACTICE','PIANO_ROOM_CLASS','VIP','LIVE','GROUP')
+            LEFT JOIN course_group cg ON cg.id_ = a.course_group_id_
+            where a.lock_ = 0 AND cg.status_ IN ('COMPLETE','ING')
             <if test="userId != null and userId != ''">
                 and a.teacher_id_ = #{userId}
             </if>
@@ -72,8 +73,9 @@
                 a.teacher_id_ as userId,
                 avg (b.score_) as starGrade
             from course_schedule a
+            LEFT JOIN course_group cg ON cg.id_ = a.course_group_id_
             join course_schedule_replied b on a.id_ = b.course_schedule_id_
-            where a.lock_ = 0 and a.type_ in ('PRACTICE','PIANO_ROOM_CLASS','VIP','LIVE','GROUP') and b.score_ is not null
+            where a.lock_ = 0 AND cg.status_ IN ('COMPLETE','ING') and b.score_ is not null
             <if test="userId != null and userId != ''">
                 and a.teacher_id_ = #{userId}
             </if>
@@ -93,7 +95,8 @@
         from student t
         left join course_schedule_student_payment a on t.user_id_ = a.user_id_
         left join course_schedule b on a.course_id_ = b.id_
-        where b.lock_ = 0 and b.type_ in ('PRACTICE','PIANO_ROOM_CLASS','VIP','LIVE','GROUP')
+        LEFT JOIN course_group cg ON cg.id_ = b.course_group_id_
+        where b.lock_ = 0 AND cg.status_ IN ('COMPLETE','ING')
             <if test="userId != null and userId != ''">
                 and t.user_id_ = #{userId}
             </if>