Browse Source

班级报告、单科报告 分数排名显示控制

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

+ 3
- 1
sexam/src/main/java/com/xhkjedu/sexam/controller/report/EReportClassController.java View File

@@ -63,9 +63,11 @@ public class EReportClassController {
63 63
         Integer examid = stu.getExamid();
64 64
         Integer page = stu.getPage();
65 65
         N_Utils.validation(new Object[]{examid, "考试id", 1, stu.getClassid(), "班级id", 1});
66
+        Integer showrank = eReportClassService.getShowRank(examid);
67
+        stu.setShowrank(showrank);
66 68
         if (N_Utils.isEmptyInteger(page)) {
67 69
             List<Map> list = eReportClassService.listCjd(stu);
68
-            return new ResultVo(0, "获取成功", ExamUtil.listCjdOrder(list));
70
+            return new ResultVo(0, "获取成功", ExamUtil.listCjdOrder(list, showrank));
69 71
         } else {
70 72
             List<Map> list = eReportClassService.listCjd(stu);
71 73
             PageResult pageResult = ExamUtil.getCjdPageResult(stu, list);

+ 3
- 1
sexam/src/main/java/com/xhkjedu/sexam/controller/report/EReportSchoolController.java View File

@@ -65,9 +65,11 @@ public class EReportSchoolController {
65 65
         Integer examid = stu.getExamid();
66 66
         Integer page = stu.getPage();
67 67
         N_Utils.validation(new Object[]{examid, "考试id", 1});
68
+        Integer showrank = eReportSchoolService.getShowRank(examid);
69
+        stu.setShowrank(showrank);
68 70
         if (N_Utils.isEmptyInteger(page)) {
69 71
             List<Map> list = eReportSchoolService.listCjd(stu);
70
-            return new ResultVo(0, "获取成功", ExamUtil.listCjdOrder(list));
72
+            return new ResultVo(0, "获取成功", ExamUtil.listCjdOrder(list, showrank));
71 73
         } else {
72 74
             List<Map> list = eReportSchoolService.listCjd(stu);
73 75
             PageResult pageResult = ExamUtil.getCjdPageResult(stu, list);

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/reportstu/ERstudent.java View File

@@ -91,4 +91,7 @@ public class ERstudent extends BaseBean {
91 91
     @Transient
92 92
     private Integer teacherid;//教师id
93 93
 
94
+    @Transient
95
+    private Integer showrank;//显示排名得分0保密1分数2分数+班排名3分数+班/校排名
96
+
94 97
 }

+ 17
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportClassService.java View File

@@ -8,6 +8,7 @@ import com.xhkjedu.sexam.mapper.reportclass.ERclassMapper;
8 8
 import com.xhkjedu.sexam.mapper.reportclass.ERclassRankMapper;
9 9
 import com.xhkjedu.sexam.mapper.reportclass.EReportClassMapper;
10 10
 import com.xhkjedu.sexam.mapper.reportstu.ERstudentMapper;
11
+import com.xhkjedu.sexam.model.exam.EBase;
11 12
 import com.xhkjedu.sexam.model.reportstu.ERstudent;
12 13
 import com.xhkjedu.sexam.model.reportstu.ERstudentAction;
13 14
 import com.xhkjedu.sexam.utils.ExamUtil;
@@ -93,12 +94,18 @@ public class EReportClassService {
93 94
 
94 95
     //单科概况
95 96
     public Map getDkGk(ERankParamVo rank) {
97
+        EBase base = eBaseMapper.getShowRankById(rank.getExamid());
98
+        rank.setShowrank(base.getTeashowrank());
96 99
         Map map = eRclassMapper.findById(rank);//班级概况
97 100
         return map;
98 101
     }
99 102
 
100 103
     //单科概况-平均分
101 104
     public List<Map> listPjf(ERankParamVo rank) {
105
+        EBase base = eBaseMapper.getShowRankById(rank.getExamid());
106
+        Integer showrank = base.getTeashowrank();
107
+        if(showrank == 0) return new ArrayList<>();
108
+        rank.setShowrank(base.getTeashowrank());
102 109
         return eRclassMapper.listPjf(rank);
103 110
     }
104 111
 
@@ -161,6 +168,8 @@ public class EReportClassService {
161 168
     //试卷概况
162 169
     public Map listSjGk(ERankParamVo rank) {
163 170
         Map paper = eReportClassMapper.getPaperByExamSubjectId(rank);
171
+        EBase base = eBaseMapper.getShowRankById(rank.getExamid());
172
+        rank.setShowrank(base.getTeashowrank());
164 173
         Integer ptype = (Integer) paper.get("ptype");
165 174
         List<Map> list;
166 175
         if (ptype == 1) {
@@ -225,6 +234,8 @@ public class EReportClassService {
225 234
     //试卷分析
226 235
     public Map getSjFx(ERankParamVo rank) {
227 236
         Map map = new HashMap();
237
+        EBase base = eBaseMapper.getShowRankById(rank.getExamid());
238
+        rank.setShowrank(base.getTeashowrank());
228 239
         List<Map> types = eReportClassMapper.listType(rank);//大题分析
229 240
         List<Map> questions = eReportClassMapper.listQuestion(rank);//小题分析
230 241
         List<Map> points = eReportClassMapper.listPoint(rank);//知识点分析
@@ -370,4 +381,10 @@ public class EReportClassService {
370 381
     public List<Map> listEndExamsForClass(ReportParamsVo paramsVo) {
371 382
         return eReportClassMapper.listEndExamsForClass(paramsVo);
372 383
     }
384
+
385
+    //获取教师显示排名得分
386
+    public Integer getShowRank(Integer examid) {
387
+        EBase base = eBaseMapper.getShowRankById(examid);
388
+        return base.getTeashowrank();
389
+    }
373 390
 }

+ 6
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportSchoolService.java View File

@@ -204,4 +204,10 @@ public class EReportSchoolService {
204 204
         map.put("classes",classes);
205 205
         return map;
206 206
     }
207
+
208
+    //获取教师显示排名得分
209
+    public Integer getShowRank(Integer examid) {
210
+        EBase base = eBaseMapper.getShowRankById(examid);
211
+        return base.getTeashowrank();
212
+    }
207 213
 }

+ 34
- 1
sexam/src/main/java/com/xhkjedu/sexam/utils/ExamUtil.java View File

@@ -319,9 +319,26 @@ public class ExamUtil {
319 319
         }
320 320
         List<ERstudent> studentList = students.stream().skip(start).limit(pageSize).collect(Collectors.toList());
321 321
         List<Map> rstudentList = new ArrayList<>();
322
+        Integer showrank = stu.getShowrank();
322 323
         for (ERstudent map : studentList) {
323 324
             Integer studentid = map.getStudentid();
324 325
             Map rs = list.stream().filter(s2 -> s2.get("studentid").equals(studentid)).findFirst().orElse(null);
326
+            if (showrank != 3) {
327
+                List<Map> subjects = (List<Map>) rs.get("subjects");
328
+                for (Map s : subjects) {
329
+                    if (showrank == 2) {
330
+                        s.put("schoolrank", "0");
331
+                        s.put("goal", "0");
332
+                        s.put("nextgoal", "0");
333
+                    } else {
334
+                        s.put("classrank", "0");
335
+                        s.put("classrankpre", "0");
336
+                        s.put("schoolrank", "0");
337
+                        s.put("goal", "0");
338
+                        s.put("nextgoal", "0");
339
+                    }
340
+                }
341
+            }
325 342
             rstudentList.add(rs);
326 343
         }
327 344
         pageResult.setList(rstudentList);
@@ -335,7 +352,7 @@ public class ExamUtil {
335 352
      * @Date 2022/10/23 11:49
336 353
      * @return java.util.List<java.util.Map>
337 354
      **/
338
-    public static List<Map> listCjdOrder(List<Map> list) {
355
+    public static List<Map> listCjdOrder(List<Map> list, Integer showrank) {
339 356
         List<ERstudent> students = new ArrayList<>();
340 357
         for (Map s : list) {
341 358
             Integer studentid = (Integer) s.get("studentid");
@@ -355,6 +372,22 @@ public class ExamUtil {
355 372
         for (ERstudent map : students) {
356 373
             Integer studentid = map.getStudentid();
357 374
             Map rs = list.stream().filter(s2 -> s2.get("studentid").equals(studentid)).findFirst().orElse(null);
375
+            if (showrank != 3) {
376
+                List<Map> subjects = (List<Map>) rs.get("subjects");
377
+                for (Map s : subjects) {
378
+                    if (showrank == 2) {
379
+                        s.put("schoolrank", "0");
380
+                        s.put("goal", "0");
381
+                        s.put("nextgoal", "0");
382
+                    } else {
383
+                        s.put("classrank", "0");
384
+                        s.put("classrankpre", "0");
385
+                        s.put("schoolrank", "0");
386
+                        s.put("goal", "0");
387
+                        s.put("nextgoal", "0");
388
+                    }
389
+                }
390
+            }
358 391
             rstudentList.add(rs);
359 392
         }
360 393
         return rstudentList;

+ 2
- 0
sexam/src/main/java/com/xhkjedu/sexam/vo/report/ERankParamVo.java View File

@@ -32,4 +32,6 @@ public class ERankParamVo {
32 32
     private Integer ranktype;
33 33
 
34 34
     private List<ERrank> rranks;//等级
35
+
36
+    private Integer showrank;//显示排名得分0保密1分数2分数+班排名3分数+班/校排名
35 37
 }

+ 13
- 2
sexam/src/main/resources/mapper/report/ERclassMapper.xml View File

@@ -32,8 +32,19 @@
32 32
     </select>
33 33
     <!--班级报告-单科概况-班级概况-->
34 34
     <select id="findById" resultType="java.util.Map">
35
-        select er.classmaxscore,er.classavgscore,er.classavgscorerank,er.schoolmaxscore,er.schoolavgscore
36
-        ,er.yxrate,er.jgrate
35
+        select er.yxrate,er.jgrate
36
+        <if test="rank.showrank==0">
37
+            ,0 classmaxscore,0 classavgscore,0 classavgscorerank,0 schoolmaxscore,0 schoolavgscore
38
+        </if>
39
+        <if test="rank.showrank==1">
40
+            ,er.classmaxscore,er.classavgscore,0 classavgscorerank,0 schoolmaxscore,0 schoolavgscore
41
+        </if>
42
+        <if test="rank.showrank==2">
43
+            ,er.classmaxscore,er.classavgscore,er.classavgscorerank,0 schoolmaxscore,0 schoolavgscore
44
+        </if>
45
+        <if test="rank.showrank==3">
46
+            ,er.classmaxscore,er.classavgscore,er.classavgscorerank,er.schoolmaxscore,er.schoolavgscore
47
+        </if>
37 48
         from e_rclass er
38 49
         where er.examid=#{rank.examid} and er.classid=#{rank.classid} and er.subjectid=#{rank.subjectid}
39 50
         limit 1

+ 34
- 5
sexam/src/main/resources/mapper/report/EReportClassMapper.xml View File

@@ -10,8 +10,14 @@
10 10
     </select>
11 11
     <!--试卷概况-题库-->
12 12
     <select id="listTkSjGk" resultType="java.util.Map">
13
-        select erq.qn,erq.qorder,erq.classavgscore,erq.classsrate,erq.gradeavgscore,erq.gradesrate,erq.classratetype
13
+        select erq.qn,erq.qorder,erq.classratetype
14 14
         ,erq.answerjson,erq.fullscorenum,erq.goodstujson,erq.badstujson,erq.questionid,erq.eptqid,erq.complexity,erq.score
15
+        <if test="rank.showrank==0">
16
+            ,0 classavgscore,0 classsrate,0 gradeavgscore,0 gradesrate
17
+        </if>
18
+        <if test="rank.showrank!=0">
19
+            ,erq.classavgscore,erq.classsrate,erq.gradeavgscore,erq.gradesrate
20
+        </if>
15 21
         from e_rclass_question erq
16 22
         where erq.examid=#{rank.examid} and erq.classid=#{rank.classid}
17 23
         and erq.subjectid=#{rank.subjectid}
@@ -29,9 +35,15 @@
29 35
     </select>
30 36
     <!--试卷概况-附件-->
31 37
     <select id="listFjSjGk" resultType="java.util.Map">
32
-        select erq.qn,erq.qorder,erq.classavgscore,erq.classsrate,erq.gradeavgscore,erq.gradesrate
38
+        select erq.qn,erq.qorder
33 39
         ,erq.answerjson,erq.fullscorenum,erq.goodstujson,erq.badstujson,erq.eptqid,erq.classratetype
34 40
         ,epqq.ctype,epqq.score,epqq.answer,epqq.qtypename,epqq.optionnum
41
+        <if test="rank.showrank==0">
42
+            ,0 classavgscore,0 classsrate,0 gradeavgscore,0 gradesrate
43
+        </if>
44
+        <if test="rank.showrank!=0">
45
+            ,erq.classavgscore,erq.classsrate,erq.gradeavgscore,erq.gradesrate
46
+        </if>
35 47
         from e_rclass_question erq left join e_paper_qtype_question epqq on erq.eptqid = epqq.eptqid
36 48
         where erq.examid=#{rank.examid} and erq.classid=#{rank.classid}
37 49
         and erq.subjectid=#{rank.subjectid}
@@ -40,7 +52,13 @@
40 52
     </select>
41 53
     <!--试卷分析-大题分析-->
42 54
     <select id="listType" resultType="java.util.Map">
43
-        select erq.qtypename,erq.qns,erq.score,erq.srate,erq.classavgscore,erq.classsrate,erq.gradeavgscore,erq.gradesrate
55
+        select erq.qtypename,erq.qns,erq.score,erq.srate
56
+        <if test="rank.showrank==0">
57
+            ,0 classavgscore,0 classsrate,0 gradeavgscore,0 gradesrate
58
+        </if>
59
+        <if test="rank.showrank!=0">
60
+            ,erq.classavgscore,erq.classsrate,erq.gradeavgscore,erq.gradesrate
61
+        </if>
44 62
         from e_rclass_qtype erq
45 63
         where erq.examid=#{rank.examid} and erq.classid=#{rank.classid}
46 64
         and erq.subjectid=#{rank.subjectid}
@@ -48,7 +66,12 @@
48 66
     <!--试卷分析-小题分析-->
49 67
     <select id="listQuestion" resultType="java.util.Map">
50 68
         select erq.eptqid,erq.qn,erq.qorder,erq.score,erq.qtypename,erq.complexity
51
-        ,erq.classavgscore,erq.classsrate,erq.gradeavgscore,erq.gradesrate
69
+        <if test="rank.showrank==0">
70
+            ,0 classavgscore,0 classsrate,0 gradeavgscore,0 gradesrate
71
+        </if>
72
+        <if test="rank.showrank!=0">
73
+            ,erq.classavgscore,erq.classsrate,erq.gradeavgscore,erq.gradesrate
74
+        </if>
52 75
         ,erq.answerjson,erq.fullscorenum
53 76
         from e_rclass_question erq
54 77
         where erq.examid=#{rank.examid} and erq.classid=#{rank.classid}
@@ -56,7 +79,13 @@
56 79
     </select>
57 80
     <!--试卷分析-知识点分析-->
58 81
     <select id="listPoint" resultType="java.util.Map">
59
-        select erp.pointname,erp.qns,erp.score,erp.srate,erp.classavgscore,erp.classsrate,erp.gradeavgscore,erp.gradesrate
82
+        select erp.pointname,erp.qns,erp.score,erp.srate
83
+        <if test="rank.showrank==0">
84
+            ,0 classavgscore,0 classsrate,0 gradeavgscore,0 gradesrate
85
+        </if>
86
+        <if test="rank.showrank!=0">
87
+            ,erp.classavgscore,erp.classsrate,erp.gradeavgscore,erp.gradesrate
88
+        </if>
60 89
         from e_rclass_point erp
61 90
         where erp.examid=#{rank.examid} and erp.classid=#{rank.classid}
62 91
         and erp.subjectid=#{rank.subjectid}

+ 12
- 4
sexam/src/main/resources/mapper/report/ERstudentMapper.xml View File

@@ -9,8 +9,8 @@
9 9
         </collection>
10 10
     </resultMap>
11 11
     <select id="listSubject" resultType="java.util.Map">
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
12
+        select s.score,s.classrank,s.classrankpre
13
+        ,s.schoolrank,s.goal,s.nextgoal,s.subjectname,s.subjectid,s.bzscore
14 14
         ,eps.device,eps.submittype,eps.endtime
15 15
         ,(case when s.subjectid='zf' then (select (
16 16
         case when count(eps2.epsid)=count(case when eps2.sstate=3 then eps2.epsid else null end) then 3 else 2 end)
@@ -362,8 +362,16 @@
362 362
     <!--班级报告教师成绩单-->
363 363
     <select id="listTeacherCjd" resultType="java.util.Map">
364 364
         select cs.examid,cs.classid,cs.studentid,u.username,u.loginname,u.usersex,u.examno
365
-        ,s.score,s.classrank,s.classrankpre,s.classmaxscore,s.classavgscore
366
-        ,s.schoolrank,s.schoolmaxscore,s.schoolavgscore,s.goal,s.nextgoal,s.subjectname,s.subjectid,s.bzscore
365
+        ,s.score,s.subjectname,s.subjectid
366
+        <if test="stu.showrank==0 or stu.showrank==1">
367
+            ,0 classrank,0 schoolrank
368
+        </if>
369
+        <if test="stu.showrank==2">
370
+            ,s.classrank,0 schoolrank
371
+        </if>
372
+        <if test="stu.showrank==3">
373
+            ,s.classrank,s.schoolrank
374
+        </if>
367 375
         ,eps.device,eps.submittype,eps.endtime
368 376
         from e_class_student cs left join t_user u on cs.studentid=u.userid
369 377
         left join e_rstudent s on cs.classid = s.classid and cs.examid=s.examid and cs.studentid=s.studentid

Loading…
Cancel
Save