cy hace 3 años
padre
commit
530a5fb452

+ 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.auth.api.entity.SysUser;
 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;
@@ -168,5 +169,8 @@ public interface CourseScheduleDao extends BaseMapper<CourseSchedule> {
 
     //根据订单号查询开课时间
     List<String> selectStartTime(String orderNo);
+
+    //查询明天有课的老师
+    List<SysUser> selectTeacher(String tomorrow);
 }
 

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

@@ -269,6 +269,9 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
                 calendarEntity.setFullCourse(0);//  0:未满 1满
             } else {
                 //将日历时间与课程时间进行对比,如果有交集则将日历的时间数据删除
+                if (CollectionUtils.isEmpty(calendarEntity.getCourseTime())) {
+                    return;
+                }
                 Iterator<CourseTimeEntity> iterator = calendarEntity.getCourseTime().iterator();
                 while (iterator.hasNext()) {
                     CourseTimeEntity next = iterator.next();
@@ -647,7 +650,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
                 List<Long> userList = paymentDao.selectAll();
                 //取差集
                 userList.removeAll(studentList);
-                if (userList.isEmpty()) {
+                if (CollectionUtils.isEmpty(userList)) {
                     return page.setRecords(new ArrayList<>());
                 }
                 search.setRepliedIds(userList);
@@ -908,7 +911,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         log.info("buyPracticeCourseSuccess  param:{}", JSON.toJSONString(orderParam));
         String orderNo = orderParam.getOrderNo();
         List<CourseScheduleStudentPaymentVo> paymentList = paymentDao.selectPaymentList(orderNo);
-        if (paymentList.isEmpty()) {
+        if (CollectionUtils.isEmpty(paymentList)) {
             throw new BizException("订单不存在!");
         }
 
@@ -961,7 +964,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         String orderNo = orderParam.getOrderNo();
         List<CourseScheduleStudentPayment> paymentList = paymentDao.selectList(Wrappers.<CourseScheduleStudentPayment>lambdaQuery()
                 .eq(CourseScheduleStudentPayment::getOrderNo, orderNo));
-        if (paymentList.isEmpty()) {
+        if (CollectionUtils.isEmpty(paymentList)) {
             throw new BizException("订单不存在!");
         }
 
@@ -1104,6 +1107,13 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
      * @Date: 2022/5/6
      */
     public void courseRemind(){
+        String tomorrow = new SimpleDateFormat("yyyy-MM-dd").format(DateUtil.addDays1(new Date(), 1));
+        //查询明天有课的老师
+        List<SysUser> userList=baseMapper.selectTeacher(tomorrow);
+        if (CollectionUtils.isNotEmpty(userList)){
+            for (SysUser sysUser : userList) {
 
+            }
+        }
     }
 }

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

@@ -578,7 +578,7 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
         //{"day":"01","month":"05","year":"2022","singleCourseMinutes":60,"teacherId":4}
         Map<String, Object> param = new HashMap<>();
         param.put("day", "05");
-        param.put("month", "05");
+        param.put("month", "06");
         param.put("year", "2022");
         param.put("teacherId", "174");
         param.put("studentId", 164);

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

@@ -12,6 +12,7 @@ import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
 import com.yonge.cooleshow.biz.dal.service.VideoLessonGroupService;
 import com.yonge.cooleshow.biz.dal.vo.*;
 import com.yonge.cooleshow.common.exception.BizException;
+import org.apache.commons.collections.CollectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -208,7 +209,7 @@ public class VideoLessonGroupServiceImpl extends ServiceImpl<VideoLessonGroupDao
         VideoLessonGroupSearch query = new VideoLessonGroupSearch();
         query.setGroupId(groupId);
         List<VideoLessonGroupVo> lessonGroup = videoLessonGroupDao.selectPage(null, query);
-        if (lessonGroup.isEmpty()) {
+        if (CollectionUtils.isEmpty(lessonGroup)) {
             return lessonStudentVo;
         }
         lessonStudentVo.setLessonGroup(lessonGroup.get(0));

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

@@ -600,4 +600,12 @@
         LEFT JOIN course_schedule s ON p.course_id_=s.id_
         WHERE p.order_no_=#{orderNo}
     </select>
+    <select id="selectTeacher" resultType="com.yonge.cooleshow.auth.api.entity.SysUser"
+            parameterType="java.lang.String">
+        SELECT s.teacher_id_ AS id,u.phone_ AS phone
+        FROM course_schedule s
+        LEFT JOIN sys_user u ON s.teacher_id_=u.id_
+        WHERE class_date_=#{tomorrow} AND lock_=0
+        GROUP BY s.teacher_id_
+    </select>
 </mapper>

+ 3 - 2
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/VideoLessonGroupController.java

@@ -12,6 +12,7 @@ import com.yonge.cooleshow.biz.dal.vo.VideoLessonVo;
 import com.yonge.toolset.base.page.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.collections.CollectionUtils;
 import org.springframework.http.HttpStatus;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
@@ -115,7 +116,7 @@ public class VideoLessonGroupController extends BaseController {
         if (sysUser == null||sysUser.getId()==null) {
             return failed("用户信息获取失败");
         }
-        if (lessonVo.getLessonList().isEmpty()) {
+        if (CollectionUtils.isEmpty(lessonVo.getLessonList())) {
             return failed("课程不能为空");
         }
         videoLessonGroupService.add(lessonVo,sysUser);
@@ -146,7 +147,7 @@ public class VideoLessonGroupController extends BaseController {
         if (sysUser == null||sysUser.getId()==null) {
             return failed("用户信息获取失败");
         }
-        if (lessonVo.getLessonList().isEmpty()) {
+        if (CollectionUtils.isEmpty(lessonVo.getLessonList())) {
             return failed("课程不能为空");
         }
         videoLessonGroupService.update(lessonVo,sysUser);