Browse Source

实时监控详情,学生考试报告班级、年级平均分去除.0

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

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

160
         Integer esid = invigilate.getEsid();
160
         Integer esid = invigilate.getEsid();
161
         N_Utils.validation(new Object[]{teacherid, "教师id", 1, esid, "考试科目id", 1});
161
         N_Utils.validation(new Object[]{teacherid, "教师id", 1, esid, "考试科目id", 1});
162
         Map map = eSubjectBadstudentService.getJkClass(invigilate);
162
         Map map = eSubjectBadstudentService.getJkClass(invigilate);
163
-        return new ResultVo(0, "获取成功", map.get("classes"));
163
+        return new ResultVo(0, "获取成功", map);
164
     }
164
     }
165
 
165
 
166
     /**
166
     /**
210
         Map map = eSubjectBadstudentService.getPaperRate(invigilate);
210
         Map map = eSubjectBadstudentService.getPaperRate(invigilate);
211
         return new ResultVo(0, "获取成功", map);
211
         return new ResultVo(0, "获取成功", map);
212
     }
212
     }
213
+
214
+    /*
215
+     * 监控学生
216
+     * @Param [invigilate]
217
+     * @Author ywx
218
+     * @Date 2022/11/7 9:18
219
+     * @return com.xhkjedu.vo.ResultVo
220
+     **/
221
+    @PostMapping("/jk_xs2")
222
+    public ResultVo listJkStu2(@RequestBody ESubjectInvigilate invigilate) {
223
+        Integer esid = invigilate.getEsid();
224
+        Integer classid = invigilate.getClassid();
225
+        N_Utils.validation(new Object[]{esid, "考试科目id", 1, classid, "班级id", 1});
226
+        List<Map> list = eSubjectBadstudentService.listStu2(invigilate);
227
+        return new ResultVo(0, "获取成功", list);
228
+    }
229
+
230
+    /*
231
+     * 监控概况
232
+     * @Param [invigilate]
233
+     * @Author ywx
234
+     * @Date 2022/11/7 9:33
235
+     * @return com.xhkjedu.vo.ResultVo
236
+     **/
237
+    @PostMapping("/get_jkgk")
238
+    public ResultVo getJkGk(@RequestBody ESubjectInvigilate invigilate) {
239
+        Integer esid = invigilate.getEsid();
240
+        Integer classid = invigilate.getClassid();
241
+        N_Utils.validation(new Object[]{esid, "考试科目id", 1, classid, "班级id", 1});
242
+        Map map = eSubjectBadstudentService.getJkGk(invigilate);
243
+        return new ResultVo(0, "获取成功", map);
244
+    }
213
 }
245
 }

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/ESubjectBadstudentMapper.java View File

23
 
23
 
24
     //学生违纪行为分析详情
24
     //学生违纪行为分析详情
25
     List<Map> listBad(@Param("studentid") Integer studentid, @Param("examid") Integer examid);
25
     List<Map> listBad(@Param("studentid") Integer studentid, @Param("examid") Integer examid);
26
+
27
+    //监考学生
28
+    List<Map> listStu2(@Param("ei") ESubjectInvigilate ei);
26
 }
29
 }

+ 22
- 2
sexam/src/main/java/com/xhkjedu/sexam/service/exam/ESubjectBadstudentService.java View File

3
 import com.xhkjedu.sexam.mapper.exam.EClassMapper;
3
 import com.xhkjedu.sexam.mapper.exam.EClassMapper;
4
 import com.xhkjedu.sexam.mapper.exam.ESubjectBadstudentMapper;
4
 import com.xhkjedu.sexam.mapper.exam.ESubjectBadstudentMapper;
5
 import com.xhkjedu.sexam.mapper.exam.ESubjectMapper;
5
 import com.xhkjedu.sexam.mapper.exam.ESubjectMapper;
6
+import com.xhkjedu.sexam.mapper.system.UserMapper;
6
 import com.xhkjedu.sexam.model.exam.ESubjectBadstudent;
7
 import com.xhkjedu.sexam.model.exam.ESubjectBadstudent;
7
 import com.xhkjedu.sexam.model.exam.ESubjectInvigilate;
8
 import com.xhkjedu.sexam.model.exam.ESubjectInvigilate;
8
 import com.xhkjedu.utils.N_Utils;
9
 import com.xhkjedu.utils.N_Utils;
12
 import java.util.ArrayList;
13
 import java.util.ArrayList;
13
 import java.util.List;
14
 import java.util.List;
14
 import java.util.Map;
15
 import java.util.Map;
16
+import java.util.stream.Collectors;
15
 
17
 
16
 @Service
18
 @Service
17
 public class ESubjectBadstudentService {
19
 public class ESubjectBadstudentService {
21
     private ESubjectMapper eSubjectMapper;
23
     private ESubjectMapper eSubjectMapper;
22
     @Resource
24
     @Resource
23
     private EClassMapper eClassMapper;
25
     private EClassMapper eClassMapper;
26
+    @Resource
27
+    private UserMapper userMapper;
24
 
28
 
25
     //添加
29
     //添加
26
     public void save(ESubjectBadstudent model) {
30
     public void save(ESubjectBadstudent model) {
52
         Map map = eSubjectMapper.getESubjectByEsId(esid);//考试科目基本信息
56
         Map map = eSubjectMapper.getESubjectByEsId(esid);//考试科目基本信息
53
         String classids = "";
57
         String classids = "";
54
         List<Map> classes = eClassMapper.listByExamId((Integer) map.get("examid"));//考试班级
58
         List<Map> classes = eClassMapper.listByExamId((Integer) map.get("examid"));//考试班级
55
-        if (teacherid != 0) {
59
+        Integer createid= (Integer) map.get("createid");
60
+        if (!N_Utils.isEmptyInteger(teacherid) && !createid.equals(teacherid)
61
+                && userMapper.getUsertypeByUserid(teacherid) == 1) {
56
             Map claMap = eSubjectBadstudentMapper.getClass(esid, teacherid);//教师监考班级
62
             Map claMap = eSubjectBadstudentMapper.getClass(esid, teacherid);//教师监考班级
57
-            if (claMap.get("majored").equals(0)) {//教师不是主监考
63
+            if (claMap == null) {
64
+                classes = new ArrayList<>();
65
+            } else if (claMap.get("majored").equals(0)) {//教师不是主监考
58
                 List<Map> classes2 = new ArrayList<>();
66
                 List<Map> classes2 = new ArrayList<>();
59
                 classids = claMap.get("classids").toString();
67
                 classids = claMap.get("classids").toString();
60
                 String[] classIds = classids.split(",");
68
                 String[] classIds = classids.split(",");
64
                 }
72
                 }
65
                 classes = classes2;
73
                 classes = classes2;
66
             }
74
             }
75
+        } else {
76
+            classids = classes.stream().map(c -> c.get("classid").toString()).collect(Collectors.joining(","));
67
         }
77
         }
68
         map.put("classids", classids);
78
         map.put("classids", classids);
69
         map.put("classes", classes);
79
         map.put("classes", classes);
91
     public Map getPaperRate(ESubjectInvigilate ei) {
101
     public Map getPaperRate(ESubjectInvigilate ei) {
92
         return eSubjectBadstudentMapper.getPaperRate(ei);
102
         return eSubjectBadstudentMapper.getPaperRate(ei);
93
     }
103
     }
104
+
105
+    //监考学生
106
+    public List<Map> listStu2(ESubjectInvigilate ei) {
107
+        return eSubjectBadstudentMapper.listStu2(ei);
108
+    }
109
+
110
+    //监控详情
111
+    public Map getJkGk(ESubjectInvigilate ei) {
112
+        return eSubjectBadstudentMapper.getPaperRate(ei);//学生进场概况
113
+    }
94
 }
114
 }

+ 2
- 2
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportStudentService.java View File

294
                         mq.put("points", points);
294
                         mq.put("points", points);
295
                     }
295
                     }
296
                     mq.put("complexity",q.get("mcomplexity").toString());
296
                     mq.put("complexity",q.get("mcomplexity").toString());
297
-                    mq.put("classavgscore",q.get("classavgscore").toString());
298
-                    mq.put("gradeavgscore",q.get("gradeavgscore").toString());
297
+                    mq.put("classavgscore",ExamUtil.removeStrEnd0(q.get("classavgscore").toString()));
298
+                    mq.put("gradeavgscore",ExamUtil.removeStrEnd0(q.get("gradeavgscore").toString()));
299
 
299
 
300
                     Double stuscore = sonqueslist.stream().mapToDouble(s -> Double.parseDouble(s.get("stuscore").toString())).sum();
300
                     Double stuscore = sonqueslist.stream().mapToDouble(s -> Double.parseDouble(s.get("stuscore").toString())).sum();
301
                     Double pscore = sonqueslist.stream().mapToDouble(s -> Double.parseDouble(s.get("qscore").toString())).sum();
301
                     Double pscore = sonqueslist.stream().mapToDouble(s -> Double.parseDouble(s.get("qscore").toString())).sum();

+ 15
- 0
sexam/src/main/java/com/xhkjedu/sexam/utils/ExamUtil.java View File

402
         return date.getTime()/1000;
402
         return date.getTime()/1000;
403
     }
403
     }
404
 
404
 
405
+    /*
406
+     * 去除字符串末尾的.0
407
+     * @Param [str]
408
+     * @Author ywx
409
+     * @Date 2022/11/7 10:46
410
+     * @return java.lang.String
411
+     **/
412
+    public static String removeStrEnd0(String str){
413
+        if(N_Utils.isEmpty(str)) return str;
414
+        if(str.endsWith(".0")){
415
+            str=str.substring(0,str.lastIndexOf("."));
416
+        }
417
+        return str;
418
+    }
419
+
405
     public static void main(String[] args) {
420
     public static void main(String[] args) {
406
 
421
 
407
     }
422
     }

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

19
         <if test="ei.createname!=null and ei.createname!=''">
19
         <if test="ei.createname!=null and ei.createname!=''">
20
             and u.username like '%${ei.createname}%'
20
             and u.username like '%${ei.createname}%'
21
         </if>
21
         </if>
22
+        order by convert(u.username using gbk),u.userid
22
     </select>
23
     </select>
23
     <!--学生进场概况-->
24
     <!--学生进场概况-->
24
     <select id="getPaperRate" resultType="java.util.Map">
25
     <select id="getPaperRate" resultType="java.util.Map">
54
         </if>
55
         </if>
55
         order by es.esbsid desc
56
         order by es.esbsid desc
56
     </select>
57
     </select>
58
+    <!--监考学生-->
59
+    <select id="listStu2" resultType="java.util.Map">
60
+        select es.classid,es.sstate,u.username,es.studentid
61
+        from e_paper_student es left join t_user u on es.studentid = u.userid
62
+        where es.esid=#{ei.esid} and es.classid=#{ei.classid}
63
+        <if test="ei.sstate!=null">
64
+            and es.sstate=#{ei.sstate}
65
+        </if>
66
+        <if test="ei.createname!=null and ei.createname!=''">
67
+            and u.username like '%${ei.createname}%'
68
+        </if>
69
+        order by convert(u.username using gbk),u.userid
70
+    </select>
57
 </mapper>
71
 </mapper>

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

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,es.subjectname
56
         select es.sdate,es.begintime,es.endtime,es.subjectname
57
-        ,eb.examname,eb.schoolid,eb.examid,eb.gradeid,eb.examtype
57
+        ,eb.examname,eb.schoolid,eb.examid,eb.gradeid,eb.examtype,eb.createid
58
         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
59
         where es.esid=#{esid}
59
         where es.esid=#{esid}
60
     </select>
60
     </select>

+ 9
- 2
sexam/src/main/resources/mapper/report/ERstudentMapper.xml View File

11
     <select id="listSubject" resultType="java.util.Map">
11
     <select id="listSubject" resultType="java.util.Map">
12
         select s.score,s.classrank,s.classrankpre,s.classmaxscore,s.classavgscore
12
         select s.score,s.classrank,s.classrankpre,s.classmaxscore,s.classavgscore
13
         ,s.schoolrank,s.schoolmaxscore,s.schoolavgscore,s.goal,s.nextgoal,s.subjectname,s.subjectid,s.bzscore
13
         ,s.schoolrank,s.schoolmaxscore,s.schoolavgscore,s.goal,s.nextgoal,s.subjectname,s.subjectid,s.bzscore
14
-        from e_rstudent s where s.examid=#{examid} and s.studentid=#{studentid}
14
+        ,eps.device,eps.submittype,eps.endtime
15
+        ,(case when s.subjectid='zf' then (select (
16
+        case when count(eps2.epsid)=count(case when eps2.sstate=3 then eps2.epsid else null end) then 3 else 2 end)
17
+        from e_paper_student eps2 where eps2.examid=s.examid and eps2.studentid=s.studentid)
18
+        else eps.sstate end)sstate
19
+        from e_rstudent s left join e_paper_student eps on s.examid=eps.examid
20
+        and s.subjectid=eps.subjectid and s.studentid=eps.studentid
21
+        where s.examid=#{examid} and s.studentid=#{studentid}
15
     </select>
22
     </select>
16
     <select id="listByExamId" resultMap="stuResult">
23
     <select id="listByExamId" resultMap="stuResult">
17
-        select s.examid,s.classid,s.studentid,c.classname,u.username,u.loginname
24
+        select s.examid,s.classid,s.studentid,c.classname,u.username,u.loginname,u.usersex,u.examno
18
         from e_class_student s left join t_user u on s.studentid=u.userid
25
         from e_class_student s left join t_user u on s.studentid=u.userid
19
         left join e_class c on s.classid=c.classid
26
         left join e_class c on s.classid=c.classid
20
         where s.examid=#{stu.examid}
27
         where s.examid=#{stu.examid}

Loading…
Cancel
Save