瀏覽代碼

定时任务修改状态

liujc 2 年之前
父節點
當前提交
8e3b34f5bd

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -2027,7 +2027,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     /**
      * 直播课需要通知的课程
      */
-    List<CourseSchedule> liveCourseRemind();
+    List<CourseSchedule> liveCourseRemind(Integer minutes);
 
     void updateRemindStatus(@Param("ids") List<Long> ids);
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -4933,7 +4933,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
     @Override
     public void liveCourseRemind() {
         // 查询30分钟内要开始的并且没有直播通知的直播课
-        List<CourseSchedule> courseSchedules = courseScheduleDao.liveCourseRemind();
+        List<CourseSchedule> courseSchedules = courseScheduleDao.liveCourseRemind(30);
 
         if (CollectionUtils.isEmpty(courseSchedules)) {
             return;

+ 2 - 1
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -4328,7 +4328,8 @@
           and cs.live_remind_ = 0
           and cs.type_ = 'LIVE'
           and cs.class_date_ = date_format(now(),'%Y-%m-%d')
-          and cs.start_class_time_ &lt;= date_format(now(),'%H:%i:%s')
+          and CONCAT(class_date_,' ',start_class_time_)  &gt;= date_format(date_add(now(),interval -#{minutes} minute),'%Y-%m-%d %H:%i:%s')
+          and CONCAT(class_date_,' ',start_class_time_)  &lt;= date_format(now(),'%Y-%m-%d %H:%i:%s')
     </select>
 
     <update id="updateRemindStatus">