Browse Source

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

tags/正式版本
王宁 2 years ago
parent
commit
a5237f38a6

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

530
         return new ResultVo(0, "设置成功");
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 View File

62
     EBaseVo getExamStateAndMode(@Param("examid") Integer examid);
62
     EBaseVo getExamStateAndMode(@Param("examid") Integer examid);
63
 
63
 
64
     //根据考试id获取显示排名
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 View File

1
 package com.xhkjedu.sexam.mapper.report;
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
 import com.xhkjedu.sexam.model.reportstu.ERstudent;
5
 import com.xhkjedu.sexam.model.reportstu.ERstudent;
4
 import org.apache.ibatis.annotations.Param;
6
 import org.apache.ibatis.annotations.Param;
5
 
7
 
36
 
38
 
37
     //根据考试id获取考试模式
39
     //根据考试id获取考试模式
38
     Integer getExamModeById(@Param("examid") Integer examid);
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 View File

36
     //考试状态0未开始1已开始2已结束3已生成报告
36
     //考试状态0未开始1已开始2已结束3已生成报告
37
     private Integer examstate;
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
     private String examcomm;
46
     private String examcomm;

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

83
 
83
 
84
     //违规学生
84
     //违规学生
85
     private String badstujson;
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 View File

67
         try {
67
         try {
68
             //考试
68
             //考试
69
             model.setExamstate(0);
69
             model.setExamstate(0);
70
-            model.setShowrank(0);
70
+            model.setTeashowrank(0);
71
+            model.setStushowrank(0);
71
             model.setDeleted(1);
72
             model.setDeleted(1);
72
             model.setReportstate(0);
73
             model.setReportstate(0);
73
             model.setCreatetime(N_Utils.getSecondTimestamp());
74
             model.setCreatetime(N_Utils.getSecondTimestamp());
511
 
512
 
512
     //设置学生报告排名显示
513
     //设置学生报告排名显示
513
     public void setShowRank(EBase eBase) {
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
         eBaseMapper.updateByPrimaryKeySelective(eBase);
517
         eBaseMapper.updateByPrimaryKeySelective(eBase);
516
     }
518
     }
517
 }
519
 }

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

14
 import com.xhkjedu.sexam.mapper.reportclass.*;
14
 import com.xhkjedu.sexam.mapper.reportclass.*;
15
 import com.xhkjedu.sexam.mapper.reportstu.*;
15
 import com.xhkjedu.sexam.mapper.reportstu.*;
16
 import com.xhkjedu.sexam.mapper.system.UserMapper;
16
 import com.xhkjedu.sexam.mapper.system.UserMapper;
17
+import com.xhkjedu.sexam.model.exam.EClass;
17
 import com.xhkjedu.sexam.model.paperstudent.EPaperStudentQuestion;
18
 import com.xhkjedu.sexam.model.paperstudent.EPaperStudentQuestion;
18
 import com.xhkjedu.sexam.model.report.ERbase;
19
 import com.xhkjedu.sexam.model.report.ERbase;
19
 import com.xhkjedu.sexam.model.report.ERrank;
20
 import com.xhkjedu.sexam.model.report.ERrank;
28
 import com.xhkjedu.sexam.vo.report.ExamPaperClassVo;
29
 import com.xhkjedu.sexam.vo.report.ExamPaperClassVo;
29
 import com.xhkjedu.sexam.vo.system.UserVo;
30
 import com.xhkjedu.sexam.vo.system.UserVo;
30
 import com.xhkjedu.utils.N_Utils;
31
 import com.xhkjedu.utils.N_Utils;
32
+import lombok.extern.slf4j.Slf4j;
31
 import org.springframework.stereotype.Service;
33
 import org.springframework.stereotype.Service;
32
 import org.springframework.transaction.annotation.Transactional;
34
 import org.springframework.transaction.annotation.Transactional;
33
 
35
 
44
  * @date 2022/8/8 10:04
46
  * @date 2022/8/8 10:04
45
  **/
47
  **/
46
 @Service
48
 @Service
49
+@Slf4j
47
 public class EReportGenerateService {
50
 public class EReportGenerateService {
48
     @Resource
51
     @Resource
49
     private EReportGenerateMapper eReportGenerateMapper;
52
     private EReportGenerateMapper eReportGenerateMapper;
1726
         String key2 = "";
1729
         String key2 = "";
1727
         String key3 = "";
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
             EPaperStudentQuestion sq = classStu.get(i);
1735
             EPaperStudentQuestion sq = classStu.get(i);
1731
             String stuanswer = sq.getStuanswer();
1736
             String stuanswer = sq.getStuanswer();
1732
             if (q.getCtype() == 1 || q.getCtype() == 2 || q.getCtype() == 4 || q.getCtype() == 5 || q.getCtype() == 6) {
1737
             if (q.getCtype() == 1 || q.getCtype() == 2 || q.getCtype() == 4 || q.getCtype() == 5 || q.getCtype() == 6) {
1761
                 if (i == 0) {
1766
                 if (i == 0) {
1762
                     answermap = new LinkedHashMap<>();
1767
                     answermap = new LinkedHashMap<>();
1763
                     //处理分数分段对应,用于分数段[0,50%)   [50%,80%),  [80%,100%]
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
                     String str8 = N_Utils.formatDouble(score8);
1772
                     String str8 = N_Utils.formatDouble(score8);
1768
                     String str5 = N_Utils.formatDouble(score5);
1773
                     String str5 = N_Utils.formatDouble(score5);
1769
                     key1 = str8 + "-" + str10;
1774
                     key1 = str8 + "-" + str10;
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
         Map rtnmap = new HashMap();
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
         rtnmap.put("goodlist", JSON.toJSONString(goodlist));
1845
         rtnmap.put("goodlist", JSON.toJSONString(goodlist));
1825
         rtnmap.put("badlist", JSON.toJSONString(badlist));
1846
         rtnmap.put("badlist", JSON.toJSONString(badlist));
1826
         rtnmap.put("erroroption",erroroption);
1847
         rtnmap.put("erroroption",erroroption);
1905
                         ercq.setGradesrate(qgsrate);
1926
                         ercq.setGradesrate(qgsrate);
1906
                         //处理单选题选项情况
1927
                         //处理单选题选项情况
1907
                         Map stuansmap = setPaperQuestionsForStuAnswer(qcstulist);
1928
                         Map stuansmap = setPaperQuestionsForStuAnswer(qcstulist);
1929
+                        ercq.setFullscorenum(N_Utils.str2Int(stuansmap.get("fullscorenum").toString()));
1908
                         ercq.setAnswerjson(stuansmap.get("answerlist").toString());
1930
                         ercq.setAnswerjson(stuansmap.get("answerlist").toString());
1909
                         if(N_Utils.isNotEmpty(stuansmap.get("goodlist"))){
1931
                         if(N_Utils.isNotEmpty(stuansmap.get("goodlist"))){
1910
                             ercq.setGoodstujson(stuansmap.get("goodlist").toString());
1932
                             ercq.setGoodstujson(stuansmap.get("goodlist").toString());
2136
                         ercq.setGradesrate(N_Utils.getDoubleDivideAndMulitiply(qgstuscore,qgscore));
2158
                         ercq.setGradesrate(N_Utils.getDoubleDivideAndMulitiply(qgstuscore,qgscore));
2137
                         //处理单选题选项情况
2159
                         //处理单选题选项情况
2138
                         Map stuansmap = setPaperQuestionsForStuAnswer(qcstulist);
2160
                         Map stuansmap = setPaperQuestionsForStuAnswer(qcstulist);
2161
+                        ercq.setFullscorenum(N_Utils.str2Int(stuansmap.get("fullscorenum").toString()));
2139
                         ercq.setAnswerjson(stuansmap.get("answerlist").toString());
2162
                         ercq.setAnswerjson(stuansmap.get("answerlist").toString());
2140
                         if(N_Utils.isNotEmpty(stuansmap.get("goodlist"))){
2163
                         if(N_Utils.isNotEmpty(stuansmap.get("goodlist"))){
2141
                             ercq.setGoodstujson(stuansmap.get("goodlist").toString());
2164
                             ercq.setGoodstujson(stuansmap.get("goodlist").toString());
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 View File

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

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

12
     </delete>
12
     </delete>
13
     <!--考试列表-->
13
     <!--考试列表-->
14
     <select id="listAll" resultType="java.util.Map">
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
         ,b.examstate,u.username createname,group_concat(distinct es.subjectname order by es.esid separator '|')subjectname
16
         ,b.examstate,u.username createname,group_concat(distinct es.subjectname order by es.esid separator '|')subjectname
17
         ,count(distinct case when es.begintime is null or es.begintime='' then es.esid else null end)esnum
17
         ,count(distinct case when es.begintime is null or es.begintime='' then es.esid else null end)esnum
18
         ,min(es.esstate)esstate,min(es.pstate)pstate,min(ifnull(ep.correcttype,0))correcttype
18
         ,min(es.esstate)esstate,min(es.pstate)pstate,min(ifnull(ep.correcttype,0))correcttype
62
     </update>
62
     </update>
63
     <!--考试基本信息-->
63
     <!--考试基本信息-->
64
     <select id="findById" resultType="java.util.Map">
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
         from e_base where examid=#{examid}
66
         from e_base where examid=#{examid}
67
     </select>
67
     </select>
68
     <!--考试基本信息(带考试人数)-->
68
     <!--考试基本信息(带考试人数)-->
69
     <select id="findById2" resultType="java.util.Map">
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
         ,(select sum(c.classnum) from e_class c where c.examid=b.examid)examnum
72
         ,(select sum(c.classnum) from e_class c where c.examid=b.examid)examnum
72
         from e_base b where b.examid=#{examid}
73
         from e_base b where b.examid=#{examid}
73
     </select>
74
     </select>
124
         from e_base eb where eb.examid=#{examid}
125
         from e_base eb where eb.examid=#{examid}
125
     </select>
126
     </select>
126
     <!--根据考试id获取显示排名-->
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
         from e_base eb where eb.examid=#{examid}
130
         from e_base eb where eb.examid=#{examid}
130
     </select>
131
     </select>
131
 </mapper>
132
 </mapper>

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

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

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

64
     <select id="getExamModeById" resultType="java.lang.Integer">
64
     <select id="getExamModeById" resultType="java.lang.Integer">
65
         select exammode from e_base where examid=#{examid}
65
         select exammode from e_base where examid=#{examid}
66
     </select>
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
 </mapper>
90
 </mapper>

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

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

Loading…
Cancel
Save