Browse Source

直播获取时间

tags/正式版本
雍文秀 2 years ago
parent
commit
917ee57aea

+ 0
- 20
slive/src/main/java/com/xhkjedu/slive/mapper/liveplay/CourseSectionMapper.java View File

25
     //课节统计
25
     //课节统计
26
     Map<String, Integer> analyze(Integer sectionid, Integer classid);
26
     Map<String, Integer> analyze(Integer sectionid, Integer classid);
27
 
27
 
28
-    //修改课节回放信息
29
-    //void updatePlayback(@Param("section") LCourseSection section);
30
-
31
     //根据日期获取教师课节列表
28
     //根据日期获取教师课节列表
32
     List<CourseSectionVo> listByDate(@Param("section") LCourseSection section);
29
     List<CourseSectionVo> listByDate(@Param("section") LCourseSection section);
33
     //根据日期获取巡课课节列表
30
     //根据日期获取巡课课节列表
62
     //获取课程教师id集合
59
     //获取课程教师id集合
63
     List<Integer> listTeacherId(Integer courseid);
60
     List<Integer> listTeacherId(Integer courseid);
64
 
61
 
65
-    //获取要结束课节id集合
66
-    String listEndSectionId();
67
-
68
-    //结束课节
69
-    void updateSectionState2(@Param("sectionids") String sectionids);
70
-    //修改已过期课节状态
71
-    void updateSectionState3();
72
-
73
     //更新课节学生在线状态为下线
62
     //更新课节学生在线状态为下线
74
     void updateStuOnLined(@Param("sectionids") List<Integer> sectionids,@Param("nowtime") Integer nowtime);
63
     void updateStuOnLined(@Param("sectionids") List<Integer> sectionids,@Param("nowtime") Integer nowtime);
75
 
64
 
76
-    //获取直播中用户id列表
77
-    List<Integer> listUserId();
78
-
79
-    //获取要结束的直播用户id列表
80
-    List<Integer> listUserId2(@Param("sectionids") String sectionids);
81
-
82
-    //获取直播中用户id列表
83
-    List<Integer> listUserId3(@Param("sectionids") String sectionids);
84
-
85
     CourseVo getCourseBySectionId(Integer sectionid);
65
     CourseVo getCourseBySectionId(Integer sectionid);
86
 
66
 
87
     //我的月份下日期课节数量
67
     //我的月份下日期课节数量

+ 3
- 0
slive/src/main/java/com/xhkjedu/slive/model/liveplay/LCourse.java View File

106
 
106
 
107
     @Transient
107
     @Transient
108
     private String teachername;//教师姓名
108
     private String teachername;//教师姓名
109
+
110
+    @Transient
111
+    private String strtime;//当前时间
109
 }
112
 }

+ 3
- 0
slive/src/main/java/com/xhkjedu/slive/model/liveplay/LCourseSection.java View File

75
 
75
 
76
     @Transient
76
     @Transient
77
     private String subjectid;//科目id
77
     private String subjectid;//科目id
78
+
79
+    @Transient
80
+    private String strtime;//当前时间
78
 }
81
 }

+ 12
- 8
slive/src/main/java/com/xhkjedu/slive/service/liveplay/CourseSectionService.java View File

196
             Callable<String> call = new Callable() {
196
             Callable<String> call = new Callable() {
197
                 @Override
197
                 @Override
198
                 public String call() throws IOException {
198
                 public String call() throws IOException {
199
-                    /*//修改已过期课节状态
200
-                    courseSectionMapper.updateSectionState3();
201
-                    //获取要结束课节id集合
202
-                    String sectionids = courseSectionMapper.listEndSectionId();
203
-                    if (N_Utils.isEmpty(sectionids)) return "执行成功";
204
-                    //结束课节
205
-                    courseSectionMapper.updateSectionState2(sectionids);*/
206
-
207
                     List<CourseSectionVo> sections = courseSectionMapper.listPendingSection();//获取要处理的课节
199
                     List<CourseSectionVo> sections = courseSectionMapper.listPendingSection();//获取要处理的课节
208
                     if (N_Utils.isListEmpty(sections)) return "执行成功";
200
                     if (N_Utils.isListEmpty(sections)) return "执行成功";
209
                     List<Integer> sectionids = new ArrayList<>();
201
                     List<Integer> sectionids = new ArrayList<>();
244
 
236
 
245
     //根据日期获取教师课节列表
237
     //根据日期获取教师课节列表
246
     public List<CourseSectionVo> listByDate(LCourseSection section) {
238
     public List<CourseSectionVo> listByDate(LCourseSection section) {
239
+        int timestamp = N_Utils.getSecondTimestamp();
240
+        String strtime = N_Utils.getStrtimeTimestamp(timestamp, "yyyy-MM-dd HH:mm");
241
+        section.setStrtime(strtime);
247
         return courseSectionMapper.listByDate(section);
242
         return courseSectionMapper.listByDate(section);
248
     }
243
     }
249
 
244
 
250
     //根据日期获取巡课课节列表
245
     //根据日期获取巡课课节列表
251
     public List<CourseSectionVo> listXkByDate(CourseParams p) {
246
     public List<CourseSectionVo> listXkByDate(CourseParams p) {
247
+        int timestamp = N_Utils.getSecondTimestamp();
248
+        String strtime = N_Utils.getStrtimeTimestamp(timestamp, "yyyy-MM-dd HH:mm");
249
+        p.setStrtime(strtime);
252
         return courseSectionMapper.listXkByDate(p);
250
         return courseSectionMapper.listXkByDate(p);
253
     }
251
     }
254
 
252
 
336
 
334
 
337
     //我的课程列表
335
     //我的课程列表
338
     public List<Map> listMySection(CourseParams params) {
336
     public List<Map> listMySection(CourseParams params) {
337
+        int timestamp = N_Utils.getSecondTimestamp();
338
+        String strtime = N_Utils.getStrtimeTimestamp(timestamp, "yyyy-MM-dd HH:mm");
339
+        params.setStrtime(strtime);
339
         return courseSectionMapper.listMySection(params);
340
         return courseSectionMapper.listMySection(params);
340
     }
341
     }
341
 
342
 
402
 
403
 
403
     //学生课节列表
404
     //学生课节列表
404
     public List<Map> listStuByDate(CourseParams params) {
405
     public List<Map> listStuByDate(CourseParams params) {
406
+        int timestamp = N_Utils.getSecondTimestamp();
407
+        String strtime = N_Utils.getStrtimeTimestamp(timestamp, "yyyy-MM-dd HH:mm");
408
+        params.setStrtime(strtime);
405
         return courseSectionMapper.listStuByDate(params);
409
         return courseSectionMapper.listStuByDate(params);
406
     }
410
     }
407
 }
411
 }

+ 5
- 0
slive/src/main/java/com/xhkjedu/slive/service/liveplay/CourseService.java View File

412
 
412
 
413
     //分类下课程
413
     //分类下课程
414
     public List<CourseTypeVo> listAllForStu(LCourse course) {
414
     public List<CourseTypeVo> listAllForStu(LCourse course) {
415
+        course.setCreatetime(N_Utils.getSecondTimestamp());
415
         //获取所有课程
416
         //获取所有课程
416
         List<CourseVo> courselst = courseMapper.listAllForStu(course);
417
         List<CourseVo> courselst = courseMapper.listAllForStu(course);
417
 
418
 
459
 
460
 
460
     //课程列表
461
     //课程列表
461
     public List<CourseVo> listAllForStu2(LCourse course) {
462
     public List<CourseVo> listAllForStu2(LCourse course) {
463
+        course.setCreatetime(N_Utils.getSecondTimestamp());
462
         return courseMapper.listAllForStu2(course);
464
         return courseMapper.listAllForStu2(course);
463
     }
465
     }
464
 
466
 
543
 
545
 
544
     //指定日期的课节列表
546
     //指定日期的课节列表
545
     public List<CourseSectionVo> listSectionsByDate(CourseParams p){
547
     public List<CourseSectionVo> listSectionsByDate(CourseParams p){
548
+        int timestamp = N_Utils.getSecondTimestamp();
549
+        String strtime = N_Utils.getStrtimeTimestamp(timestamp, "yyyy-MM-dd HH:mm");
550
+        p.setStrtime(strtime);
546
         return courseMapper.listSectionsByDate(p);
551
         return courseMapper.listSectionsByDate(p);
547
     }
552
     }
548
 
553
 

+ 3
- 0
slive/src/main/java/com/xhkjedu/slive/service/liveplay/CsService.java View File

213
 
213
 
214
     //我的课程列表
214
     //我的课程列表
215
     public List<Map> listMySection(CourseParams params) {
215
     public List<Map> listMySection(CourseParams params) {
216
+        int timestamp = N_Utils.getSecondTimestamp();
217
+        String strtime = N_Utils.getStrtimeTimestamp(timestamp, "yyyy-MM-dd HH:mm");
218
+        params.setStrtime(strtime);
216
         return csMapper.listMySection(params);
219
         return csMapper.listMySection(params);
217
     }
220
     }
218
 }
221
 }

+ 3
- 1
slive/src/main/java/com/xhkjedu/slive/service/xz/XzService.java View File

680
         try {
680
         try {
681
 
681
 
682
             //保存直播关联班级
682
             //保存直播关联班级
683
+            int timestamp = N_Utils.getSecondTimestamp();
683
             LCourseClass courseClass = new LCourseClass();
684
             LCourseClass courseClass = new LCourseClass();
684
             courseClass.setCourseid(courseVo.getCourseid());
685
             courseClass.setCourseid(courseVo.getCourseid());
685
             courseClass.setClassid(kjTeaVo.getClassid());
686
             courseClass.setClassid(kjTeaVo.getClassid());
686
             courseClass.setCreateid(kjTeaVo.getTeacherid());
687
             courseClass.setCreateid(kjTeaVo.getTeacherid());
687
-            courseClass.setCreatetime(N_Utils.getSecondTimestamp());
688
+            courseClass.setCreatetime(timestamp);
688
             courseClassMapper.insertUseGeneratedKeys(courseClass);
689
             courseClassMapper.insertUseGeneratedKeys(courseClass);
689
 
690
 
690
             //说明该教师当前有其他直播课,则把班级加入课程,完成直播课学生数量
691
             //说明该教师当前有其他直播课,则把班级加入课程,完成直播课学生数量
692
             cs.setSchoolid(kjTeaVo.getSchoolid());
693
             cs.setSchoolid(kjTeaVo.getSchoolid());
693
             cs.setClassid(kjTeaVo.getClassid());
694
             cs.setClassid(kjTeaVo.getClassid());
694
             cs.setCreateid(kjTeaVo.getCreateid());
695
             cs.setCreateid(kjTeaVo.getCreateid());
696
+            cs.setCreatetime(timestamp);
695
             classStudentMapper.saveAllClassStu(cs, courseVo.getClassid());
697
             classStudentMapper.saveAllClassStu(cs, courseVo.getClassid());
696
             //获取直播班对应全班学生分组id
698
             //获取直播班对应全班学生分组id
697
             Integer groupid = groupMapper.getGroupIdByClassid(courseVo.getClassid());
699
             Integer groupid = groupMapper.getGroupIdByClassid(courseVo.getClassid());

+ 1
- 0
slive/src/main/java/com/xhkjedu/slive/vo/liveplay/CourseParams.java View File

37
     private Integer pageSize;//分页显示条数
37
     private Integer pageSize;//分页显示条数
38
 
38
 
39
     private String sectionname;//课节名称
39
     private String sectionname;//课节名称
40
+    private String strtime;//当前时间
40
 }
41
 }

+ 1
- 1
slive/src/main/resources/mapper/gradeclass/ClassStudentMapper.xml View File

20
     <!--保存班级学生到指定班级-->
20
     <!--保存班级学生到指定班级-->
21
     <insert id="saveAllClassStu">
21
     <insert id="saveAllClassStu">
22
         insert ignore into t_class_student (classid,studentid,createid,createtime,schoolid)
22
         insert ignore into t_class_student (classid,studentid,createid,createtime,schoolid)
23
-        SELECT #{zbclassid},studentid,#{student.createid}, UNIX_TIMESTAMP(),#{student.schoolid} FROM t_class_student WHERE classid=#{student.classid};
23
+        SELECT #{zbclassid},studentid,#{student.createid},#{student.createtime},#{student.schoolid} FROM t_class_student WHERE classid=#{student.classid};
24
     </insert>
24
     </insert>
25
     <!--班级学生列表-->
25
     <!--班级学生列表-->
26
     <select id="listByClassIds" resultType="com.xhkjedu.slive.vo.gradeclass.CStudentVo">
26
     <select id="listByClassIds" resultType="com.xhkjedu.slive.vo.gradeclass.CStudentVo">

+ 1
- 1
slive/src/main/resources/mapper/gradeclass/GroupMapper.xml View File

15
     <!--保存全部分组学生-->
15
     <!--保存全部分组学生-->
16
     <insert id="saveAllClassGroupStu">
16
     <insert id="saveAllClassGroupStu">
17
         insert ignore into t_group_student (classid,groupid,studentid,createid,createtime,schoolid)
17
         insert ignore into t_group_student (classid,groupid,studentid,createid,createtime,schoolid)
18
-        SELECT #{zbclassid},#{zbgroupid},studentid,#{student.createid}, UNIX_TIMESTAMP(),#{student.schoolid} FROM t_class_student WHERE classid=#{student.classid};
18
+        SELECT #{zbclassid},#{zbgroupid},studentid,#{student.createid},#{student.createtime},#{student.schoolid} FROM t_class_student WHERE classid=#{student.classid};
19
     </insert>
19
     </insert>
20
 </mapper>
20
 </mapper>

+ 6
- 6
slive/src/main/resources/mapper/liveplay/CourseMapper.xml View File

88
     <select id="listSection" resultType="com.xhkjedu.slive.vo.liveplay.CourseSectionVo">
88
     <select id="listSection" resultType="com.xhkjedu.slive.vo.liveplay.CourseSectionVo">
89
         select cs.sectionid,cs.sectionname,cs.sectiondate,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate
89
         select cs.sectionid,cs.sectionname,cs.sectiondate,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate
90
         ,cs.teacherid,cs.createid,cs.stunum,cs.sectionorder
90
         ,cs.teacherid,cs.createid,cs.stunum,cs.sectionorder
91
-        ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planbegintime))) totaltime
91
+        ,TIMESTAMPDIFF(SECOND,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.planbegintime)) totaltime
92
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
92
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
93
         ,(select u.username from t_user u where u.userid=cs.teacherid)teachername
93
         ,(select u.username from t_user u where u.userid=cs.teacherid)teachername
94
         from l_course_section cs where cs.courseid=#{courseid}
94
         from l_course_section cs where cs.courseid=#{courseid}
95
-        order by UNIX_TIMESTAMP(concat(cs.sectiondate,' ',cs.planbegintime))
95
+        order by cs.sectiondate,cs.planbegintime
96
     </select>
96
     </select>
97
     <!--学生选课详情-->
97
     <!--学生选课详情-->
98
     <select id="findById" resultMap="courseResult">
98
     <select id="findById" resultMap="courseResult">
220
         left join t_subject s on c.subjectid = s.subjectid
220
         left join t_subject s on c.subjectid = s.subjectid
221
         left join l_course_type ct on c.ctypeid = ct.ctypeid
221
         left join l_course_type ct on c.ctypeid = ct.ctypeid
222
         where c.schoolid=#{course.schoolid} and c.coursetype=0 and c.deleted=1 and c.coursestate!=3
222
         where c.schoolid=#{course.schoolid} and c.coursetype=0 and c.deleted=1 and c.coursestate!=3
223
-        and c.limitstamp>=unix_timestamp(now())
223
+        and c.limitstamp>=#{course.createtime}
224
         <if test="course.gradeid!=null and course.gradeid!=0">
224
         <if test="course.gradeid!=null and course.gradeid!=0">
225
             and c.gradeid=#{course.gradeid}
225
             and c.gradeid=#{course.gradeid}
226
         </if>
226
         </if>
258
         left join t_user u on lcs.teacherid=u.userid
258
         left join t_user u on lcs.teacherid=u.userid
259
         left join t_subject s on c.subjectid = s.subjectid
259
         left join t_subject s on c.subjectid = s.subjectid
260
         where c.schoolid=#{course.schoolid} and c.coursetype=0 and c.ctypeid=#{course.ctypeid} and c.deleted=1 and c.coursestate!=3
260
         where c.schoolid=#{course.schoolid} and c.coursetype=0 and c.ctypeid=#{course.ctypeid} and c.deleted=1 and c.coursestate!=3
261
-        and c.limitstamp>=unix_timestamp(now())
261
+        and c.limitstamp>=#{course.createtime}
262
         <if test="course.gradeid!=null and course.gradeid!=0">
262
         <if test="course.gradeid!=null and course.gradeid!=0">
263
             and c.gradeid=#{course.gradeid}
263
             and c.gradeid=#{course.gradeid}
264
         </if>
264
         </if>
289
         select cs.courseid,cs.sectionid,c.coursename,c.classid,cs.sectionname,cs.sectiondate,cs.planbegintime,
289
         select cs.courseid,cs.sectionid,c.coursename,c.classid,cs.sectionname,cs.sectiondate,cs.planbegintime,
290
         cs.planendtime,cs.begintime,cs.endtime,cs.teacherid,u.username as teachername,cs.sectionstate,
290
         cs.planendtime,cs.begintime,cs.endtime,cs.teacherid,u.username as teachername,cs.sectionstate,
291
         c.subjectid,st.subjectname
291
         c.subjectid,st.subjectname
292
-        ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planbegintime))) totaltime
292
+        ,TIMESTAMPDIFF(SECOND,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.planbegintime)) totaltime
293
         ,cs.stunum,cs.sectionorder
293
         ,cs.stunum,cs.sectionorder
294
         ,c.coursenum
294
         ,c.coursenum
295
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
295
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
309
             and cs.sectionstate=#{cp.cstate}
309
             and cs.sectionstate=#{cp.cstate}
310
         </if>
310
         </if>
311
         group by cs.sectionid
311
         group by cs.sectionid
312
-        order by cs.sectionstate,abs(UNIX_TIMESTAMP(concat(cs.sectiondate,' ',cs.planbegintime))-UNIX_TIMESTAMP(now())),cs.sectionid
312
+        order by cs.sectionstate,abs(timestampdiff(second,concat(cs.sectiondate,' ',cs.planbegintime),#{cp.strtime})),cs.sectionid
313
     </select>
313
     </select>
314
 
314
 
315
     <!--教师某月份下日期课程数量-->
315
     <!--教师某月份下日期课程数量-->

+ 15
- 56
slive/src/main/resources/mapper/liveplay/CourseSectionMapper.xml View File

5
     <select id="listByCourseId" resultType="com.xhkjedu.slive.vo.liveplay.CourseSectionVo">
5
     <select id="listByCourseId" resultType="com.xhkjedu.slive.vo.liveplay.CourseSectionVo">
6
         select cs.sectionid,cs.sectionname,cs.sectiondate,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate
6
         select cs.sectionid,cs.sectionname,cs.sectiondate,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate
7
         ,cs.teacherid,cs.createid,cs.stunum,cs.sectionorder
7
         ,cs.teacherid,cs.createid,cs.stunum,cs.sectionorder
8
-        ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planbegintime))) totaltime
8
+        ,timestampdiff(second,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.planbegintime)) totaltime
9
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
9
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
10
         ,(select u.username from t_user u where u.userid=cs.teacherid)teachername
10
         ,(select u.username from t_user u where u.userid=cs.teacherid)teachername
11
         from l_course_section cs where cs.courseid=#{courseid}
11
         from l_course_section cs where cs.courseid=#{courseid}
12
         <if test="teacherid!=null and teacherid!=0"> and cs.teacherid=#{teacherid}</if>
12
         <if test="teacherid!=null and teacherid!=0"> and cs.teacherid=#{teacherid}</if>
13
-        order by UNIX_TIMESTAMP(concat(sectiondate,' ',planbegintime))
13
+        order by sectiondate,planbegintime
14
     </select>
14
     </select>
15
     <!--修改课节状态-->
15
     <!--修改课节状态-->
16
     <update id="updateState">
16
     <update id="updateState">
28
         </if>
28
         </if>
29
         where cs.sectionid=#{section.sectionid} and cs.sectionstate=0
29
         where cs.sectionid=#{section.sectionid} and cs.sectionstate=0
30
     </update>
30
     </update>
31
-    <!--获取要结束课节id集合-->
32
-    <select id="listEndSectionId" resultType="java.lang.String">
33
-        select group_concat(sectionid) from l_course_section
34
-        where sectionstate=2 and UNIX_TIMESTAMP(CONCAT(sectiondate,' ',planendtime))<![CDATA[ < ]]>UNIX_TIMESTAMP(now())
35
-    </select>
36
-    <!--结束课节-->
37
-    <update id="updateSectionState2">
38
-        update l_course_section cs
39
-        set cs.sectionstate=3,cs.endtime=cs.planendtime
40
-        where cs.sectionid in (${sectionids})
41
-    </update>
42
-    <!--修改已过期课节状态-->
43
-    <update id="updateSectionState3">
44
-        update l_course_section set sectionstate=4
45
-        where sectionstate=0 and UNIX_TIMESTAMP(CONCAT(sectiondate,' ',planendtime))<![CDATA[ < ]]>UNIX_TIMESTAMP(now())
46
-    </update>
47
     <!--获取要处理的课节-->
31
     <!--获取要处理的课节-->
48
     <select id="listPendingSection" resultType="com.xhkjedu.slive.vo.liveplay.CourseSectionVo">
32
     <select id="listPendingSection" resultType="com.xhkjedu.slive.vo.liveplay.CourseSectionVo">
49
         SELECT cs.sectionid,cs.sectionstate,cs.planendtime FROM l_course_section cs WHERE cs.sectionstate BETWEEN 0 AND 2
33
         SELECT cs.sectionid,cs.sectionstate,cs.planendtime FROM l_course_section cs WHERE cs.sectionstate BETWEEN 0 AND 2
102
     <select id="listByDate" resultType="com.xhkjedu.slive.vo.liveplay.CourseSectionVo">
86
     <select id="listByDate" resultType="com.xhkjedu.slive.vo.liveplay.CourseSectionVo">
103
         select c.coursename,cs.courseid,cs.sectionid,cs.sectionname,cs.sectiondate,cs.teacherid,cs.createid
87
         select c.coursename,cs.courseid,cs.sectionid,cs.sectionname,cs.sectiondate,cs.teacherid,cs.createid
104
         ,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate,cs.stunum,cs.sectionorder
88
         ,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate,cs.stunum,cs.sectionorder
105
-        ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planbegintime))) totaltime
89
+        ,timestampdiff(second,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.planbegintime)) totaltime
106
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
90
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
107
         ,(select group_concat(distinct u.username separator '、')
91
         ,(select group_concat(distinct u.username separator '、')
108
         from t_user u left join l_course_section s on s.teacherid=u.userid where s.courseid=cs.courseid)teachername
92
         from t_user u left join l_course_section s on s.teacherid=u.userid where s.courseid=cs.courseid)teachername
126
         <if test="section.classid!=null and section.classid!=0">
110
         <if test="section.classid!=null and section.classid!=0">
127
             and cc.classid=#{section.classid}
111
             and cc.classid=#{section.classid}
128
         </if>
112
         </if>
129
-        order by cs.sectionstate,abs(UNIX_TIMESTAMP(concat(cs.sectiondate,' ',cs.planbegintime))-UNIX_TIMESTAMP(now())),cs.sectionid
113
+        order by cs.sectionstate,abs(timestampdiff(second,concat(cs.sectiondate,' ',cs.planbegintime),#{section.strtime})),cs.sectionid
130
     </select>
114
     </select>
131
     <!--根据日期获取巡课课节列表-->
115
     <!--根据日期获取巡课课节列表-->
132
     <select id="listXkByDate" resultType="com.xhkjedu.slive.vo.liveplay.CourseSectionVo">
116
     <select id="listXkByDate" resultType="com.xhkjedu.slive.vo.liveplay.CourseSectionVo">
133
         select c.coursename,c.comm,cs.courseid,cs.sectionid,cs.sectionname,cs.sectiondate,cs.teacherid,cs.createid
117
         select c.coursename,c.comm,cs.courseid,cs.sectionid,cs.sectionname,cs.sectiondate,cs.teacherid,cs.createid
134
         ,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate,c.stunum,cs.sectionorder
118
         ,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate,c.stunum,cs.sectionorder
135
-        ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planbegintime))) totaltime
119
+        ,timestampdiff(second,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.planbegintime)) totaltime
136
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
120
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
137
         ,concat('[',group_concat(distinct json_object('teachername',u.username,'headpic',u.headpic)),']')teachername
121
         ,concat('[',group_concat(distinct json_object('teachername',u.username,'headpic',u.headpic)),']')teachername
138
         ,c.gradeid,c.subjectid,s.subjectname,s.level,s.subjectorder
122
         ,c.gradeid,c.subjectid,s.subjectname,s.level,s.subjectorder
163
             and cc.classid in (${section.classids})
147
             and cc.classid in (${section.classids})
164
         </if>
148
         </if>
165
         group by cs.sectionid
149
         group by cs.sectionid
166
-        order by cs.sectionstate,abs(UNIX_TIMESTAMP(concat(cs.sectiondate,' ',cs.planbegintime))-UNIX_TIMESTAMP(now())),cs.sectionid
150
+        order by cs.sectionstate,abs(timestampdiff(second,concat(cs.sectiondate,' ',cs.planbegintime),#{section.strtime})),cs.sectionid
167
     </select>
151
     </select>
168
     <!--修改教师上课时长-->
152
     <!--修改教师上课时长-->
169
     <update id="updateTime">
153
     <update id="updateTime">
178
     <!--课节报告-->
162
     <!--课节报告-->
179
     <select id="getReport" resultMap="reportResult">
163
     <select id="getReport" resultMap="reportResult">
180
         select cs.sectionid,cs.sectionname,cs.sectiondate,cs.begintime,cs.endtime,cs.sectionstate,cs.stunum
164
         select cs.sectionid,cs.sectionname,cs.sectiondate,cs.begintime,cs.endtime,cs.sectionstate,cs.stunum
181
-        ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-
182
-          UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',ifnull(cs.begintime,cs.planbegintime))))totaltime
165
+        ,timestampdiff(second,CONCAT(cs.sectiondate,' ',cs.planendtime)
166
+        ,CONCAT(cs.sectiondate,' ',ifnull(cs.begintime,cs.planbegintime)))totaltime
183
         ,c.classid,c1.classname,truncate(cs.stunum*100/c1.classnum,2)cqrate
167
         ,c.classid,c1.classname,truncate(cs.stunum*100/c1.classnum,2)cqrate
184
         ,(select u.username from t_user u where u.userid=cs.teacherid)teachername
168
         ,(select u.username from t_user u where u.userid=cs.teacherid)teachername
185
         ,(select count(*) from l_course_section_chatroom csc where csc.sectionid=cs.sectionid and csc.usertype=2)msgnum
169
         ,(select count(*) from l_course_section_chatroom csc where csc.sectionid=cs.sectionid and csc.usertype=2)msgnum
221
         ,(select count(*) from l_course_section_chatroom c where c.sectionid=css2.sectionid and c.userid=css2.studentid)msgnum
205
         ,(select count(*) from l_course_section_chatroom c where c.sectionid=css2.sectionid and c.userid=css2.studentid)msgnum
222
         ,(select count(*) from l_course_section_playback_see s where s.sectionid=css2.sectionid and s.userid=css2.studentid)seenum
206
         ,(select count(*) from l_course_section_playback_see s where s.sectionid=css2.sectionid and s.userid=css2.studentid)seenum
223
         from(select css.studentid,css.sectionid,css.tostamp,css.outstamp,css.totaltime,css.device
207
         from(select css.studentid,css.sectionid,css.tostamp,css.outstamp,css.totaltime,css.device
224
-        ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-
225
-          UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',ifnull(cs.begintime,cs.planbegintime))))totaltime2
208
+        ,timestampdiff(second,CONCAT(cs.sectiondate,' ',cs.planendtime)
209
+        ,CONCAT(cs.sectiondate,' ',ifnull(cs.begintime,cs.planbegintime)))totaltime2
226
         from l_course_section_student css
210
         from l_course_section_student css
227
         left join l_course_section cs on css.sectionid=cs.sectionid
211
         left join l_course_section cs on css.sectionid=cs.sectionid
228
         where css.sectionid=#{section.sectionid})css2 left join t_user u on css2.studentid=u.userid
212
         where css.sectionid=#{section.sectionid})css2 left join t_user u on css2.studentid=u.userid
235
     </select>
219
     </select>
236
     <!--获取课节时长和课程类型-->
220
     <!--获取课节时长和课程类型-->
237
     <select id="getTotalTime" resultType="com.xhkjedu.slive.vo.liveplay.CourseVo">
221
     <select id="getTotalTime" resultType="com.xhkjedu.slive.vo.liveplay.CourseVo">
238
-        select UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,'
239
-        ',cs.begintime))duration
222
+        select timestampdiff(second,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.begintime))duration
240
         ,(select c.coursetype from l_course c where c.courseid=cs.courseid)coursetype
223
         ,(select c.coursetype from l_course c where c.courseid=cs.courseid)coursetype
241
         from l_course_section cs where cs.sectionid=#{sectionid}
224
         from l_course_section cs where cs.sectionid=#{sectionid}
242
     </select>
225
     </select>
315
         where cst.satid=#{satid}
298
         where cst.satid=#{satid}
316
     </select>
299
     </select>
317
 
300
 
318
-    <!--获取直播中用户id列表-->
319
-    <select id="listUserId" resultType="java.lang.Integer">
320
-        select cs.studentid
321
-        from t_class_student cs right join l_course c on cs.classid=c.classid
322
-        right join l_course_section s on c.courseid=s.courseid
323
-        where s.sectionstate=2 group by cs.studentid
324
-        union select s.teacherid from l_course_section s where s.sectionstate=2 group by s.teacherid
325
-    </select>
326
-    <!--获取要结束的直播用户id列表-->
327
-    <select id="listUserId2" resultType="java.lang.Integer">
328
-        select cs.studentid
329
-        from l_course_section_student cs right join l_course_section s on cs.sectionid=s.sectionid
330
-        where s.sectionid in (${sectionids}) group by cs.studentid
331
-        union select s.teacherid from l_course_section s
332
-        where s.sectionid in (${sectionids}) group by s.teacherid
333
-    </select>
334
-    <!--获取直播中用户id列表-->
335
-    <select id="listUserId3" resultType="java.lang.Integer">
336
-        select cs.studentid
337
-        from l_course_section_student cs right join l_course_section s on cs.sectionid=s.sectionid
338
-        where s.sectionstate=2 and s.sectionid not in (${sectionids}) group by cs.studentid
339
-        union select s.teacherid from l_course_section s
340
-        where s.sectionstate=2 and s.sectionid not in (${sectionids}) group by s.teacherid
341
-    </select>
342
     <!--我的月份下日期课节数量-->
301
     <!--我的月份下日期课节数量-->
343
     <select id="listMySectionDate" resultType="java.util.Map">
302
     <select id="listMySectionDate" resultType="java.util.Map">
344
         select cs.sectiondate as timestr,count(distinct cs.sectionid)as num
303
         select cs.sectiondate as timestr,count(distinct cs.sectionid)as num
362
         ,(select t.typename from l_course_type t where t.ctypeid=c.ctypeid)typename
321
         ,(select t.typename from l_course_type t where t.ctypeid=c.ctypeid)typename
363
         ,cs.sectionid,cs.sectionname,cs.sectiondate,cs.teacherid,cs.stunum cynum
322
         ,cs.sectionid,cs.sectionname,cs.sectiondate,cs.teacherid,cs.stunum cynum
364
         ,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate
323
         ,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate
365
-        ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planbegintime))) totaltime
324
+        ,timestampdiff(second,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.planbegintime)) totaltime
366
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
325
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
367
         from l_course_section cs left join l_course c on cs.courseid = c.courseid
326
         from l_course_section cs left join l_course c on cs.courseid = c.courseid
368
         where cs.teacherid=#{section.teacherid} and c.deleted=1 and cs.sectiondate=#{section.timestr}
327
         where cs.teacherid=#{section.teacherid} and c.deleted=1 and cs.sectiondate=#{section.timestr}
372
         <if test="section.sectionname!=null and section.sectionname!=''">
331
         <if test="section.sectionname!=null and section.sectionname!=''">
373
             and cs.sectionname like '%${section.sectionname}%'
332
             and cs.sectionname like '%${section.sectionname}%'
374
         </if>
333
         </if>
375
-        order by cs.sectionstate,abs(UNIX_TIMESTAMP(concat(cs.sectiondate,' ',cs.planbegintime))-UNIX_TIMESTAMP(now())),cs.sectionid
334
+        order by cs.sectionstate,abs(timestampdiff(second,concat(cs.sectiondate,' ',cs.planbegintime),#{section.strtime})),cs.sectionid
376
     </select>
335
     </select>
377
     <!--根据课节id获取课程状态-->
336
     <!--根据课节id获取课程状态-->
378
     <select id="getCourseBySectionId" resultType="com.xhkjedu.slive.vo.liveplay.CourseVo">
337
     <select id="getCourseBySectionId" resultType="com.xhkjedu.slive.vo.liveplay.CourseVo">
470
         select c.courseid,c.gradeid,c.stunum,c.comm,c.createid,c.classid
429
         select c.courseid,c.gradeid,c.stunum,c.comm,c.createid,c.classid
471
         ,cs.sectionid,cs.sectionname,cs.sectiondate,cs.teacherid,cs.stunum cynum
430
         ,cs.sectionid,cs.sectionname,cs.sectiondate,cs.teacherid,cs.stunum cynum
472
         ,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate
431
         ,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate
473
-        ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planbegintime))) totaltime
432
+        ,timestampdiff(second,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.planbegintime)) totaltime
474
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
433
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
475
         ,(select s.subjectname from t_subject s where s.subjectid=c.subjectid)subjectname
434
         ,(select s.subjectname from t_subject s where s.subjectid=c.subjectid)subjectname
476
         ,u.username teachername,u.headpic
435
         ,u.username teachername,u.headpic
487
         <if test="section.sectionname!=null and section.sectionname!=''">
446
         <if test="section.sectionname!=null and section.sectionname!=''">
488
             and cs.sectionname like '%${section.sectionname}%'
447
             and cs.sectionname like '%${section.sectionname}%'
489
         </if>
448
         </if>
490
-        order by cs.sectionstate,abs(UNIX_TIMESTAMP(concat(cs.sectiondate,' ',cs.planbegintime))-UNIX_TIMESTAMP(now())),cs.sectionid
449
+        order by cs.sectionstate,abs(timestampdiff(second,concat(cs.sectiondate,' ',cs.planbegintime),#{section.strtime})),cs.sectionid
491
     </select>
450
     </select>
492
     
451
     
493
     <!--获取课程中正在进行的课节数量-->
452
     <!--获取课程中正在进行的课节数量-->

+ 2
- 2
slive/src/main/resources/mapper/liveplay/CsMapper.xml View File

87
         ,(select t.typename from l_course_type t where t.ctypeid=c.ctypeid)typename
87
         ,(select t.typename from l_course_type t where t.ctypeid=c.ctypeid)typename
88
         ,cs.sectionid,cs.sectionname,cs.sectiondate,cs.teacherid,cs.stunum cynum
88
         ,cs.sectionid,cs.sectionname,cs.sectiondate,cs.teacherid,cs.stunum cynum
89
         ,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate
89
         ,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate
90
-        ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planbegintime))) totaltime
90
+        ,TIMESTAMPDIFF(SECOND,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.planbegintime)) totaltime
91
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
91
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
92
         from l_course_section cs left join l_course c on cs.courseid = c.courseid
92
         from l_course_section cs left join l_course c on cs.courseid = c.courseid
93
         where cs.teacherid=#{section.teacherid} and c.deleted=1 and c.courseschool=1 and cs.sectiondate=#{section.timestr}
93
         where cs.teacherid=#{section.teacherid} and c.deleted=1 and c.courseschool=1 and cs.sectiondate=#{section.timestr}
97
         <if test="section.sectionname!=null and section.sectionname!=''">
97
         <if test="section.sectionname!=null and section.sectionname!=''">
98
             and cs.sectionname like '%${section.sectionname}%'
98
             and cs.sectionname like '%${section.sectionname}%'
99
         </if>
99
         </if>
100
-        order by cs.sectionstate,abs(UNIX_TIMESTAMP(concat(cs.sectiondate,' ',cs.planbegintime))-UNIX_TIMESTAMP(now())),cs.sectionid
100
+        order by cs.sectionstate,abs(timestampdiff(second,concat(cs.sectiondate,' ',cs.planbegintime),#{section.strtime})),cs.sectionid
101
     </select>
101
     </select>
102
 </mapper>
102
 </mapper>

Loading…
Cancel
Save