Sfoglia il codice sorgente

Merge branch 'saas' of http://git.dayaedu.com/yonge/mec into zouxuan_saas_2022_04_07

zouxuan 3 anni fa
parent
commit
94f8dc7b3b

+ 5 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImLiveBroadcastRoomServiceImpl.java

@@ -83,6 +83,8 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
     public static final String LIVE_USER_ROOM = "IM:LIVE_ROOM_USER:" + USER_ID;
     //房间点赞数
     public static final String LIVE_ROOM_LIKE = "IM:LIVE_ROOM_LIKE:" + ROOM_UID;
+    //直播提前开始时间
+    public static final int PRE_LIVE_TIME_MINUTE = 30;
 
     /**
      * 进入直播间检查数据
@@ -111,8 +113,8 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
         optional.filter(r -> r.getRoomState() != 1).orElseThrow(() -> new BizException("直播间不存在"));
         ImLiveBroadcastRoomVo room = optional.get();
         if (room.getLiveState() == 0) {
-            throw new BizException("直播未开始,直播开启的时间是 "
-                    + DateUtil.format(room.getLiveStartTime(), DateUtil.EXPANDED_DATE_TIME_FORMAT));
+            Date liveStartTime = DateUtil.addMinutes(room.getLiveStartTime(), -PRE_LIVE_TIME_MINUTE);
+            throw new BizException(DateUtil.format(liveStartTime, "yyyy年MM月dd日 HH点mm分") + " 可进入直播间准备");
         }
         if (room.getLiveState() == 2) {
             throw new BizException("直播已结束!");
@@ -627,7 +629,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
      */
     public void createLiveRoom() {
         Date now = new Date();
-        Date endTime = DateUtil.addMinutes(now, 30);
+        Date endTime = DateUtil.addMinutes(now, PRE_LIVE_TIME_MINUTE);
         List<ImLiveBroadcastRoom> list = this.list(new WrapperUtil<ImLiveBroadcastRoom>()
                 .hasEq("live_state_", 0)
                 .hasEq("room_state_", 0)

+ 16 - 13
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -3952,7 +3952,7 @@
         FROM course_schedule cs
         LEFT JOIN course_schedule_review csr ON csr.course_schedule_id_ = cs.id_
         LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_
-        LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cs.id_ AND sa.status_ = 'NORMAL'
+        LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cs.id_ AND sa.status_ IN ('NORMAL','LATE')
         LEFT JOIN class_group cg ON cg.id_ = cs.class_group_id_
         LEFT JOIN school s ON s.id_ = cs.schoole_id_
         <include refid="queryCourseEvaluateSql"/>
@@ -3964,13 +3964,13 @@
         SELECT COUNT(DISTINCT cs.id_)
         FROM course_schedule cs
         LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_
-        LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cs.id_ AND sa.status_ = 'NORMAL'
+        LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cs.id_ AND sa.status_ IN ('NORMAL','LATE')
         <include refid="queryCourseEvaluateSql"/>
     </select>
     <select id="countStudyStandard" resultType="java.lang.Integer">
         SELECT COUNT(sa.user_id_)
         FROM student_attendance sa
-        WHERE sa.id_ IS NOT NULL AND sa.course_schedule_id_ = #{courseScheduleId} AND sa.status_ = 'NORMAL'
+        WHERE sa.id_ IS NOT NULL AND sa.course_schedule_id_ = #{courseScheduleId} AND sa.status_ IN ('NORMAL','LATE')
     </select>
     <resultMap id="StudentStandardDto" type="com.ym.mec.biz.dal.dto.StudentStandardDto">
         <result property="courseScheduleId" column="course_schedule_id_"/>
@@ -3990,15 +3990,25 @@
         LEFT JOIN student s ON s.user_id_ = sa.user_id_
         LEFT JOIN `subject` sb ON sb.id_ = s.subject_id_list_
         LEFT JOIN sys_user su ON su.id_ = s.user_id_
-        WHERE sa.id_ IS NOT NULL AND sa.course_schedule_id_ = #{courseScheduleId} AND sa.status_ = 'NORMAL'
+        WHERE sa.id_ IS NOT NULL AND sa.course_schedule_id_ = #{courseScheduleId} AND sa.status_ IN ('NORMAL','LATE')
         <include refid="global.limit"/>
     </select>
+    <sql id="countStudyStandardWaitVisitSql">
+        WHERE csts.user_id_ = #{teacherId} AND cs.evaluate_flag_ = 1 AND sa.qualified_flag_ = 0
+        AND sv.id_ IS NULL AND sa.status_ IN ('NORMAL','LATE')
+        <if test="startDate != null and startDate != ''">
+            AND cs.class_date_ >= #{startDate}
+        </if>
+        <if test="endDate != null and endDate != ''">
+            AND cs.class_date_ &lt;= #{endDate}
+        </if>
+    </sql>
     <select id="countStudyStandardWaitVisit" resultType="java.lang.Integer">
         SELECT COUNT(sa.user_id_) FROM course_schedule cs
         LEFT JOIN course_schedule_teacher_salary csts ON csts.course_schedule_id_ = cs.id_
         LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = csts.course_schedule_id_
         LEFT JOIN student_visit sv ON sv.object_id_ = sa.id_ AND sv.purpose_ = '教学内容未达标'
-        WHERE csts.user_id_ = #{teacherId} AND cs.evaluate_flag_ = 1 AND sa.qualified_flag_ = 0 AND sv.id_ IS NULL
+        <include refid="countStudyStandardWaitVisitSql"/>
     </select>
     <select id="queryStudyStandardWaitVisit" resultMap="StudentStandardDto">
         SELECT su.avatar_,s.user_id_,su.username_,cs.class_date_,sb.name_ subject_name_,
@@ -4011,14 +4021,7 @@
         LEFT JOIN student s ON s.user_id_ = sa.user_id_
         LEFT JOIN `subject` sb ON sb.id_ = s.subject_id_list_
         LEFT JOIN sys_user su ON su.id_ = s.user_id_
-        WHERE csts.user_id_ = #{teacherId} AND cs.evaluate_flag_ = 1 AND sa.qualified_flag_ = 0 AND sv.id_ IS NULL
-        AND sa.status_ = 'NORMAL'
-        <if test="startDate != null and startDate != ''">
-            AND cs.class_date_ >= #{startDate}
-        </if>
-        <if test="endDate != null and endDate != ''">
-            AND cs.class_date_ &lt;= #{endDate}
-        </if>
+        <include refid="countStudyStandardWaitVisitSql"/>
         ORDER BY cs.class_date_ DESC,cs.start_class_time_ DESC
         <include refid="global.limit"/>
     </select>

+ 17 - 13
mec-im/src/main/java/com/ym/controller/RoomController.java

@@ -84,19 +84,23 @@ public class RoomController{
 
     @RequestMapping(value = "/statusSync")
     public void statusSync(@RequestBody String body) throws Exception {
-        ChannelStateNotify notify = JSONObject.parseObject(body, ChannelStateNotify.class);
-        log.info("statusSyncParam: {}",JSONObject.toJSON(notify));
-        String roomId = notify.getChannelId();
-        String userId = notify.getUserId();
-        switch (notify.getEvent()){
-            case 11:
-                //成员加入
-                roomService.joinRoomSuccess(roomId, userId,null);
-                break;
-            case 12:
-                //成员退出
-                roomService.leaveRoomSuccess(roomId, userId,null);
-                break;
+        try {
+            ChannelStateNotify notify = JSONObject.parseObject(body, ChannelStateNotify.class);
+            log.info("statusSyncParam: {}",JSONObject.toJSON(notify));
+            String roomId = notify.getChannelId();
+            String userId = notify.getUserId();
+            switch (notify.getEvent()){
+                case 11:
+                    //成员加入
+                    roomService.joinRoomSuccess(roomId, userId,null);
+                    break;
+                case 12:
+                    //成员退出
+                    roomService.leaveRoomSuccess(roomId, userId,null);
+                    break;
+            }
+        }catch (Exception e){
+            log.error(e.getLocalizedMessage());
         }
     }