Explorar el Código

Merge remote-tracking branch 'origin/master'

liweifan hace 3 años
padre
commit
159d33593c

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

@@ -146,6 +146,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         param.put("endDate", lastDay.toString());
         param.put("teacherId", getSysUser().getId());
         param.put("type", CourseScheduleEnum.LIVE.getCode());
+        param.put("groupState", String.join(",", CourseGroupEnum.ING.getCode(), CourseGroupEnum.COMPLETE.getCode()));
         log.info("queryTeacherLiveCourse:{}", param);
         Page<TeacherLiveCourseInfoVo> pageInfo = PageUtil.getPageInfo(param);
         pageInfo.setAsc("a.start_time_");
@@ -666,26 +667,21 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
     public IPage<MyCourseVo> queryTeacherPracticeCourse(IPage<MyCourseVo> page, MyCourseSearch search) {
         Integer replied = search.getReplied();
         if (replied != null) {
-            //查询所有已评价学生id
-            List<Long> replyStudent = repliedDao.selectReplyStudent();
-            //查询所有购课用户
-            List<Long> userList = paymentDao.selectAll();
-
-            if (CollectionUtils.isEmpty(userList)) {
-                return page.setRecords(new ArrayList<>());
-            }
-
+            search.setStatus(CourseScheduleEnum.COMPLETE.getCode());
+            List<MyCourseVo> list = baseMapper.queryTeacherPracticeCourse(page, monthToDate(search));
             if (replied == 0) {//未评价
-                userList.removeAll(replyStudent);
-                search.setRepliedIds(userList);
+                return page.setRecords(list.stream().filter(s -> {
+                    return s.getTeacherReplied() == 0;
+                }).collect(Collectors.toList()));
             }
 
             if (replied == 1) {//已评价
-                replyStudent.add(Long.valueOf(-1));
-                search.setRepliedIds(replyStudent);
+                return page.setRecords(list.stream().filter(s -> {
+                    return s.getTeacherReplied() == 1;
+                }).collect(Collectors.toList()));
             }
-            search.setStatus(CourseScheduleEnum.COMPLETE.getCode());
         }
+
         return page.setRecords(baseMapper.queryTeacherPracticeCourse(page, monthToDate(search)));
     }
 
@@ -1132,6 +1128,15 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
             throw new BizException("无法调整该课程");
         }
 
+        //校验系统配置上下课时间
+        String star = sysConfigService.findConfigValue(SysConfigConstant.COURSE_START_SETTING);//系统开课时间
+        String end = sysConfigService.findConfigValue(SysConfigConstant.COURSE_END_SETTING);//系统关课时间
+        Date s = DateUtil.strToDate(DateUtil.dateToString(classDate) + " " + star + ":00");
+        Date e = DateUtil.strToDate(DateUtil.dateToString(classDate) + " " + end + ":00");
+        if (startTime.before(s) || endTime.after(e)) {
+            throw new BizException("无法调整该课程");
+        }
+
         //查询是否有人购买
         CourseScheduleStudentPayment studentPayment = paymentDao.selectOne(Wrappers.<CourseScheduleStudentPayment>lambdaQuery()
                 .eq(CourseScheduleStudentPayment::getCourseId, courseId)

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

@@ -161,10 +161,13 @@
         AND a.type_ = #{param.type}
         <![CDATA[ AND a.class_date_  >= #{param.startDate} ]]>
         <![CDATA[ AND a.class_date_  <= #{param.endDate} ]]>
+        <if test="param.groupState !=null and param.groupState !=''">
+            AND  find_in_set(b.status_, #{param.groupState})
+        </if>
         <if test="param.status !=null and param.status !=''">
             AND a.status_ = #{param.status}
         </if>
-        <if test="param.subjectId != null">
+        <if test="param.subjectId != null and param.subjectId !=''">
             AND b.subject_id_ = #{param.subjectId}
         </if>
         order by start_time_