Explorar o código

Merge remote-tracking branch 'origin/feature/0529-live' into feature/0529-live

shangke %!s(int64=2) %!d(string=hai) anos
pai
achega
347c49f984

+ 63 - 57
.idea/httpRequests/http-requests-log.http

@@ -1,3 +1,66 @@
+POST http://127.0.0.1:9002/teacherCourseSchedule/liveCoursePage
+authorization: bearer 0071d90f-5623-4ee9-a88e-c7adb09efb1c
+Content-Type: application/json
+Content-Length: 149
+Connection: Keep-Alive
+User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
+Accept-Encoding: br,deflate,gzip,x-gzip
+
+{
+  "page": 1,
+  "rows": 10,
+//  "startTime": "2023-06-06 10:14:57",
+//  "endTime": "2023-06-08 10:14:57",
+//  "search": "",
+  "status": "UNDERWAY"
+}
+
+<> 2023-06-14T173156.200.json
+
+###
+
+POST http://127.0.0.1:9002/teacherCourseSchedule/liveCoursePage
+authorization: bearer 0071d90f-5623-4ee9-a88e-c7adb09efb1c
+Content-Type: application/json
+Content-Length: 150
+Connection: Keep-Alive
+User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
+Accept-Encoding: br,deflate,gzip,x-gzip
+
+{
+  "page": 1,
+  "rows": 10,
+//  "startTime": "2023-06-06 10:14:57",
+//  "endTime": "2023-06-08 10:14:57",
+//  "search": "",
+  "status": "NOT_START"
+}
+
+<> 2023-06-14T173111.200.json
+
+###
+
+POST http://127.0.0.1:9002/teacherCourseSchedule/liveCoursePage
+authorization: bearer a9b023c1-f525-4b95-8723-0ca14b038624
+Content-Type: application/json
+Content-Length: 150
+Connection: Keep-Alive
+User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
+Accept-Encoding: br,deflate,gzip,x-gzip
+
+{
+  "page": 1,
+  "rows": 10,
+//  "startTime": "2023-06-06 10:14:57",
+//  "endTime": "2023-06-08 10:14:57",
+//  "search": "",
+  "status": "NOT_START"
+}
+
+<> 2023-06-14T173045.200.json
+
+###
+
 GET http://127.0.0.1:9001/studentCourseSchedule/queryCourseId?courseId=2162
 Authorization: bearer b2d082f2-2e51-4880-8119-5471c5287bf9
 Connection: Keep-Alive
@@ -625,60 +688,3 @@ Accept-Encoding: br,deflate,gzip,x-gzip
 
 ###
 
-POST http://127.0.0.1:9002/teacherCourseSchedule/liveCoursePage
-authorization: bearer 1238347b-3b06-444e-9d35-d122639121ad
-Content-Type: application/json
-Content-Length: 152
-Connection: Keep-Alive
-User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
-Accept-Encoding: br,deflate,gzip,x-gzip
-
-{
-  "page": 1,
-  "rows": 10,
-//  "startTime": "2023-06-06 10:14:57",
-//  "endTime": "2023-06-08 10:14:57",
-//  "search": "",
-//  "status": "NOT_START"
-}
-
-<> 2023-06-08T155515.200.json
-
-###
-
-POST http://127.0.0.1:9002/teacherAttendance/getLiveCurrentCourseStudents
-authorization: bearer 97fd8e85-bb3c-4967-8a07-47c44957f94a
-Content-Type: application/json
-Content-Length: 70
-Connection: Keep-Alive
-User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
-Accept-Encoding: br,deflate,gzip,x-gzip
-
-{
-  "courseScheduleId": 2001,
-//  "status": "NORMAL",
-  "search": ""
-}
-
-<> 2023-06-08T141058.200.json
-
-###
-
-POST http://127.0.0.1:9002/teacherAttendance/getLiveCurrentCourseStudents
-authorization: bearer 97fd8e85-bb3c-4967-8a07-47c44957f94a
-Content-Type: application/json
-Content-Length: 68
-Connection: Keep-Alive
-User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
-Accept-Encoding: br,deflate,gzip,x-gzip
-
-{
-  "courseScheduleId": 2001,
-  "status": "NORMAL",
-  "search": ""
-}
-
-<> 2023-06-08T141049.200.json
-
-###
-

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/CourseDetailQueryInfo.java

@@ -22,6 +22,16 @@ public class CourseDetailQueryInfo{
     @ApiModelProperty(value = "课程组编号")
     private String groupId;
 
+    public Integer notStartCourseTime;
+
+    public Integer getNotStartCourseTime() {
+        return notStartCourseTime;
+    }
+
+    public void setNotStartCourseTime(Integer notStartCourseTime) {
+        this.notStartCourseTime = notStartCourseTime;
+    }
+
     public String getGroupType() {
         return groupType;
     }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/wrapper/LiveGroupWrapper.java

@@ -109,7 +109,7 @@ public class LiveGroupWrapper {
         private String search;
 
         @ApiModelProperty("课程状态")
-        private CourseStatusEnum status;
+        private String status;
 
         private Integer teacherId;
 

+ 38 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -3951,8 +3951,16 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			queryInfo.setDate(new Date());
 		}
 
+        // 直播课判断时间,提前30分钟将课程改为进行中
+        Integer studentRemindTime = Integer.parseInt(sysConfigService.findByParamName(SysConfigService.LIVE_CLASS_START_REMIND_TIME).getParanValue());
+
 		Map<String, Object> params = new HashMap<>();
 		MapUtil.populateMap(params, queryInfo);
+        params.put("notStartCourseTime", studentRemindTime);
+        if (queryInfo.getClassGroupId() != null) {
+            ClassGroup classGroup = classGroupDao.get(queryInfo.getClassGroupId().intValue());
+            params.put("groupType", classGroup.getGroupType().name());
+        }
 
 		List<TeacherClassCourseSchudeleDto> dataList = null;
 		int count = 0;
@@ -4031,6 +4039,15 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             }
         });
 
+        for (TeacherClassCourseSchudeleDto record : dataList) {
+            if (CourseScheduleType.LIVE.equals(record.getType()) && CourseStatusEnum.NOT_START.equals(record.getStatus())) {
+                Date date = DateUtil.addMinutes(new Date(), studentRemindTime);
+                if (date.after(record.getStartClassTime())) {
+                    record.setStatus(CourseStatusEnum.UNDERWAY);
+                }
+            }
+        }
+
         pageInfo.setRows(dataList);
 		return pageInfo;
 	}
@@ -6065,6 +6082,15 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
     @Override
     public List<CourseScheduleStudentDto> queryDetailList(CourseDetailQueryInfo courseDetailQueryInfo) {
+
+
+        // 直播课判断时间,提前30分钟将课程改为进行中
+        Integer studentRemindTime = Integer.parseInt(sysConfigService.findByParamName(SysConfigService.LIVE_CLASS_START_REMIND_TIME).getParanValue());
+
+        if (StringUtils.isNotBlank(courseDetailQueryInfo.getGroupType())) {
+            courseDetailQueryInfo.setGroupType(courseDetailQueryInfo.getGroupType().toUpperCase());
+        }
+        courseDetailQueryInfo.setNotStartCourseTime(studentRemindTime);
         List<CourseScheduleStudentDto> courseScheduleStudentDtos = courseScheduleDao.queryDetailList(courseDetailQueryInfo);
 
 
@@ -6080,6 +6106,18 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             }
         });
 
+
+        // 直播课判断时间,提前30分钟将课程改为进行中
+        for (CourseScheduleStudentDto record : courseScheduleStudentDtos) {
+            if (CourseStatusEnum.NOT_START.equals(record.getCourseStatus())
+                    && courseDetailQueryInfo.getGroupType().toUpperCase(Locale.ROOT).equals(GroupType.LIVE.getCode())) {
+                Date date = DateUtil.addMinutes(new Date(), studentRemindTime);
+                if (date.after(DateUtil.toDateTime(record.getStartClassTime()))) {
+                    record.setCourseStatus(CourseStatusEnum.UNDERWAY);
+                }
+            }
+        }
+
         return courseScheduleStudentDtos;
     }
 

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

@@ -1542,7 +1542,22 @@
                 AND CONCAT( cs.class_date_, ' ', cs.end_class_time_ )&lt;now()
             </if>
             <if test="status!=null">
-                AND cs.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+                <if test=" groupType == 'LIVE'">
+                    <if test="status.code == 'UNDERWAY'">
+                        AND (cs.status_  = 'UNDERWAY'
+                        or (cs.status_ = 'NOT_START' and  CONCAT(cs.class_date_,' ',cs.start_class_time_) &lt; date_add(now(), interval #{notStartCourseTime} minute))
+                        )
+                    </if>
+                    <if test="status.code == 'NOT_START'">
+                        AND cs.status_ = 'NOT_START' and CONCAT(cs.class_date_,' ',cs.start_class_time_) &gt; date_add(now(), interval #{notStartCourseTime} minute)
+                    </if>
+                    <if test="status.code == 'OVER'">
+                        AND cs.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+                    </if>
+                </if>
+                <if test="groupType != 'LIVE'">
+                    AND cs.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+                </if>
             </if>
             <if test="startClassDate!=null and startClassDate!=''">
                 AND cs.class_date_ &gt;= #{startClassDate}
@@ -4203,7 +4218,22 @@
         left join student_attendance sa ON sa.course_schedule_id_ = cs.id_ AND sa.user_id_ = cssp.user_id_
         where cssp.music_group_id_ = #{queryInfo.groupId} AND cssp.user_id_ = #{queryInfo.userId} AND cssp.group_type_ = #{queryInfo.groupType}
         <if test="queryInfo.courseStatus != null and queryInfo.courseStatus != ''">
-            AND cs.status_ = #{queryInfo.courseStatus}
+            <if test=" queryInfo.groupType == 'LIVE'">
+                <if test="queryInfo.courseStatus == 'UNDERWAY'">
+                    AND (cs.status_  = 'UNDERWAY'
+                    or (cs.status_ = 'NOT_START' and  CONCAT(cs.class_date_,' ',cs.start_class_time_) &lt; date_add(now(), interval #{queryInfo.notStartCourseTime} minute))
+                    )
+                </if>
+                <if test="queryInfo.courseStatus == 'NOT_START'">
+                    AND cs.status_ = 'NOT_START' and CONCAT(cs.class_date_,' ',cs.start_class_time_) &gt; date_add(now(), interval #{queryInfo.notStartCourseTime} minute)
+                </if>
+                <if test="queryInfo.courseStatus == 'OVER'">
+                    AND cs.status_ = 'OVER'
+                </if>
+            </if>
+            <if test="queryInfo.groupType != 'LIVE'">
+                AND cs.status_ = #{queryInfo.courseStatus}
+            </if>
         </if>
         <if test="queryInfo.teachMode != null and queryInfo.teachMode != ''">
             AND cs.teach_mode_ = #{queryInfo.teachMode}

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

@@ -79,6 +79,9 @@
         <if test="param.status == 'NOT_START'">
             AND cs.status_ = 'NOT_START' and CONCAT(cs.class_date_,' ',cs.start_class_time_) &gt; date_add(now(), interval #{param.notStartCourseTime} minute)
         </if>
+        <if test="param.status == 'OVER'">
+            AND cs.status_ = 'OVER'
+        </if>
     </if>
     <if test="param.search != null and param.search != ''">
         AND (cs.name_ LIKE CONCAT('%',#{param.search},'%'))