Sfoglia il codice sorgente

Merge remote-tracking branch 'cloud-schoolapi/ywx'

tags/正式版本
王宁 2 anni fa
parent
commit
a5237f38a6

+ 12
- 0
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/EBaseController.java Vedi File

@@ -530,4 +530,16 @@ public class EBaseController {
530 530
         return new ResultVo(0, "设置成功");
531 531
     }
532 532
 
533
+    /*
534
+     * 处理班级试题作答详情和满分
535
+     * @Param []
536
+     * @Author ywx
537
+     * @Date 2022/11/23 15:13
538
+     * @return com.xhkjedu.vo.ResultVo
539
+     **/
540
+    @PostMapping("/handle_answerjson")
541
+    public ResultVo handleAnswerjson() {
542
+        eReportGenerateService.handleAnswerjson();
543
+        return new ResultVo(0, "设置成功");
544
+    }
533 545
 }

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/EBaseMapper.java Vedi File

@@ -62,5 +62,5 @@ public interface EBaseMapper extends TkMapper<EBase> {
62 62
     EBaseVo getExamStateAndMode(@Param("examid") Integer examid);
63 63
 
64 64
     //根据考试id获取显示排名
65
-    Integer getShowRankById(@Param("examid") Integer examid);
65
+    EBase getShowRankById(@Param("examid") Integer examid);
66 66
 }

+ 14
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/report/EReportGenerateMapper.java Vedi File

@@ -1,5 +1,7 @@
1 1
 package com.xhkjedu.sexam.mapper.report;
2 2
 
3
+import com.xhkjedu.sexam.model.exam.EClass;
4
+import com.xhkjedu.sexam.model.reportclass.ERclassQuestion;
3 5
 import com.xhkjedu.sexam.model.reportstu.ERstudent;
4 6
 import org.apache.ibatis.annotations.Param;
5 7
 
@@ -36,4 +38,16 @@ public interface EReportGenerateMapper {
36 38
 
37 39
     //根据考试id获取考试模式
38 40
     Integer getExamModeById(@Param("examid") Integer examid);
41
+
42
+    //获取未处理的学生作答情况
43
+    List<ERclassQuestion> listAnswerJson();
44
+
45
+    //获取复合题满分人数
46
+    Integer getFullscorenum(@Param("q") ERclassQuestion q);
47
+
48
+    //获取考试班级集合
49
+    List<EClass> listClassByExamIds(@Param("examids") List<Integer> examids);
50
+
51
+    //更新班级试题作答详情和满分
52
+    void updateClassQuestion(@Param("q") ERclassQuestion q);
39 53
 }

+ 5
- 2
sexam/src/main/java/com/xhkjedu/sexam/model/exam/EBase.java Vedi File

@@ -36,8 +36,11 @@ public class EBase extends BaseBean {
36 36
     //考试状态0未开始1已开始2已结束3已生成报告
37 37
     private Integer examstate;
38 38
 
39
-    //显示排名0不显示1显示
40
-    private Integer showrank;
39
+    //教师显示排名得分0保密1分数2分数+班排名3分数+校排名
40
+    private Integer teashowrank;
41
+
42
+    //学生显示排名得分0保密1分数2分数+班排名3分数+校排名
43
+    private Integer stushowrank;
41 44
 
42 45
     //考试公告
43 46
     private String examcomm;

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/reportclass/ERclassQuestion.java Vedi File

@@ -83,4 +83,7 @@ public class ERclassQuestion extends BaseBean {
83 83
 
84 84
     //违规学生
85 85
     private String badstujson;
86
+
87
+    //满分人数
88
+    private Integer fullscorenum;
86 89
 }

+ 4
- 2
sexam/src/main/java/com/xhkjedu/sexam/service/exam/EBaseService.java Vedi File

@@ -67,7 +67,8 @@ public class EBaseService {
67 67
         try {
68 68
             //考试
69 69
             model.setExamstate(0);
70
-            model.setShowrank(0);
70
+            model.setTeashowrank(0);
71
+            model.setStushowrank(0);
71 72
             model.setDeleted(1);
72 73
             model.setReportstate(0);
73 74
             model.setCreatetime(N_Utils.getSecondTimestamp());
@@ -511,7 +512,8 @@ public class EBaseService {
511 512
 
512 513
     //设置学生报告排名显示
513 514
     public void setShowRank(EBase eBase) {
514
-        if (eBase.getShowrank() == null) eBase.setShowrank(0);
515
+        if (eBase.getTeashowrank() == null) eBase.setTeashowrank(0);
516
+        if (eBase.getStushowrank() == null) eBase.setStushowrank(0);
515 517
         eBaseMapper.updateByPrimaryKeySelective(eBase);
516 518
     }
517 519
 }

+ 74
- 5
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportGenerateService.java Vedi File

@@ -14,6 +14,7 @@ import com.xhkjedu.sexam.mapper.report.ERsubjectMapper;
14 14
 import com.xhkjedu.sexam.mapper.reportclass.*;
15 15
 import com.xhkjedu.sexam.mapper.reportstu.*;
16 16
 import com.xhkjedu.sexam.mapper.system.UserMapper;
17
+import com.xhkjedu.sexam.model.exam.EClass;
17 18
 import com.xhkjedu.sexam.model.paperstudent.EPaperStudentQuestion;
18 19
 import com.xhkjedu.sexam.model.report.ERbase;
19 20
 import com.xhkjedu.sexam.model.report.ERrank;
@@ -28,6 +29,7 @@ import com.xhkjedu.sexam.vo.report.ERPointStuScoreVo;
28 29
 import com.xhkjedu.sexam.vo.report.ExamPaperClassVo;
29 30
 import com.xhkjedu.sexam.vo.system.UserVo;
30 31
 import com.xhkjedu.utils.N_Utils;
32
+import lombok.extern.slf4j.Slf4j;
31 33
 import org.springframework.stereotype.Service;
32 34
 import org.springframework.transaction.annotation.Transactional;
33 35
 
@@ -44,6 +46,7 @@ import java.util.stream.Collectors;
44 46
  * @date 2022/8/8 10:04
45 47
  **/
46 48
 @Service
49
+@Slf4j
47 50
 public class EReportGenerateService {
48 51
     @Resource
49 52
     private EReportGenerateMapper eReportGenerateMapper;
@@ -1726,7 +1729,9 @@ public class EReportGenerateService {
1726 1729
         String key2 = "";
1727 1730
         String key3 = "";
1728 1731
 
1729
-        for (int i = 0; i < classStu.size(); i++) {
1732
+        Double qscore = q.getQscore();
1733
+        int stunum = classStu.size();
1734
+        for (int i = 0; i < stunum; i++) {
1730 1735
             EPaperStudentQuestion sq = classStu.get(i);
1731 1736
             String stuanswer = sq.getStuanswer();
1732 1737
             if (q.getCtype() == 1 || q.getCtype() == 2 || q.getCtype() == 4 || q.getCtype() == 5 || q.getCtype() == 6) {
@@ -1761,9 +1766,9 @@ public class EReportGenerateService {
1761 1766
                 if (i == 0) {
1762 1767
                     answermap = new LinkedHashMap<>();
1763 1768
                     //处理分数分段对应,用于分数段[0,50%)   [50%,80%),  [80%,100%]
1764
-                    score8 = ExamUtil.getScoreRateScore(q.getQscore(), 0.8);
1765
-                    score5 = ExamUtil.getScoreRateScore(q.getQscore(), 0.5);
1766
-                    String str10 = N_Utils.formatDouble(q.getQscore());
1769
+                    score8 = ExamUtil.getScoreRateScore(qscore, 0.8);
1770
+                    score5 = ExamUtil.getScoreRateScore(qscore, 0.5);
1771
+                    String str10 = N_Utils.formatDouble(qscore);
1767 1772
                     String str8 = N_Utils.formatDouble(score8);
1768 1773
                     String str5 = N_Utils.formatDouble(score5);
1769 1774
                     key1 = str8 + "-" + str10;
@@ -1819,8 +1824,24 @@ public class EReportGenerateService {
1819 1824
             }
1820 1825
         }
1821 1826
 
1827
+        List<Map> dafblist = new ArrayList<>();//答案分布
1828
+        Map<String, Map> dafbmap = new HashMap<>();//答案分布
1829
+        for (Map.Entry<String, List<Map>> entry : answermap.entrySet()) {
1830
+            String key = entry.getKey();
1831
+            List<Map> students = entry.getValue();
1832
+            Map dafb = new HashMap();
1833
+            int num = students.size();
1834
+            dafb.put("students", students);
1835
+            dafb.put("num", num);
1836
+            dafb.put("numrate", N_Utils.getIntegerDivideAndMulitiply(num, stunum));
1837
+            dafbmap.put(key, dafb);
1838
+        }
1839
+
1822 1840
         Map rtnmap = new HashMap();
1823
-        rtnmap.put("answerlist", JSON.toJSONString(answermap));
1841
+        rtnmap.put("answerlist", JSON.toJSONString(dafbmap));
1842
+        long fullscorenum = classStu.stream().filter(c -> qscore.equals(c.getStuscore())).count();
1843
+        rtnmap.put("fullscorenum", fullscorenum);
1844
+        rtnmap.put("dafbjson", JSON.toJSONString(dafblist));
1824 1845
         rtnmap.put("goodlist", JSON.toJSONString(goodlist));
1825 1846
         rtnmap.put("badlist", JSON.toJSONString(badlist));
1826 1847
         rtnmap.put("erroroption",erroroption);
@@ -1905,6 +1926,7 @@ public class EReportGenerateService {
1905 1926
                         ercq.setGradesrate(qgsrate);
1906 1927
                         //处理单选题选项情况
1907 1928
                         Map stuansmap = setPaperQuestionsForStuAnswer(qcstulist);
1929
+                        ercq.setFullscorenum(N_Utils.str2Int(stuansmap.get("fullscorenum").toString()));
1908 1930
                         ercq.setAnswerjson(stuansmap.get("answerlist").toString());
1909 1931
                         if(N_Utils.isNotEmpty(stuansmap.get("goodlist"))){
1910 1932
                             ercq.setGoodstujson(stuansmap.get("goodlist").toString());
@@ -2136,6 +2158,7 @@ public class EReportGenerateService {
2136 2158
                         ercq.setGradesrate(N_Utils.getDoubleDivideAndMulitiply(qgstuscore,qgscore));
2137 2159
                         //处理单选题选项情况
2138 2160
                         Map stuansmap = setPaperQuestionsForStuAnswer(qcstulist);
2161
+                        ercq.setFullscorenum(N_Utils.str2Int(stuansmap.get("fullscorenum").toString()));
2139 2162
                         ercq.setAnswerjson(stuansmap.get("answerlist").toString());
2140 2163
                         if(N_Utils.isNotEmpty(stuansmap.get("goodlist"))){
2141 2164
                             ercq.setGoodstujson(stuansmap.get("goodlist").toString());
@@ -2441,4 +2464,50 @@ public class EReportGenerateService {
2441 2464
             }
2442 2465
         }
2443 2466
     }
2467
+
2468
+    //处理班级试题作答详情和满分
2469
+    public void handleAnswerjson() {
2470
+        List<ERclassQuestion> list = eReportGenerateMapper.listAnswerJson();//获取未处理的学生作答情况
2471
+        List<Integer> examids = list.stream().map(l -> l.getExamid()).distinct().collect(Collectors.toList());
2472
+        List<EClass> classes = eReportGenerateMapper.listClassByExamIds(examids);//获取考试班级集合
2473
+        Map<String, Integer> classMap = classes.stream().collect(Collectors.toMap(
2474
+                c -> c.getExamid() + "_" + c.getClassid(), c -> c.getClassnum()));
2475
+        for (ERclassQuestion q : list) {
2476
+            new Thread(()->{
2477
+                try {
2478
+                    updateClassQuestion(classMap, q);
2479
+                }catch (Exception e){
2480
+                    log.error("处理单个班级试题重试:" + e.getMessage());
2481
+                    try {
2482
+                        updateClassQuestion(classMap, q);
2483
+                    }catch (Exception se){
2484
+                        log.error("处理单个班级试题重试出错:" + se.getMessage());
2485
+                    }
2486
+                }
2487
+            }).start();
2488
+        }
2489
+    }
2490
+
2491
+    //处理单个班级试题
2492
+    private void updateClassQuestion(Map<String, Integer> classMap, ERclassQuestion q) {
2493
+        if (N_Utils.isEmptyInteger(q.getEptqid())) {
2494
+            Integer fullscorenum = eReportGenerateMapper.getFullscorenum(q);
2495
+            q.setFullscorenum(fullscorenum);
2496
+        }
2497
+        Integer stunum = classMap.get(q.getExamid() + "_" + q.getClassid());
2498
+        Map<String, Map> dafbmap = new HashMap<>();//答案分布
2499
+        Map<String, List<Map>> answer = JSON.parseObject(q.getAnswerjson(), Map.class);
2500
+        for (Map.Entry<String, List<Map>> entry : answer.entrySet()) {
2501
+            String key = entry.getKey();
2502
+            List<Map> students = entry.getValue();
2503
+            int num = students.size();
2504
+            Map dafb = new HashMap();
2505
+            dafb.put("students", students);
2506
+            dafb.put("num", num);
2507
+            dafb.put("numrate", N_Utils.getIntegerDivideAndMulitiply(num, stunum));
2508
+            dafbmap.put(key, dafb);
2509
+        }
2510
+        q.setAnswerjson(JSON.toJSONString(dafbmap));
2511
+        eReportGenerateMapper.updateClassQuestion(q);
2512
+    }
2444 2513
 }

+ 35
- 23
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportStudentService.java Vedi File

@@ -8,6 +8,7 @@ import com.xhkjedu.sexam.mapper.paper.EPaperAnalyzeMapper;
8 8
 import com.xhkjedu.sexam.mapper.paper.EPaperFileMapper;
9 9
 import com.xhkjedu.sexam.mapper.paper.EPaperMapper;
10 10
 import com.xhkjedu.sexam.mapper.reportstu.ERstudentMapper;
11
+import com.xhkjedu.sexam.model.exam.EBase;
11 12
 import com.xhkjedu.sexam.utils.ExamUtil;
12 13
 import com.xhkjedu.utils.N_Utils;
13 14
 import org.springframework.stereotype.Service;
@@ -73,10 +74,11 @@ public class EReportStudentService {
73 74
      **/
74 75
     public Map listStudentSubjectScoreByExamid(Integer examid, Integer studentid, Integer teacherid) {
75 76
         Integer showrank;
77
+        EBase base = eBaseMapper.getShowRankById(examid);
76 78
         if (!N_Utils.isEmptyInteger(teacherid)) {
77
-            showrank = 1;
79
+            showrank = base.getTeashowrank();
78 80
         } else {
79
-            showrank = eBaseMapper.getShowRankById(examid);
81
+            showrank = base.getStushowrank();
80 82
         }
81 83
         List<Map> list = eRstudentMapper.getStudentScoreByExamid(examid, studentid, showrank);
82 84
         Map rtnmap = new LinkedHashMap();
@@ -84,7 +86,7 @@ public class EReportStudentService {
84 86
         if (list != null && list.size() > 0) {
85 87
             String classnum = "0";
86 88
             String gradenum = "0";
87
-            if (showrank == 1) {
89
+            if (showrank != 0) {
88 90
                 Map map1 = list.get(0);
89 91
                 Integer classid = Integer.parseInt(map1.get("classid").toString());
90 92
                 Map gcnum = eRstudentMapper.getStudentNumByExamid(examid, classid);
@@ -107,12 +109,13 @@ public class EReportStudentService {
107 109
      **/
108 110
     public List<Map> listStudentRankHistory(Integer studentid, Integer examid, Integer teacherid) {
109 111
         Integer showrank;
112
+        EBase base = eBaseMapper.getShowRankById(examid);
110 113
         if (!N_Utils.isEmptyInteger(teacherid)) {
111
-            showrank = 1;
114
+            showrank = base.getTeashowrank();
112 115
         } else if (N_Utils.isEmptyInteger(examid)) {
113 116
             showrank = 0;
114 117
         } else {
115
-            showrank = eBaseMapper.getShowRankById(examid);
118
+            showrank = base.getStushowrank();
116 119
         }
117 120
         if (showrank == 0) return new ArrayList<>();
118 121
         return eRstudentMapper.listStudentExamHistory(studentid, "zf");
@@ -127,10 +130,11 @@ public class EReportStudentService {
127 130
      **/
128 131
     public Map getSubjectScoreByStudentid(Integer examid, Integer studentid, String subjectid, Integer teacherid) {
129 132
         Integer showrank;
133
+        EBase base = eBaseMapper.getShowRankById(examid);
130 134
         if (!N_Utils.isEmptyInteger(teacherid)) {
131
-            showrank = 1;
135
+            showrank = base.getTeashowrank();
132 136
         } else {
133
-            showrank = eBaseMapper.getShowRankById(examid);
137
+            showrank = base.getStushowrank();
134 138
         }
135 139
         Map rtnmap = eRstudentMapper.getSubjectScoreByStudentid(examid, studentid, subjectid, showrank);
136 140
         if (rtnmap != null && rtnmap.size() > 0) {
@@ -164,10 +168,11 @@ public class EReportStudentService {
164 168
      **/
165 169
     public List<Map> listSubjectPoints(Integer examid, Integer studentid, String subjectid, Integer teacherid) {
166 170
         Integer showrank;
171
+        EBase base = eBaseMapper.getShowRankById(examid);
167 172
         if (!N_Utils.isEmptyInteger(teacherid)) {
168
-            showrank = 1;
173
+            showrank = base.getTeashowrank();
169 174
         } else {
170
-            showrank = eBaseMapper.getShowRankById(examid);
175
+            showrank = base.getStushowrank();
171 176
         }
172 177
         return eRstudentMapper.listSubjectPoints(examid, studentid, subjectid, showrank);
173 178
     }
@@ -181,10 +186,11 @@ public class EReportStudentService {
181 186
      **/
182 187
     public List<Map> listSubjectComplexitys(Integer examid, Integer studentid, String subjectid, Integer teacherid) {
183 188
         Integer showrank;
189
+        EBase base = eBaseMapper.getShowRankById(examid);
184 190
         if (!N_Utils.isEmptyInteger(teacherid)) {
185
-            showrank = 1;
191
+            showrank = base.getTeashowrank();
186 192
         } else {
187
-            showrank = eBaseMapper.getShowRankById(examid);
193
+            showrank = base.getStushowrank();
188 194
         }
189 195
         return eRstudentMapper.listSubjectComplexitys(examid, studentid, subjectid, showrank);
190 196
     }
@@ -198,10 +204,11 @@ public class EReportStudentService {
198 204
      **/
199 205
     public List<Map> listSubjectQtypes(Integer examid, Integer studentid, String subjectid, Integer teacherid) {
200 206
         Integer showrank;
207
+        EBase base = eBaseMapper.getShowRankById(examid);
201 208
         if (!N_Utils.isEmptyInteger(teacherid)) {
202
-            showrank = 1;
209
+            showrank = base.getTeashowrank();
203 210
         } else {
204
-            showrank = eBaseMapper.getShowRankById(examid);
211
+            showrank = base.getStushowrank();
205 212
         }
206 213
         return eRstudentMapper.listSubjectQtypes(examid, studentid, subjectid, showrank);
207 214
     }
@@ -215,10 +222,11 @@ public class EReportStudentService {
215 222
      **/
216 223
     public List<Map> listSubjectQuestions(Integer examid, Integer studentid, String subjectid, Integer teacherid) {
217 224
         Integer showrank;
225
+        EBase base = eBaseMapper.getShowRankById(examid);
218 226
         if (!N_Utils.isEmptyInteger(teacherid)) {
219
-            showrank = 1;
227
+            showrank = base.getTeashowrank();
220 228
         } else {
221
-            showrank = eBaseMapper.getShowRankById(examid);
229
+            showrank = base.getStushowrank();
222 230
         }
223 231
         Map map = ePaperMapper.getPaperByExamidAndSubjectid(examid, subjectid);
224 232
         Integer ptype = Integer.parseInt(map.get("ptype").toString());
@@ -276,10 +284,11 @@ public class EReportStudentService {
276 284
     public Map getStudentPaperQuestions(Integer examid, Integer studentid, String subjectid, Integer teacherid) {
277 285
         Integer showrank;
278 286
         Integer pstate = eSubjectMapper.getPstateByExamIdSid(examid, subjectid);
287
+        EBase base = eBaseMapper.getShowRankById(examid);
279 288
         if (!N_Utils.isEmptyInteger(teacherid)) {
280
-            showrank = 1;
289
+            showrank = base.getTeashowrank();
281 290
         } else {
282
-            showrank = eBaseMapper.getShowRankById(examid);
291
+            showrank = base.getStushowrank();
283 292
         }
284 293
         Map map = ePaperMapper.getPaperByExamidAndSubjectid(examid, subjectid);
285 294
         Integer ptype = Integer.parseInt(map.get("ptype").toString());
@@ -423,10 +432,11 @@ public class EReportStudentService {
423 432
      **/
424 433
     public List<Map> listStudentSubjectErrorQues(Integer examid, Integer studentid, Integer teacherid) {
425 434
         Integer showrank;
435
+        EBase base = eBaseMapper.getShowRankById(examid);
426 436
         if (!N_Utils.isEmptyInteger(teacherid)) {
427
-            showrank = 1;
437
+            showrank = base.getTeashowrank();
428 438
         } else {
429
-            showrank = eBaseMapper.getShowRankById(examid);
439
+            showrank = base.getStushowrank();
430 440
         }
431 441
         List<Map> list = eRstudentMapper.listStudentSubjectErrorQues(examid, studentid, showrank);
432 442
         if (showrank == 0) return list;
@@ -465,10 +475,11 @@ public class EReportStudentService {
465 475
     public Map listStudentErrorQuestionsTk(Integer examid, Integer studentid, String subjectid, Integer teacherid) {
466 476
         Integer pstate = eSubjectMapper.getPstateByExamIdSid(examid, subjectid);
467 477
         Integer showrank;
478
+        EBase base = eBaseMapper.getShowRankById(examid);
468 479
         if (!N_Utils.isEmptyInteger(teacherid)) {
469
-            showrank = 1;
480
+            showrank = base.getTeashowrank();
470 481
         } else {
471
-            showrank = eBaseMapper.getShowRankById(examid);
482
+            showrank = base.getStushowrank();
472 483
         }
473 484
         if (showrank == 0) {
474 485
             Map map = new HashMap();
@@ -519,10 +530,11 @@ public class EReportStudentService {
519 530
      **/
520 531
     public List<Map> listStudentErrorQuestionsFj(Integer examid, Integer studentid, String subjectid, Integer teacherid) {
521 532
         Integer showrank;
533
+        EBase base = eBaseMapper.getShowRankById(examid);
522 534
         if (!N_Utils.isEmptyInteger(teacherid)) {
523
-            showrank = 1;
535
+            showrank = base.getTeashowrank();
524 536
         } else {
525
-            showrank = eBaseMapper.getShowRankById(examid);
537
+            showrank = base.getStushowrank();
526 538
         }
527 539
         if (showrank == 0) return new ArrayList<>();
528 540
         List<Map> list = eRstudentMapper.listStudentErrorQuestionsForFj(examid, studentid, subjectid);

+ 6
- 5
sexam/src/main/resources/mapper/exam/EBaseMapper.xml Vedi File

@@ -12,7 +12,7 @@
12 12
     </delete>
13 13
     <!--考试列表-->
14 14
     <select id="listAll" resultType="java.util.Map">
15
-        select b.examid,b.examname,b.examdate,b.gradeid,b.examtype,b.exammode,b.monitored,b.showrank
15
+        select b.examid,b.examname,b.examdate,b.gradeid,b.examtype,b.exammode,b.monitored,b.teashowrank,b.stushowrank
16 16
         ,b.examstate,u.username createname,group_concat(distinct es.subjectname order by es.esid separator '|')subjectname
17 17
         ,count(distinct case when es.begintime is null or es.begintime='' then es.esid else null end)esnum
18 18
         ,min(es.esstate)esstate,min(es.pstate)pstate,min(ifnull(ep.correcttype,0))correcttype
@@ -62,12 +62,13 @@
62 62
     </update>
63 63
     <!--考试基本信息-->
64 64
     <select id="findById" resultType="java.util.Map">
65
-        select examid,examname,gradeid,examdate,examtype,exammode,monitored,examstate,showrank
65
+        select examid,examname,gradeid,examdate,examtype,exammode,monitored,examstate,teashowrank,stushowrank
66 66
         from e_base where examid=#{examid}
67 67
     </select>
68 68
     <!--考试基本信息(带考试人数)-->
69 69
     <select id="findById2" resultType="java.util.Map">
70
-        select b.examid,b.examname,b.examdate,b.examtype,b.gradeid,b.exammode,b.monitored,b.examstate,b.examcomm,showrank
70
+        select b.examid,b.examname,b.examdate,b.examtype,b.gradeid,b.exammode,b.monitored,b.examstate,b.examcomm
71
+        ,teashowrank,stushowrank
71 72
         ,(select sum(c.classnum) from e_class c where c.examid=b.examid)examnum
72 73
         from e_base b where b.examid=#{examid}
73 74
     </select>
@@ -124,8 +125,8 @@
124 125
         from e_base eb where eb.examid=#{examid}
125 126
     </select>
126 127
     <!--根据考试id获取显示排名-->
127
-    <select id="getShowRankById" resultType="java.lang.Integer">
128
-        select eb.showrank
128
+    <select id="getShowRankById" resultType="com.xhkjedu.sexam.model.exam.EBase">
129
+        select eb.teashowrank,eb.stushowrank
129 130
         from e_base eb where eb.examid=#{examid}
130 131
     </select>
131 132
 </mapper>

+ 3
- 2
sexam/src/main/resources/mapper/report/EReportClassMapper.xml Vedi File

@@ -11,7 +11,7 @@
11 11
     <!--试卷概况-题库-->
12 12
     <select id="listTkSjGk" resultType="java.util.Map">
13 13
         select erq.qn,erq.qorder,erq.classavgscore,erq.classsrate,erq.gradeavgscore,erq.gradesrate,erq.classratetype
14
-        ,erq.answerjson,erq.goodstujson,erq.badstujson,erq.questionid,erq.eptqid,erq.complexity,erq.score
14
+        ,erq.answerjson,erq.fullscorenum,erq.goodstujson,erq.badstujson,erq.questionid,erq.eptqid,erq.complexity,erq.score
15 15
         from e_rclass_question erq
16 16
         where erq.examid=#{rank.examid} and erq.classid=#{rank.classid}
17 17
         and erq.subjectid=#{rank.subjectid}
@@ -30,7 +30,7 @@
30 30
     <!--试卷概况-附件-->
31 31
     <select id="listFjSjGk" resultType="java.util.Map">
32 32
         select erq.qn,erq.qorder,erq.classavgscore,erq.classsrate,erq.gradeavgscore,erq.gradesrate
33
-        ,erq.answerjson,erq.goodstujson,erq.badstujson,erq.eptqid,erq.classratetype
33
+        ,erq.answerjson,erq.fullscorenum,erq.goodstujson,erq.badstujson,erq.eptqid,erq.classratetype
34 34
         ,epqq.ctype,epqq.score,epqq.answer,epqq.qtypename,epqq.optionnum
35 35
         from e_rclass_question erq left join e_paper_qtype_question epqq on erq.eptqid = epqq.eptqid
36 36
         where erq.examid=#{rank.examid} and erq.classid=#{rank.classid}
@@ -49,6 +49,7 @@
49 49
     <select id="listQuestion" resultType="java.util.Map">
50 50
         select erq.eptqid,erq.qn,erq.qorder,erq.score,erq.qtypename,erq.complexity
51 51
         ,erq.classavgscore,erq.classsrate,erq.gradeavgscore,erq.gradesrate
52
+        ,erq.answerjson,erq.fullscorenum
52 53
         from e_rclass_question erq
53 54
         where erq.examid=#{rank.examid} and erq.classid=#{rank.classid}
54 55
         and erq.subjectid=#{rank.subjectid}

+ 23
- 0
sexam/src/main/resources/mapper/report/EReportGenerateMapper.xml Vedi File

@@ -64,4 +64,27 @@
64 64
     <select id="getExamModeById" resultType="java.lang.Integer">
65 65
         select exammode from e_base where examid=#{examid}
66 66
     </select>
67
+    <!--获取未处理的学生作答情况-->
68
+    <select id="listAnswerJson" resultType="com.xhkjedu.sexam.model.reportclass.ERclassQuestion">
69
+        select q.answerjson,q.rcqid,q.examid,q.epid,q.classid,q.qn,q.score,q.eptqid
70
+        ,(case when q.eptqid is not null then (select count(*) from e_paper_student_question s
71
+        where s.eptqid=q.eptqid and s.qscore=s.stuscore)
72
+        else 0 end)fullscorenum
73
+        from e_rclass_question q where q.answerjson not like '%numrate%'
74
+    </select>
75
+    <!--获取复合题满分人数-->
76
+    <select id="getFullscorenum" resultType="java.lang.Integer">
77
+        select count(*) from(select sum(s.stuscore)sscore,s.studentid
78
+        from e_paper_student_question s where s.epid=#{q.epid} and find_in_set(s.qn,#{q.qn})
79
+        group by s.studentid )a where a.sscore=#{q.score}
80
+    </select>
81
+    <!--获取考试班级集合-->
82
+    <select id="listClassByExamIds" resultType="com.xhkjedu.sexam.model.exam.EClass">
83
+        select ec.classid,ec.classnum,ec.examid from e_class ec where ec.examid in
84
+        <foreach collection="examids" item="examid" open="(" separator="," close=")">#{examid}</foreach>
85
+    </select>
86
+    <!--更新班级试题作答详情和满分-->
87
+    <update id="updateClassQuestion">
88
+        update e_rclass_question set answerjson=#{q.answerjson},fullscorenum=#{q.fullscorenum} where rcqid=#{q.rcqid}
89
+    </update>
67 90
 </mapper>

+ 26
- 16
sexam/src/main/resources/mapper/report/ERstudentMapper.xml Vedi File

@@ -45,7 +45,15 @@
45 45
              ,0 schoolmaxscore,0 schoolavgscore,0 goal,0 nextgoal
46 46
         </if>
47 47
         <if test="showrank==1">
48
-            ,rs.score,rs.bzscore,rs.classrank,rs.classrankpre,rs.classmaxscore,rs.classavgscore,rs.schoolrank
48
+            ,rs.score,rs.bzscore,0 classrank,0 classrankpre,rs.classmaxscore,rs.classavgscore,0 schoolrank
49
+            ,rs.schoolmaxscore,rs.schoolavgscore,0 goal,0 nextgoal
50
+        </if>
51
+        <if test="showrank==2">
52
+            ,rs.score,rs.bzscore,rs.classrank,rs.classrankpre,rs.classmaxscore,rs.classavgscore,0 schoolrank
53
+            ,rs.schoolmaxscore,rs.schoolavgscore,0 goal,0 nextgoal
54
+        </if>
55
+        <if test="showrank==3">
56
+            ,rs.score,rs.bzscore,0 classrank,0 classrankpre,rs.classmaxscore,rs.classavgscore,rs.schoolrank
49 57
             ,rs.schoolmaxscore,rs.schoolavgscore,rs.goal,rs.nextgoal
50 58
         </if>
51 59
         ,eps.device,eps.submittype,eps.endtime
@@ -81,7 +89,15 @@
81 89
             ,0 schoolmaxscore,0 schoolavgscore,0 goal,0 nextgoal
82 90
         </if>
83 91
         <if test="showrank==1">
84
-            ,rs.score,rs.bzscore,rs.classrank,rs.classrankpre,rs.classmaxscore,rs.classavgscore,rs.schoolrank
92
+            ,rs.score,rs.bzscore,0 classrank,0 classrankpre,rs.classmaxscore,rs.classavgscore,0 schoolrank
93
+            ,rs.schoolmaxscore,rs.schoolavgscore,0 goal,0 nextgoal
94
+        </if>
95
+        <if test="showrank==2">
96
+            ,rs.score,rs.bzscore,rs.classrank,rs.classrankpre,rs.classmaxscore,rs.classavgscore,0 schoolrank
97
+            ,rs.schoolmaxscore,rs.schoolavgscore,0 goal,0 nextgoal
98
+        </if>
99
+        <if test="showrank==3">
100
+            ,rs.score,rs.bzscore,0 classrank,0 classrankpre,rs.classmaxscore,rs.classavgscore,rs.schoolrank
85 101
             ,rs.schoolmaxscore,rs.schoolavgscore,rs.goal,rs.nextgoal
86 102
         </if>
87 103
         from e_rstudent rs where rs.examid=#{examid} and rs.studentid=#{studentid} and rs.subjectid=#{subjectid}
@@ -93,7 +109,7 @@
93 109
             ,0 stuscore,0 stusrate,0 gradescore,0 gradesrate,0 gradeavgscore
94 110
             ,0 classscore,0 classsrate,0 classavgscore
95 111
         </if>
96
-        <if test="showrank==1">
112
+        <if test="showrank!=0">
97 113
             ,sp.stuscore,sp.stusrate,cp.gradescore,cp.gradesrate,cp.gradeavgscore
98 114
             ,cp.classscore,cp.classsrate,cp.classavgscore
99 115
         </if>
@@ -108,7 +124,7 @@
108 124
             ,0 stuscore,0 stusrate,0 gradescore,0 gradeavgscore,0 gradesrate
109 125
             ,0 classscore,0 classavgscore,0 classsrate
110 126
         </if>
111
-        <if test="showrank==1">
127
+        <if test="showrank!=0">
112 128
             ,sc.stuscore,sc.stusrate,cc.gradescore,cc.gradeavgscore,cc.gradesrate
113 129
             ,cc.classscore,cc.classavgscore,cc.classsrate
114 130
         </if>
@@ -123,7 +139,7 @@
123 139
             ,0 stuscore,0 stusrate,0 gradescore,0 gradesrate,0 gradeavgscore
124 140
             ,0 classscore,0 classsrate,0 classavgscore
125 141
         </if>
126
-        <if test="showrank==1">
142
+        <if test="showrank!=0">
127 143
             ,st.stuscore,st.stusrate,ct.gradescore,ct.gradesrate,ct.gradeavgscore
128 144
             ,ct.classscore,ct.classsrate,ct.classavgscore
129 145
         </if>
@@ -138,7 +154,7 @@
138 154
             ,0 stuscore,0 classscore,0 classsrate,0 gradescore,0 gradesrate
139 155
             ,0 gradeavgscore,0 classavgscore
140 156
         </if>
141
-        <if test="showrank==1">
157
+        <if test="showrank!=0">
142 158
             ,sq.stuscore,cq.classscore,cq.classsrate,cq.gradescore,cq.gradesrate
143 159
             ,cq.gradeavgscore,cq.classavgscore
144 160
         </if>
@@ -172,7 +188,7 @@
172 188
         <if test="showrank==0">
173 189
             ,0 classscore,0 classsrate,0 gradescore,0 gradesrate,0 classavgscore,0 gradeavgscore
174 190
         </if>
175
-        <if test="showrank==1">
191
+        <if test="showrank!=0">
176 192
             ,cq.classscore,cq.classsrate,cq.gradescore,cq.gradesrate,cq.classavgscore,cq.gradeavgscore
177 193
         </if>
178 194
         from e_rclass_question cq
@@ -181,12 +197,6 @@
181 197
     </select>
182 198
     <select id="listSubjectQuestionsStuScore" resultType="java.util.Map">
183 199
         select sq.stuscore,sq.qscore,sq.questionid squestionid
184
-        <!--<if test="showrank==0">-->
185
-        <!--    ,0 stuscore-->
186
-        <!--</if>-->
187
-        <!--<if test="showrank==1">-->
188
-        <!--    ,sq.stuscore-->
189
-        <!--</if>-->
190 200
         from e_paper_student_question sq
191 201
         left join t_question q on sq.questionid=q.questionid
192 202
         where sq.studentid=#{studentid} and sq.epid=#{epid} and (q.questionid=#{questionid} or q.questionpid=#{questionid})
@@ -245,7 +255,7 @@
245 255
         <if test="showrank==0">
246 256
             ,0 stuscore,0 classavgscore,0 gradeavgscore
247 257
         </if>
248
-        <if test="showrank==1">
258
+        <if test="showrank!=0">
249 259
             ,sq.stuscore,cq.classavgscore,cq.gradeavgscore
250 260
         </if>
251 261
         from e_paper_student_question sq left join t_question q on sq.questionid=q.questionid
@@ -273,7 +283,7 @@
273 283
         <if test="showrank==0">
274 284
             ,0 stuscore,0 classavgscore,0 gradeavgscore
275 285
         </if>
276
-        <if test="showrank==1">
286
+        <if test="showrank!=0">
277 287
             ,sq.stuscore,cq.classavgscore,cq.gradeavgscore
278 288
         </if>
279 289
         from e_paper_student_question sq left join e_rclass_question cq on sq.eptqid=cq.eptqid and sq.classid=cq.classid
@@ -296,7 +306,7 @@
296 306
         </collection>
297 307
     </resultMap>
298 308
     <select id="listStudentSubjectErrorQues" resultMap="listStudentSubjectErrorQues">
299
-        <if test="showrank==1">
309
+        <if test="showrank!=0">
300 310
         select sq.subjectid,st.subjectname,p.ptype,sq.epsqid,sq.eptqid,q.questionid,q.qlevel,q.questionpid
301 311
         from e_paper_student_question sq
302 312
         left join t_question q on q.questionid=sq.questionid

Loading…
Annulla
Salva