Quellcode durchsuchen

修改发消息时间

liujc vor 2 Jahren
Ursprung
Commit
eb4db87d43

+ 18 - 44
.idea/httpRequests/http-requests-log.http

@@ -1,3 +1,21 @@
+GET http://127.0.0.1:8005/task/closeLiveCourseRoom
+Connection: Keep-Alive
+User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
+Accept-Encoding: br,deflate,gzip,x-gzip
+
+<> 2023-06-08T214126.200.json
+
+###
+
+GET http://127.0.0.1:8005/task/closeLiveCourseRoom
+Connection: Keep-Alive
+User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
+Accept-Encoding: br,deflate,gzip,x-gzip
+
+<> 2023-06-08T210807.200.json
+
+###
+
 GET http://127.0.0.1:9002/teacherCourseSchedule/findCourseAttendanceDetailHeadInfo?courseScheduleId=1701
 authorization: bearer b33a3aed-ca44-4537-b3ae-1fba38c2560a
 Content-Type: application/json
@@ -731,47 +749,3 @@ Accept-Encoding: br,deflate,gzip,x-gzip
 
 ###
 
-POST http://127.0.0.1:8005/studentManage/userPage
-Authorization: bearer b897da27-5a37-47df-8e76-54d80a61a55d
-Content-Type: application/json
-coopId: 25
-Content-Length: 137
-Connection: Keep-Alive
-User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
-Accept-Encoding: br,deflate,gzip,x-gzip
-
-{
-//  "keyword": "一",
-//    "musicGroupId": 23050516201200001,
-  //  "subjectId": 2,
-  //  "vipFlag": true,
-//  "studentId": 2248340
-
-}
-
-<> 2023-06-02T195056.200.json
-
-###
-
-POST http://127.0.0.1:8005/studentManage/userPage
-Authorization: bearer b897da27-5a37-47df-8e76-54d80a61a55d
-Content-Type: application/json
-coopId: 14
-Content-Length: 137
-Connection: Keep-Alive
-User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
-Accept-Encoding: br,deflate,gzip,x-gzip
-
-{
-//  "keyword": "一",
-//    "musicGroupId": 23050516201200001,
-  //  "subjectId": 2,
-  //  "vipFlag": true,
-//  "studentId": 2248340
-
-}
-
-<> 2023-06-02T194927.200.json
-
-###
-

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

@@ -2045,7 +2045,9 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      *
      * @return
      */
-    List<CourseSchedule> getCloseLiveCourseRoom(@Param("studentRemindTime") Integer studentRemindTime, @Param("closeTime") Integer closeTime);
+    List<CourseSchedule> getCloseLiveCourseRoom(@Param("studentRemindTime") Integer studentRemindTime,
+                                                @Param("closeTime") Integer closeTime,
+                                                @Param("tenantId") Integer tenantId);
 
     /**
      * 更新通知状态

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

@@ -201,6 +201,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
     @Autowired
     private SysMessageConfigDao sysMessageConfigDao;
 
+    @Autowired
+    private TenantInfoService tenantInfoService;
+
     private static final Logger LOGGER = LoggerFactory.getLogger(VipGroup.class);
 
     @Override
@@ -5080,35 +5083,48 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
     @Override
     public void closeLiveCourseRoom() {
 
+        List<TenantInfo> list = tenantInfoService.list();
+
         Integer studentRemindTime = Integer.parseInt(sysConfigService.findByParamName(SysConfigService.liveClassStudentRemindTime).getParanValue());
 
         Integer closeTime = Integer.parseInt(sysConfigService.findByParamName(SysConfigService.closeClassStudentRemindTime).getParanValue());
-        // 查询非连堂课  且  已经结束的课程
-        List<CourseSchedule> scheduleList = courseScheduleDao.getCloseLiveCourseRoom(studentRemindTime, null);
 
-        // 通知学生退出直播间
+        for (TenantInfo tenantInfo : list) {
+            // 是否是连堂课
+            String continueCourseTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME, tenantInfo.getId());
+            if (StringUtils.isEmpty(continueCourseTime)) {
+                continueCourseTime = "5";
+            }
+            Integer messageTime = Integer.parseInt(continueCourseTime) + studentRemindTime;
 
-        scheduleList.forEach(data -> {
-            ImLiveBroadcastRoom imLiveBroadcastRoomVo = imLiveBroadcastRoomService.getByRoomUid(data.getLiveRoomId());
-            if (!Objects.isNull(imLiveBroadcastRoomVo) ) {
-                if(imLiveBroadcastRoomVo.getLiveState() == 1) {
 
-                    try {
-                        imLiveBroadcastRoomService.sendForcedOffline(imLiveBroadcastRoomVo);
+            // 查询非连堂课  且  已经结束的课程
+            List<CourseSchedule> scheduleList = courseScheduleDao.getCloseLiveCourseRoom(messageTime, null, tenantInfo.getId());
 
-                        courseScheduleDao.updateLiveRemind(data.getId(), 1);
-                    } catch (Exception e) {
-                        log.error("发送直播间退出消息失败", e);
+            // 通知学生退出直播间
+
+            scheduleList.forEach(data -> {
+                ImLiveBroadcastRoom imLiveBroadcastRoomVo = imLiveBroadcastRoomService.getByRoomUid(data.getLiveRoomId());
+                if (!Objects.isNull(imLiveBroadcastRoomVo)) {
+                    if (imLiveBroadcastRoomVo.getLiveState() == 1) {
+
+                        try {
+                            imLiveBroadcastRoomService.sendForcedOffline(imLiveBroadcastRoomVo);
+
+                            courseScheduleDao.updateLiveRemind(data.getId(), 1);
+                        } catch (Exception e) {
+                            log.error("发送直播间退出消息失败", e);
+                        }
+                    } else if (imLiveBroadcastRoomVo.getLiveState() == 2) {
+                        // 直播未开始 设置通知状态
+                        courseScheduleDao.updateLiveRemind(data.getId(), 2);
                     }
-                } else if (imLiveBroadcastRoomVo.getLiveState() == 2) {
-                    // 直播未开始 设置通知状态
-                    courseScheduleDao.updateLiveRemind(data.getId(), 2);
                 }
-            }
-        });
+            });
+        }
 
         // 没有直播流 关闭直播间
-        scheduleList = courseScheduleDao.getCloseLiveCourseRoom(null, closeTime);
+        List<CourseSchedule> scheduleList = courseScheduleDao.getCloseLiveCourseRoom(null, closeTime,null);
 
         // 检测直播间是否有直播流
         scheduleList.forEach(data -> {
@@ -5132,6 +5148,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             }
 
         });
-
     }
+
+
 }
+

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -4372,6 +4372,9 @@
             and CONCAT(class_date_,' ',end_class_time_) &lt;= date_format(date_add(now(),interval -#{closeTime} minute),'%Y-%m-%d %H:%i:%s')
             and live_remind_ = 1
         </if>
+        <if test="tenantId != null">
+            and tenant_id_ = #{tenantId}
+        </if>
     </select>
 
     <update id="updateLiveRemind">