Browse Source

监控列表

tags/正式版本
雍文秀 2 years ago
parent
commit
5842cefed5

+ 25
- 1
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/ESubjectBadstudentController.java View File

43
     }
43
     }
44
 
44
 
45
     /**
45
     /**
46
-     * 实时监控
46
+     * 实时监控--教师
47
      *
47
      *
48
      * @return com.xhkjedu.vo.ResultVo
48
      * @return com.xhkjedu.vo.ResultVo
49
      * @Param [invigilate]
49
      * @Param [invigilate]
66
         map.put("pageResult", pageResult);
66
         map.put("pageResult", pageResult);
67
         return new ResultVo(0, "获取成功", map);
67
         return new ResultVo(0, "获取成功", map);
68
     }
68
     }
69
+
70
+    /**
71
+     * 实时监控--管理员
72
+     *
73
+     * @return com.xhkjedu.vo.ResultVo
74
+     * @Param [invigilate]
75
+     * @Author ywx
76
+     * @Date 2022/8/17 17:00
77
+     **/
78
+    @PostMapping("/list_gsjk")
79
+    public ResultVo listGJk(@RequestBody ESubjectInvigilate invigilate) {
80
+        Integer esid = invigilate.getEsid();
81
+        Integer classid = invigilate.getClassid();
82
+        Integer page = invigilate.getPage();
83
+        Integer pageSize = invigilate.getPageSize();
84
+        N_Utils.validation(new Object[]{page, "页码", 1, pageSize, "显示条数", 1});
85
+        Map map = eSubjectBadstudentService.getJkDetail(esid, 0);
86
+        String classids = map.get("classids").toString();
87
+        PageHelper.startPage(page, pageSize);
88
+        List<Map> list = eSubjectBadstudentService.listStu(esid, classids, classid, invigilate.getCreatename());
89
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
90
+        map.put("pageResult", pageResult);
91
+        return new ResultVo(0, "获取成功", map);
92
+    }
69
 }
93
 }

+ 14
- 11
sexam/src/main/java/com/xhkjedu/sexam/service/exam/ESubjectBadstudentService.java View File

38
     public Map getJkDetail(Integer esid, Integer teacherid) {
38
     public Map getJkDetail(Integer esid, Integer teacherid) {
39
         Map map = eSubjectMapper.getESubjectByEsId(esid);//考试科目基本信息
39
         Map map = eSubjectMapper.getESubjectByEsId(esid);//考试科目基本信息
40
         List<Map> classes = eClassMapper.listByExamId((Integer) map.get("examid"));//考试班级
40
         List<Map> classes = eClassMapper.listByExamId((Integer) map.get("examid"));//考试班级
41
-        Map claMap = eSubjectBadstudentMapper.getClass(esid, teacherid);//教师监考班级
42
-        String classids;
43
-        if (claMap.get("majored").equals(0)) {//教师不是主监考
44
-            List<Map> classes2 = new ArrayList<>();
45
-            classids = claMap.get("classids").toString();
46
-            String[] classIds = classids.split(",");
47
-            for (String classid : classIds) {
48
-                Map cla = classes.stream().filter(c -> c.get("classid").toString().equals(classid)).findFirst().orElse(null);
49
-                if (cla != null) classes2.add(cla);
41
+        String classids = null;
42
+        if (teacherid != 0) {
43
+            Map claMap = eSubjectBadstudentMapper.getClass(esid, teacherid);//教师监考班级
44
+            if (claMap.get("majored").equals(0)) {//教师不是主监考
45
+                List<Map> classes2 = new ArrayList<>();
46
+                classids = claMap.get("classids").toString();
47
+                String[] classIds = classids.split(",");
48
+                for (String classid : classIds) {
49
+                    Map cla = classes.stream().filter(c -> c.get("classid").toString().equals(classid)).findFirst().orElse(null);
50
+                    if (cla != null) classes2.add(cla);
51
+                }
52
+                classes = classes2;
50
             }
53
             }
51
-            classes = classes2;
52
-        } else {//教师是主监考
54
+        }
55
+        if (classids == null) {//教师是主监考或是管理员
53
             classids = classes.stream().map(m -> m.get("classid").toString()).collect(Collectors.joining(","));
56
             classids = classes.stream().map(m -> m.get("classid").toString()).collect(Collectors.joining(","));
54
         }
57
         }
55
         map.put("classids", classids);
58
         map.put("classids", classids);

+ 1
- 1
sexam/src/main/resources/mapper/exam/ESubjectBadstudentMapper.xml View File

3
 <mapper namespace="com.xhkjedu.sexam.mapper.exam.ESubjectBadstudentMapper">
3
 <mapper namespace="com.xhkjedu.sexam.mapper.exam.ESubjectBadstudentMapper">
4
     <!--试卷学生-->
4
     <!--试卷学生-->
5
     <select id="listStu" resultType="java.util.Map">
5
     <select id="listStu" resultType="java.util.Map">
6
-        select es.classid,es.sstate,u.username
6
+        select es.classid,es.sstate,u.username,es.studentid
7
         from e_paper_student es left join t_user u on es.studentid = u.userid
7
         from e_paper_student es left join t_user u on es.studentid = u.userid
8
         where es.esid=#{esid}
8
         where es.esid=#{esid}
9
         <if test="classid!=null and classid!=0">
9
         <if test="classid!=null and classid!=0">

+ 19
- 18
sexam/src/main/resources/mapper/exam/ESubjectInvigilateMapper.xml View File

23
     </select>
23
     </select>
24
     <!--教师监考-监控列表-->
24
     <!--教师监考-监控列表-->
25
     <select id="listJkSubject" resultType="java.util.Map">
25
     <select id="listJkSubject" resultType="java.util.Map">
26
-        select es.esid,es.sdate,es.begintime,es.endtime,es.esstate,es.subjectname
27
-        ,eb.examname,eb.gradeid,eb.examtype,sum(ec.classnum)examnum
26
+        select es.*,count(eps.epsid)examnum
28
         ,count(case when eps.sstate=0 then eps.epsid else null end) wjcnum
27
         ,count(case when eps.sstate=0 then eps.epsid else null end) wjcnum
29
-        ,count(case when eps.sstate=1 then eps.epsid else null end)jcnum
30
-        ,truncate(count(case when eps.sstate=1 then eps.epsid else null end)*100/sum(ec.classnum),2) jcrate
28
+        ,count(case when eps.sstate!=0 then eps.epsid else null end)jcnum
29
+        ,truncate(count(case when eps.sstate!=0 then eps.epsid else null end)*100/count(eps.epsid),2) jcrate
31
         ,count(case when eps.sstate=2 then eps.epsid else null end)tjnum
30
         ,count(case when eps.sstate=2 then eps.epsid else null end)tjnum
32
         ,count(case when eps.sstate=3 then eps.epsid else null end)qknum
31
         ,count(case when eps.sstate=3 then eps.epsid else null end)qknum
32
+        from(select es.esid,es.sdate,es.begintime,es.endtime,es.esstate,es.subjectname
33
+        ,eb.examname,eb.gradeid,eb.examtype
34
+        ,(case when max(ei.majored)=0 then group_concat(distinct ei.classid) else group_concat(distinct ec.classid) end)classids
33
         from e_subject_invigilate ei left join e_subject es on ei.esid=es.esid
35
         from e_subject_invigilate ei left join e_subject es on ei.esid=es.esid
34
         left join e_base eb on eb.examid = es.examid
36
         left join e_base eb on eb.examid = es.examid
35
         left join e_class ec on eb.examid = ec.examid
37
         left join e_class ec on eb.examid = ec.examid
36
-        left join e_paper_student eps on es.esid = eps.esid
37
         <where>
38
         <where>
38
-        <if test="teacherid!=null and teacherid!=0">
39
-            and ei.teacherid=#{teacherid}
40
-        </if>
41
-        <if test="examid!=null and examid!=0">
42
-            and es.examid=#{examid}
43
-        </if>
44
-        <if test="esstate==1">
45
-            and concat(es.sdate,' ',es.endtime)>now()
46
-        </if>
47
-        <if test="esstate==2">
48
-            and concat(es.sdate,' ',es.endtime)&lt;=now()
49
-        </if>
39
+            <if test="teacherid!=null and teacherid!=0">
40
+                and ei.teacherid=#{teacherid}
41
+            </if>
42
+            <if test="examid!=null and examid!=0">
43
+                and es.examid=#{examid}
44
+            </if>
45
+            <if test="esstate==1">
46
+                and concat(es.sdate,' ',es.endtime)>now()
47
+            </if>
48
+            <if test="esstate==2">
49
+                and concat(es.sdate,' ',es.endtime)&lt;=now()
50
+            </if>
50
         </where>
51
         </where>
51
         group by es.esid
52
         group by es.esid
52
         <if test="esstate==1">
53
         <if test="esstate==1">
54
         </if>
55
         </if>
55
         <if test="esstate==2">
56
         <if test="esstate==2">
56
             order by es.sdate desc,es.endtime desc
57
             order by es.sdate desc,es.endtime desc
57
-        </if>
58
+        </if>)es left join e_paper_student eps on es.esid = eps.esid and eps.classid in(es.classids)
58
     </select>
59
     </select>
59
 
60
 
60
 </mapper>
61
 </mapper>

Loading…
Cancel
Save