Browse Source

实时监控

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

+ 12
- 10
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/ESubjectBadstudentController.java View File

3
 import com.github.pagehelper.PageHelper;
3
 import com.github.pagehelper.PageHelper;
4
 import com.github.pagehelper.PageInfo;
4
 import com.github.pagehelper.PageInfo;
5
 import com.xhkjedu.sexam.model.exam.ESubjectBadstudent;
5
 import com.xhkjedu.sexam.model.exam.ESubjectBadstudent;
6
+import com.xhkjedu.sexam.model.exam.ESubjectInvigilate;
6
 import com.xhkjedu.sexam.service.exam.ESubjectBadstudentService;
7
 import com.xhkjedu.sexam.service.exam.ESubjectBadstudentService;
7
 import com.xhkjedu.utils.N_Utils;
8
 import com.xhkjedu.utils.N_Utils;
8
 import com.xhkjedu.utils.PageUtil;
9
 import com.xhkjedu.utils.PageUtil;
45
      * 实时监控
46
      * 实时监控
46
      *
47
      *
47
      * @return com.xhkjedu.vo.ResultVo
48
      * @return com.xhkjedu.vo.ResultVo
48
-     * @Param [badstudent]
49
+     * @Param [invigilate]
49
      * @Author ywx
50
      * @Author ywx
50
      * @Date 2022/8/17 11:44
51
      * @Date 2022/8/17 11:44
51
      **/
52
      **/
52
     @PostMapping("/list_sjk")
53
     @PostMapping("/list_sjk")
53
-    public ResultVo listJk(@RequestBody ESubjectBadstudent badstudent) {
54
-        Integer examid = badstudent.getExamid();
55
-        Integer esid = badstudent.getEsid();
56
-        Integer classid = badstudent.getClassid();
57
-        Integer page = badstudent.getPage();
58
-        Integer pageSize = badstudent.getPageSize();
59
-        N_Utils.validation(new Object[]{examid, "考试id", 1, page, "页码", 1, pageSize, "显示条数", 1});
54
+    public ResultVo listJk(@RequestBody ESubjectInvigilate invigilate) {
55
+        Integer teacherid = invigilate.getTeacherid();
56
+        Integer esid = invigilate.getEsid();
57
+        Integer classid = invigilate.getClassid();
58
+        Integer page = invigilate.getPage();
59
+        Integer pageSize = invigilate.getPageSize();
60
+        N_Utils.validation(new Object[]{teacherid, "教师id", 1, page, "页码", 1, pageSize, "显示条数", 1});
61
+        Map map = eSubjectBadstudentService.getJkDetail(esid, teacherid);
62
+        String classids = map.get("classids").toString();
60
         PageHelper.startPage(page, pageSize);
63
         PageHelper.startPage(page, pageSize);
61
-        List<Map> list = eSubjectBadstudentService.listStu(esid, classid, badstudent.getCreatename());
64
+        List<Map> list = eSubjectBadstudentService.listStu(esid, classids, classid, invigilate.getCreatename());
62
         PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
65
         PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
63
-        Map map = eSubjectBadstudentService.getJkDetail(examid, esid);
64
         map.put("pageResult", pageResult);
66
         map.put("pageResult", pageResult);
65
         return new ResultVo(0, "获取成功", map);
67
         return new ResultVo(0, "获取成功", map);
66
     }
68
     }

+ 6
- 1
sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/ESubjectBadstudentMapper.java View File

9
 
9
 
10
 public interface ESubjectBadstudentMapper extends TkMapper<ESubjectBadstudent> {
10
 public interface ESubjectBadstudentMapper extends TkMapper<ESubjectBadstudent> {
11
     //试卷学生
11
     //试卷学生
12
-    List<Map> listStu(@Param("esid") Integer esid, @Param("classid") Integer classid, @Param("studentname") String studentname);
12
+    List<Map> listStu(@Param("esid") Integer esid, @Param("classids") String classids, @Param("classid") Integer classid,
13
+                      @Param("studentname") String studentname);
13
 
14
 
14
     //试卷异常次数
15
     //试卷异常次数
15
     Integer getErrNumByEsId(@Param("esid") Integer esid);
16
     Integer getErrNumByEsId(@Param("esid") Integer esid);
16
 
17
 
18
+    //学生进场概况
17
     Map getPaperRate(@Param("esid") Integer esid);
19
     Map getPaperRate(@Param("esid") Integer esid);
20
+
21
+    //教师监考班级
22
+    Map getClass(@Param("esid") Integer esid, @Param("teacherid") Integer teacherid);
18
 }
23
 }

+ 26
- 8
sexam/src/main/java/com/xhkjedu/sexam/service/exam/ESubjectBadstudentService.java View File

1
 package com.xhkjedu.sexam.service.exam;
1
 package com.xhkjedu.sexam.service.exam;
2
 
2
 
3
-import com.xhkjedu.sexam.mapper.exam.EBaseMapper;
4
 import com.xhkjedu.sexam.mapper.exam.EClassMapper;
3
 import com.xhkjedu.sexam.mapper.exam.EClassMapper;
5
 import com.xhkjedu.sexam.mapper.exam.ESubjectBadstudentMapper;
4
 import com.xhkjedu.sexam.mapper.exam.ESubjectBadstudentMapper;
5
+import com.xhkjedu.sexam.mapper.exam.ESubjectMapper;
6
 import com.xhkjedu.sexam.model.exam.ESubjectBadstudent;
6
 import com.xhkjedu.sexam.model.exam.ESubjectBadstudent;
7
 import com.xhkjedu.utils.N_Utils;
7
 import com.xhkjedu.utils.N_Utils;
8
 import org.springframework.stereotype.Service;
8
 import org.springframework.stereotype.Service;
9
 
9
 
10
 import javax.annotation.Resource;
10
 import javax.annotation.Resource;
11
+import java.util.ArrayList;
11
 import java.util.List;
12
 import java.util.List;
12
 import java.util.Map;
13
 import java.util.Map;
14
+import java.util.stream.Collectors;
13
 
15
 
14
 @Service
16
 @Service
15
 public class ESubjectBadstudentService {
17
 public class ESubjectBadstudentService {
16
     @Resource
18
     @Resource
17
     private ESubjectBadstudentMapper eSubjectBadstudentMapper;
19
     private ESubjectBadstudentMapper eSubjectBadstudentMapper;
18
     @Resource
20
     @Resource
19
-    private EBaseMapper eBaseMapper;
21
+    private ESubjectMapper eSubjectMapper;
20
     @Resource
22
     @Resource
21
     private EClassMapper eClassMapper;
23
     private EClassMapper eClassMapper;
22
 
24
 
27
     }
29
     }
28
 
30
 
29
     //试卷学生
31
     //试卷学生
30
-    public List<Map> listStu(Integer esid, Integer classid, String studentname) {
31
-        List<Map> students = eSubjectBadstudentMapper.listStu(esid, classid, studentname);
32
+    public List<Map> listStu(Integer esid, String classids, Integer classid, String studentname) {
33
+        List<Map> students = eSubjectBadstudentMapper.listStu(esid, classids, classid, studentname);
32
         return students;
34
         return students;
33
     }
35
     }
34
 
36
 
35
-    public Map getJkDetail(Integer examid, Integer esid) {
36
-        Map map = eBaseMapper.findById(examid);
37
-        List<Map> classes = eClassMapper.listByExamId(examid);
37
+    //监控详情
38
+    public Map getJkDetail(Integer esid, Integer teacherid) {
39
+        Map map = eSubjectMapper.getESubjectByEsId(esid);//考试科目基本信息
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);
50
+            }
51
+            classes = classes2;
52
+        } else {//教师是主监考
53
+            classids = classes.stream().map(m -> m.get("classid").toString()).collect(Collectors.joining(","));
54
+        }
55
+        map.put("classids", classids);
38
         map.put("classes", classes);
56
         map.put("classes", classes);
39
         Integer errnum = eSubjectBadstudentMapper.getErrNumByEsId(esid);//试卷异常次数
57
         Integer errnum = eSubjectBadstudentMapper.getErrNumByEsId(esid);//试卷异常次数
40
         map.put("errnum", errnum);
58
         map.put("errnum", errnum);
41
-        Map rate = eSubjectBadstudentMapper.getPaperRate(esid);
59
+        Map rate = eSubjectBadstudentMapper.getPaperRate(esid);//学生进场概况
42
         map.putAll(rate);
60
         map.putAll(rate);
43
         return map;
61
         return map;
44
     }
62
     }

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

9
         <if test="classid!=null and classid!=0">
9
         <if test="classid!=null and classid!=0">
10
             and es.classid=#{classid}
10
             and es.classid=#{classid}
11
         </if>
11
         </if>
12
+        <if test="classid==null or classid==0">
13
+            and es.classid in(${classids})
14
+        </if>
12
         <if test="studentname!=null and studentname!=''">
15
         <if test="studentname!=null and studentname!=''">
13
             and u.username like '%${studentname}%'
16
             and u.username like '%${studentname}%'
14
         </if>
17
         </if>
17
     <select id="getErrNumByEsId" resultType="java.lang.Integer">
20
     <select id="getErrNumByEsId" resultType="java.lang.Integer">
18
         select count(*) from e_subject_badstudent where esid=#{esid}
21
         select count(*) from e_subject_badstudent where esid=#{esid}
19
     </select>
22
     </select>
23
+    <!--学生进场概况-->
20
     <select id="getPaperRate" resultType="java.util.Map">
24
     <select id="getPaperRate" resultType="java.util.Map">
21
         select count(*)examnum
25
         select count(*)examnum
22
              ,count(case when sstate!=0 then epsid else null end)jcnum
26
              ,count(case when sstate!=0 then epsid else null end)jcnum
25
              ,truncate(count(case when sstate!=0 then epsid else null end)*100/count(*),2)jcrate
29
              ,truncate(count(case when sstate!=0 then epsid else null end)*100/count(*),2)jcrate
26
         from e_paper_student where esid=#{esid}
30
         from e_paper_student where esid=#{esid}
27
     </select>
31
     </select>
32
+    <!--教师监考班级-->
33
+    <select id="getClass" resultType="java.util.Map">
34
+        select max(majored)majored,group_concat(classid)classids
35
+        from e_subject_invigilate where esid=#{esid} and teacherid=#{teacherid}
36
+    </select>
28
 </mapper>
37
 </mapper>

+ 3
- 2
sexam/src/main/resources/mapper/exam/ESubjectInvigilateMapper.xml View File

30
         ,truncate(count(case when eps.sstate=1 then eps.epsid else null end)*100/sum(ec.classnum),2) jcrate
30
         ,truncate(count(case when eps.sstate=1 then eps.epsid else null end)*100/sum(ec.classnum),2) jcrate
31
         ,count(case when eps.sstate=2 then eps.epsid else null end)tjnum
31
         ,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
32
         ,count(case when eps.sstate=3 then eps.epsid else null end)qknum
33
-        from e_subject es left join e_base eb on eb.examid = es.examid
33
+        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
34
         left join e_class ec on eb.examid = ec.examid
35
         left join e_class ec on eb.examid = ec.examid
35
         left join e_paper_student eps on es.esid = eps.esid
36
         left join e_paper_student eps on es.esid = eps.esid
36
         <where>
37
         <where>
37
         <if test="teacherid!=null and teacherid!=0">
38
         <if test="teacherid!=null and teacherid!=0">
38
-            and es.teacherid=#{teacherid}
39
+            and ei.teacherid=#{teacherid}
39
         </if>
40
         </if>
40
         <if test="examid!=null and examid!=0">
41
         <if test="examid!=null and examid!=0">
41
             and es.examid=#{examid}
42
             and es.examid=#{examid}

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

53
     </select>
53
     </select>
54
     <!--根据考试科目id获取考试科目基本信息-->
54
     <!--根据考试科目id获取考试科目基本信息-->
55
     <select id="getESubjectByEsId" resultType="java.util.Map">
55
     <select id="getESubjectByEsId" resultType="java.util.Map">
56
-        select es.sdate,es.begintime,es.endtime,eb.examname,eb.schoolid
56
+        select es.sdate,es.begintime,es.endtime,es.subjectname
57
+        ,eb.examname,eb.schoolid,eb.examid,eb.gradeid,eb.examtype
57
         from e_subject es left join e_base eb on es.examid = eb.examid
58
         from e_subject es left join e_base eb on es.examid = eb.examid
58
         where es.esid=#{esid}
59
         where es.esid=#{esid}
59
     </select>
60
     </select>

+ 1
- 1
sexam/src/main/resources/mapper/paperstudent/EScanerrorMapper.xml View File

3
 <mapper namespace="com.xhkjedu.sexam.mapper.paperstudent.EScanerrorMapper">
3
 <mapper namespace="com.xhkjedu.sexam.mapper.paperstudent.EScanerrorMapper">
4
     <!--试卷扫描出错列表-->
4
     <!--试卷扫描出错列表-->
5
     <select id="listByBatchIds" resultType="com.xhkjedu.sexam.model.paperstudent.EScanerror">
5
     <select id="listByBatchIds" resultType="com.xhkjedu.sexam.model.paperstudent.EScanerror">
6
-        select serrorid, batchid, errortype, pagenum, stupic, errorjson, createtime
6
+        select serrorid, batchid, errortype, pagenum, stupic, errorstate, errorjson, createtime
7
         from e_scanerror where batchid in (${batchids})
7
         from e_scanerror where batchid in (${batchids})
8
     </select>
8
     </select>
9
     <!--批量标记待处理的扫描异常为已处理-->
9
     <!--批量标记待处理的扫描异常为已处理-->

Loading…
Cancel
Save