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,7 +160,7 @@ public class ESubjectBadstudentController {
160 160
         Integer esid = invigilate.getEsid();
161 161
         N_Utils.validation(new Object[]{teacherid, "教师id", 1, esid, "考试科目id", 1});
162 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,4 +210,36 @@ public class ESubjectBadstudentController {
210 210
         Map map = eSubjectBadstudentService.getPaperRate(invigilate);
211 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,4 +23,7 @@ public interface ESubjectBadstudentMapper extends TkMapper<ESubjectBadstudent> {
23 23
 
24 24
     //学生违纪行为分析详情
25 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,6 +3,7 @@ package com.xhkjedu.sexam.service.exam;
3 3
 import com.xhkjedu.sexam.mapper.exam.EClassMapper;
4 4
 import com.xhkjedu.sexam.mapper.exam.ESubjectBadstudentMapper;
5 5
 import com.xhkjedu.sexam.mapper.exam.ESubjectMapper;
6
+import com.xhkjedu.sexam.mapper.system.UserMapper;
6 7
 import com.xhkjedu.sexam.model.exam.ESubjectBadstudent;
7 8
 import com.xhkjedu.sexam.model.exam.ESubjectInvigilate;
8 9
 import com.xhkjedu.utils.N_Utils;
@@ -12,6 +13,7 @@ import javax.annotation.Resource;
12 13
 import java.util.ArrayList;
13 14
 import java.util.List;
14 15
 import java.util.Map;
16
+import java.util.stream.Collectors;
15 17
 
16 18
 @Service
17 19
 public class ESubjectBadstudentService {
@@ -21,6 +23,8 @@ public class ESubjectBadstudentService {
21 23
     private ESubjectMapper eSubjectMapper;
22 24
     @Resource
23 25
     private EClassMapper eClassMapper;
26
+    @Resource
27
+    private UserMapper userMapper;
24 28
 
25 29
     //添加
26 30
     public void save(ESubjectBadstudent model) {
@@ -52,9 +56,13 @@ public class ESubjectBadstudentService {
52 56
         Map map = eSubjectMapper.getESubjectByEsId(esid);//考试科目基本信息
53 57
         String classids = "";
54 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 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 66
                 List<Map> classes2 = new ArrayList<>();
59 67
                 classids = claMap.get("classids").toString();
60 68
                 String[] classIds = classids.split(",");
@@ -64,6 +72,8 @@ public class ESubjectBadstudentService {
64 72
                 }
65 73
                 classes = classes2;
66 74
             }
75
+        } else {
76
+            classids = classes.stream().map(c -> c.get("classid").toString()).collect(Collectors.joining(","));
67 77
         }
68 78
         map.put("classids", classids);
69 79
         map.put("classes", classes);
@@ -91,4 +101,14 @@ public class ESubjectBadstudentService {
91 101
     public Map getPaperRate(ESubjectInvigilate ei) {
92 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,8 +294,8 @@ public class EReportStudentService {
294 294
                         mq.put("points", points);
295 295
                     }
296 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 300
                     Double stuscore = sonqueslist.stream().mapToDouble(s -> Double.parseDouble(s.get("stuscore").toString())).sum();
301 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,6 +402,21 @@ public class ExamUtil {
402 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 420
     public static void main(String[] args) {
406 421
 
407 422
     }

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

@@ -19,6 +19,7 @@
19 19
         <if test="ei.createname!=null and ei.createname!=''">
20 20
             and u.username like '%${ei.createname}%'
21 21
         </if>
22
+        order by convert(u.username using gbk),u.userid
22 23
     </select>
23 24
     <!--学生进场概况-->
24 25
     <select id="getPaperRate" resultType="java.util.Map">
@@ -54,4 +55,17 @@
54 55
         </if>
55 56
         order by es.esbsid desc
56 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 71
 </mapper>

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

@@ -54,7 +54,7 @@
54 54
     <!--根据考试科目id获取考试科目基本信息-->
55 55
     <select id="getESubjectByEsId" resultType="java.util.Map">
56 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 58
         from e_subject es left join e_base eb on es.examid = eb.examid
59 59
         where es.esid=#{esid}
60 60
     </select>

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

@@ -11,10 +11,17 @@
11 11
     <select id="listSubject" resultType="java.util.Map">
12 12
         select s.score,s.classrank,s.classrankpre,s.classmaxscore,s.classavgscore
13 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 22
     </select>
16 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 25
         from e_class_student s left join t_user u on s.studentid=u.userid
19 26
         left join e_class c on s.classid=c.classid
20 27
         where s.examid=#{stu.examid}

Loading…
Cancel
Save