Browse Source

完善试题模板、试卷详情

ywx
王宁 1 month ago
parent
commit
9536167f1d

+ 0
- 6
smarking/pom.xml View File

32
             <version>3.17</version>
32
             <version>3.17</version>
33
         </dependency>
33
         </dependency>
34
 
34
 
35
-        <dependency>
36
-            <groupId>commons-beanutils</groupId>
37
-            <artifactId>commons-beanutils</artifactId>
38
-            <version>1.9.4</version>
39
-        </dependency>
40
-
41
     </dependencies>
35
     </dependencies>
42
     <dependencyManagement>
36
     <dependencyManagement>
43
         <dependencies>
37
         <dependencies>

+ 1
- 2
smarking/src/main/java/com/xhkjedu/smarking/controller/paper/MsTemplateController.java View File

50
     @PostMapping("/save")
50
     @PostMapping("/save")
51
     public ResultVo save(@RequestBody MsTemplate msTemplate) {
51
     public ResultVo save(@RequestBody MsTemplate msTemplate) {
52
         N_Utils.validation(new Object[]{msTemplate.getMpid(),"试卷id",1});
52
         N_Utils.validation(new Object[]{msTemplate.getMpid(),"试卷id",1});
53
-        MsTemplate mt = msTemplateService.save(msTemplate);
54
-        return new ResultVo(0, "保存成功",mt);
53
+        return new ResultVo(0, "保存成功",msTemplateService.save(msTemplate));
55
     }
54
     }
56
 
55
 
57
     /*
56
     /*

+ 1
- 1
smarking/src/main/java/com/xhkjedu/smarking/model/paper/MsTemplate.java View File

21
     private Integer mtid;
21
     private Integer mtid;
22
     //试卷ID
22
     //试卷ID
23
     private Integer mpid;
23
     private Integer mpid;
24
-    //模板尺寸1A3 2A4
24
+    //模板尺寸1A4 2A3
25
     private Integer tsize;
25
     private Integer tsize;
26
     //正面图片
26
     //正面图片
27
     private String tfront;
27
     private String tfront;

+ 4
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/report/reportclass/MsrClassQuestion.java View File

5
 
5
 
6
 import javax.persistence.Id;
6
 import javax.persistence.Id;
7
 import javax.persistence.Table;
7
 import javax.persistence.Table;
8
+import javax.persistence.Transient;
8
 
9
 
9
 /**
10
 /**
10
  * @Description 阅卷报告-班级试题小题分析表
11
  * @Description 阅卷报告-班级试题小题分析表
89
     private String mfids;
90
     private String mfids;
90
     //满分人数占比
91
     //满分人数占比
91
     private Double mfrate;
92
     private Double mfrate;
93
+
94
+    @Transient
95
+    private String classname;
92
 }
96
 }

+ 53
- 11
smarking/src/main/java/com/xhkjedu/smarking/service/paper/MsPaperQtypeService.java View File

1115
         if (ptype == 1) {
1115
         if (ptype == 1) {
1116
             // 题库
1116
             // 题库
1117
             qtypelist = msPaperQtypeMapper.listPaperQtypeQuestions(mpid);
1117
             qtypelist = msPaperQtypeMapper.listPaperQtypeQuestions(mpid);
1118
-            for (MsPaperQtypeVo qtype : qtypelist) {
1119
-                List<MsPaperQtypeQuestionVo> questions = qtype.getQuestions();
1120
-                for (MsPaperQtypeQuestionVo question : questions) {
1121
-                    if(N_Utils.isNotEmpty(question.getAnswer())){
1122
-                        //如果试卷已有答案,把试卷中设置的答案返回
1123
-                        question.setQanswer(question.getAnswer());
1124
-                    }
1125
-
1126
-                }
1127
-            }
1118
+            setPaperQuestionQtypeQuesitonTk(qtypelist);
1128
             paper.put("qtypes", qtypelist);
1119
             paper.put("qtypes", qtypelist);
1129
         } else {
1120
         } else {
1130
             // 附件
1121
             // 附件
1131
             qtypelist = msPaperQtypeMapper.listPaperQtypeQuesitonsForFj(mpid);
1122
             qtypelist = msPaperQtypeMapper.listPaperQtypeQuesitonsForFj(mpid);
1132
             List<Map<String, Object>> qtypes = new ArrayList<>();
1123
             List<Map<String, Object>> qtypes = new ArrayList<>();
1133
             setPaperQuestionQtypeQuesitonFj(qtypelist, qtypes);
1124
             setPaperQuestionQtypeQuesitonFj(qtypelist, qtypes);
1134
-
1135
             paper.put("qtypes", qtypes);
1125
             paper.put("qtypes", qtypes);
1136
 
1126
 
1137
             // 试卷文件
1127
             // 试卷文件
1146
         return paper;
1136
         return paper;
1147
     }
1137
     }
1148
 
1138
 
1139
+
1140
+    private void setPaperQuestionQtypeQuesitonTk(List<MsPaperQtypeVo> typelist){
1141
+        for(MsPaperQtypeVo qt : typelist){
1142
+            List<MsPaperQtypeQuestionVo> qlist = qt.getQuestions();
1143
+            List<MsPaperQtypeQuestionVo> rtnqlist = new ArrayList<>();//保存处理后的试题
1144
+            String qpid = "";//母题id
1145
+            List<MsPaperQtypeQuestionVo> sonqlist = new ArrayList<>();
1146
+            for(MsPaperQtypeQuestionVo q : qlist){
1147
+                //试题类型1单题2母题3子题
1148
+                if(q.getQlevel() == 3){
1149
+                    if(!q.getQuestionpid().equals(qpid)){
1150
+                        sonqlist = qlist.stream().filter(o -> q.getQlevel()==3 && q.getQuestionpid().equals(o.getQuestionpid())).collect(Collectors.toList());
1151
+                        MsPaperQtypeQuestionVo mq = new MsPaperQtypeQuestionVo();
1152
+                        mq.setQuestionid(q.getQuestionpid());
1153
+                        mq.setCtype(q.getMctype());
1154
+                        mq.setQtypeid(q.getMqtypeid());
1155
+                        mq.setQtypename(q.getMqtypename());
1156
+                        mq.setQstem(q.getMqstem());
1157
+                        mq.setComplexity(q.getMcomplexity());
1158
+                        mq.setQanalyze(q.getMqanalyze());
1159
+                        mq.setQanswer(q.getMqanswer());
1160
+                        mq.setQorder(q.getQorder());
1161
+                        mq.setQlevel(q.getMqlevel());
1162
+                        mq.setHashear(q.getMhashear());
1163
+                        mq.setHearfile(q.getMhearfile());
1164
+                        Double mscore = sonqlist.stream().collect(Collectors.summingDouble(MsPaperQtypeQuestionVo:: getQscore));
1165
+                        mq.setQscore(mscore);
1166
+
1167
+                        for(MsPaperQtypeQuestionVo sonQ : sonqlist){
1168
+                            if(N_Utils.isNotEmpty(sonQ.getAnswer())){
1169
+                                //如果试卷已有答案,把试卷中设置的答案返回
1170
+                                sonQ.setQanswer(sonQ.getAnswer());
1171
+                            }
1172
+                        }
1173
+
1174
+                        mq.setSonques(sonqlist);
1175
+                        mq.setPoints(sonqlist.get(0).getPoints());
1176
+                        rtnqlist.add(mq);
1177
+                    }
1178
+                    qpid = q.getQuestionpid();
1179
+                }else{
1180
+                    if(N_Utils.isNotEmpty(q.getAnswer())){
1181
+                        //如果试卷已有答案,把试卷中设置的答案返回
1182
+                        q.setQanswer(q.getAnswer());
1183
+                    }
1184
+                    rtnqlist.add(q);
1185
+                }
1186
+            }
1187
+            qt.setQuestions(rtnqlist);
1188
+        }
1189
+    }
1190
+
1149
     // 试卷详情-附件-设置返回值
1191
     // 试卷详情-附件-设置返回值
1150
     private void setPaperQuestionQtypeQuesitonFj(List<MsPaperQtypeVo> qtypelist, List<Map<String, Object>> qtypes) {
1192
     private void setPaperQuestionQtypeQuesitonFj(List<MsPaperQtypeVo> qtypelist, List<Map<String, Object>> qtypes) {
1151
         for (MsPaperQtypeVo qtypeVo : qtypelist) {
1193
         for (MsPaperQtypeVo qtypeVo : qtypelist) {

+ 6
- 12
smarking/src/main/java/com/xhkjedu/smarking/service/paper/MsTemplateService.java View File

83
      * @return void
83
      * @return void
84
      **/
84
      **/
85
     @Transactional(rollbackFor = Exception.class)
85
     @Transactional(rollbackFor = Exception.class)
86
-    public MsTemplate save(MsTemplate msTemplate){
86
+    public Integer save(MsTemplate msTemplate){
87
         msTemplate.setCreatetime(N_Utils.getSecondTimestamp());
87
         msTemplate.setCreatetime(N_Utils.getSecondTimestamp());
88
         msTemplate.setCurrstep(1);
88
         msTemplate.setCurrstep(1);
89
         msTemplate.setTstate(0);
89
         msTemplate.setTstate(0);
107
 
107
 
108
         //更新科目模板状态
108
         //更新科目模板状态
109
         msSubjectMapper.updatePtstateByMpid(msTemplate.getMpid(),1);
109
         msSubjectMapper.updatePtstateByMpid(msTemplate.getMpid(),1);
110
-        return msTemplate;
110
+        return mtid;
111
     }
111
     }
112
 
112
 
113
     /*
113
     /*
179
             //包含的试题信息
179
             //包含的试题信息
180
             List<MsPaperQtypeQuestion> selQuestions = questions.stream().filter(q -> tbqns.contains(q.getQn())).collect(Collectors.toList());
180
             List<MsPaperQtypeQuestion> selQuestions = questions.stream().filter(q -> tbqns.contains(q.getQn())).collect(Collectors.toList());
181
             if(selQuestions.isEmpty() || selQuestions.size() != tbquestions.size()){
181
             if(selQuestions.isEmpty() || selQuestions.size() != tbquestions.size()){
182
-                throw new RuntimeException("试题信息和试卷不匹配");
182
+                throw new MissingParametersException("试题信息和试卷不匹配");
183
             }
183
             }
184
 
184
 
185
             Double tbqScores = selQuestions.stream().mapToDouble(MsPaperQtypeQuestion::getQscore).sum();//题块下试题总分值
185
             Double tbqScores = selQuestions.stream().mapToDouble(MsPaperQtypeQuestion::getQscore).sum();//题块下试题总分值
210
             for(MsTemplateBlockQuestion tbquestion : tbquestions) {
210
             for(MsTemplateBlockQuestion tbquestion : tbquestions) {
211
                 MsPaperQtypeQuestion q = selQuestions.stream().filter(q1 -> q1.getQn().equals(tbquestion.getQn())).findFirst().orElse(null);
211
                 MsPaperQtypeQuestion q = selQuestions.stream().filter(q1 -> q1.getQn().equals(tbquestion.getQn())).findFirst().orElse(null);
212
 
212
 
213
-                if(q == null) throw new RuntimeException("试题信息和试卷不匹配");
213
+                if(q == null) throw new MissingParametersException("试题信息和试卷不匹配");
214
 
214
 
215
                 tbquestion.setMtbid(mtbid);
215
                 tbquestion.setMtbid(mtbid);
216
                 tbquestion.setMptqid(q.getMptqid());
216
                 tbquestion.setMptqid(q.getMptqid());
396
         MsTemplate msTemplate = msTemplateMapper.selectByPrimaryKey(mtid);
396
         MsTemplate msTemplate = msTemplateMapper.selectByPrimaryKey(mtid);
397
         int mpid = msTemplate.getMpid();
397
         int mpid = msTemplate.getMpid();
398
         msTemplateMapper.deleteByPrimaryKey(mtid);
398
         msTemplateMapper.deleteByPrimaryKey(mtid);
399
-        //获取试卷中所有模板题块框选状态
400
-        int tbnum = msTemplateMapper.getUnSelTemplateCount(mpid);
401
-        if(tbnum == 0){
402
-            //更改科目题块框选状态已完成
403
-            msSubjectMapper.updatePbstateByMpid(mpid,2);
404
-            //保存学生试卷试题信息
405
-            savePaperStudentBlock(mpid);
406
-        }
399
+        //更改科目题块框选状态未设置
400
+        msSubjectMapper.updatePbstateByMpid(mpid,0);
407
     }
401
     }
408
 
402
 
409
     /*
403
     /*

+ 6
- 7
smarking/src/main/java/com/xhkjedu/smarking/service/report/generate/ReportGeneratePointService.java View File

24
 import com.xhkjedu.smarking.vo.report.reportsubject.PointParams;
24
 import com.xhkjedu.smarking.vo.report.reportsubject.PointParams;
25
 import com.xhkjedu.smarking.vo.report.reportsubject.PointVo;
25
 import com.xhkjedu.smarking.vo.report.reportsubject.PointVo;
26
 import com.xhkjedu.utils.N_Utils;
26
 import com.xhkjedu.utils.N_Utils;
27
-import org.apache.commons.beanutils.BeanUtils;
27
+import org.springframework.beans.BeanUtils;
28
 import org.springframework.stereotype.Service;
28
 import org.springframework.stereotype.Service;
29
 
29
 
30
 import javax.annotation.Resource;
30
 import javax.annotation.Resource;
239
         classPoint.setFullscore(subjectPoint.getFullscore());
239
         classPoint.setFullscore(subjectPoint.getFullscore());
240
         classPoint.setMaxscore(pointStuScores.stream().mapToDouble(PointStudentVo::getStuscore).max().orElse(0.0));
240
         classPoint.setMaxscore(pointStuScores.stream().mapToDouble(PointStudentVo::getStuscore).max().orElse(0.0));
241
         classPoint.setMinscore(pointStuScores.stream().mapToDouble(PointStudentVo::getStuscore).min().orElse(0.0));
241
         classPoint.setMinscore(pointStuScores.stream().mapToDouble(PointStudentVo::getStuscore).min().orElse(0.0));
242
-        classPoint.setScorerate(MarkingUtil.calculateRate(sumScore, subjectPoint.getFullscore() * stuNum));
242
+        classPoint.setScorerate(MarkingUtil.div(sumScore, subjectPoint.getFullscore() * stuNum));
243
         classPoint.setAvgscore(MarkingUtil.div(sumScore, stuNum));
243
         classPoint.setAvgscore(MarkingUtil.div(sumScore, stuNum));
244
-        classPoint.setAvgrate(MarkingUtil.calculateRate(classPoint.getAvgscore(), subjectPoint.getFullscore()));
244
+        classPoint.setAvgrate(MarkingUtil.div(classPoint.getAvgscore(), subjectPoint.getFullscore()));
245
         classPoint.setBzc(MarkingUtil.bzc(stuScores));
245
         classPoint.setBzc(MarkingUtil.bzc(stuScores));
246
         classPoint.setCyxs(MarkingUtil.div(classPoint.getBzc(), classPoint.getAvgscore()));
246
         classPoint.setCyxs(MarkingUtil.div(classPoint.getBzc(), classPoint.getAvgscore()));
247
         classPoint.setQfd(MarkingUtil.qfd(stuScores));
247
         classPoint.setQfd(MarkingUtil.qfd(stuScores));
298
                 // 获取平均分
298
                 // 获取平均分
299
                 double avgScore = MarkingUtil.div(sumScore, stuNum);
299
                 double avgScore = MarkingUtil.div(sumScore, stuNum);
300
                 // 获取平均得分率
300
                 // 获取平均得分率
301
-                double avgScoreRate = MarkingUtil.calculateRate(avgScore, pointParams.getFullscore());
302
-                sps.setAvgrate(avgScoreRate);
301
+                sps.setAvgrate(MarkingUtil.div(avgScore, pointParams.getFullscore()));
303
                 sps.setAvgscore(avgScore);
302
                 sps.setAvgscore(avgScore);
304
             }else{
303
             }else{
305
                 sps.setAvgrate(0.0);
304
                 sps.setAvgrate(0.0);
571
             double schoolSumScore = pointStuScores.stream().mapToDouble(PointStudentVo::getStuscore).sum();
570
             double schoolSumScore = pointStuScores.stream().mapToDouble(PointStudentVo::getStuscore).sum();
572
             int stunum = pointStuScores.size();
571
             int stunum = pointStuScores.size();
573
             double schoolAvgScore = MarkingUtil.div(schoolSumScore, stunum);
572
             double schoolAvgScore = MarkingUtil.div(schoolSumScore, stunum);
574
-            double schoolScoreRate = MarkingUtil.calculateRate(schoolSumScore, pqvo.getScore() * stunum);
573
+            double schoolScoreRate = MarkingUtil.div(schoolSumScore, pqvo.getScore() * stunum);
575
             //处理学生得分情况
574
             //处理学生得分情况
576
             for(PointStudentVo pstuvo : pointStuScores){
575
             for(PointStudentVo pstuvo : pointStuScores){
577
                 MsrStudentPoint stuPoint = new MsrStudentPoint();
576
                 MsrStudentPoint stuPoint = new MsrStudentPoint();
582
                 stuPoint.setPointname(pqvo.getPointname());
581
                 stuPoint.setPointname(pqvo.getPointname());
583
                 stuPoint.setFullscore(pqvo.getScore());
582
                 stuPoint.setFullscore(pqvo.getScore());
584
                 stuPoint.setStuscore(pstuvo.getStuscore());
583
                 stuPoint.setStuscore(pstuvo.getStuscore());
585
-                stuPoint.setSturate(MarkingUtil.calculateRate(pstuvo.getStuscore(), pqvo.getScore()));
584
+                stuPoint.setSturate(MarkingUtil.div(pstuvo.getStuscore(), pqvo.getScore()));
586
                 stuPoint.setSchoolavg(schoolAvgScore);
585
                 stuPoint.setSchoolavg(schoolAvgScore);
587
                 stuPoint.setSchoolrate(schoolScoreRate);
586
                 stuPoint.setSchoolrate(schoolScoreRate);
588
                 stuPoint.setQns(qnStr.toString());
587
                 stuPoint.setQns(qnStr.toString());

+ 9
- 9
smarking/src/main/java/com/xhkjedu/smarking/service/report/generate/ReportGenerateQuestionService.java View File

163
             Double maxScore = stuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).max().orElse(0.0);// 最高分
163
             Double maxScore = stuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).max().orElse(0.0);// 最高分
164
             Double minScore = stuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).min().orElse(0.0);// 最低分
164
             Double minScore = stuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).min().orElse(0.0);// 最低分
165
             Double avgScore = MarkingUtil.calculateAverage(stuScores);// 平均分
165
             Double avgScore = MarkingUtil.calculateAverage(stuScores);// 平均分
166
-            Double avgScoreRate = MarkingUtil.calculateRate(avgScore, sumQScore);// 平均得分率
166
+            Double avgScoreRate = MarkingUtil.div(avgScore, sumQScore);// 平均得分率
167
 
167
 
168
             MsrClassQuestion schoolQ = new MsrClassQuestion();
168
             MsrClassQuestion schoolQ = new MsrClassQuestion();
169
             schoolQ.setClassid(0);// 全体班级
169
             schoolQ.setClassid(0);// 全体班级
251
             maxScore = stuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).max().orElse(0.0);// 最高分
251
             maxScore = stuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).max().orElse(0.0);// 最高分
252
             minScore = stuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).min().orElse(0.0);// 最低分
252
             minScore = stuQuestions.stream().mapToDouble(MsPaperStudentQuestion::getStuscore).min().orElse(0.0);// 最低分
253
             avgScore = MarkingUtil.calculateAverage(stuScores);// 平均分
253
             avgScore = MarkingUtil.calculateAverage(stuScores);// 平均分
254
-            avgScoreRate = MarkingUtil.calculateRate(avgScore, sumQScore);// 平均得分率
254
+            avgScoreRate = MarkingUtil.div(avgScore, sumQScore);// 平均得分率
255
         }
255
         }
256
-        Double stuScoreRate = MarkingUtil.calculateRate(sumStuScore, sumQScore);// 学生得分率
256
+        Double stuScoreRate = MarkingUtil.div(sumStuScore, sumQScore);// 学生得分率
257
         MsrClassQuestion classQ = new MsrClassQuestion();
257
         MsrClassQuestion classQ = new MsrClassQuestion();
258
         classQ.setExamid(schoolQ.getExamid());
258
         classQ.setExamid(schoolQ.getExamid());
259
         classQ.setSubjectid(schoolQ.getSubjectid());
259
         classQ.setSubjectid(schoolQ.getSubjectid());
275
         classQ.setSchoolavgrate(schoolQ.getSchoolavgrate());
275
         classQ.setSchoolavgrate(schoolQ.getSchoolavgrate());
276
 
276
 
277
         classQ.setScorerate(stuScoreRate);
277
         classQ.setScorerate(stuScoreRate);
278
-        classQ.setScoreratec(MarkingUtil.sub(MarkingUtil.calculateRate(maxScore, qScore), MarkingUtil.calculateRate(minScore, qScore)));// 得分率差=最高得分率-最低得分率
278
+        classQ.setScoreratec(MarkingUtil.sub(MarkingUtil.div(maxScore, qScore), MarkingUtil.div(minScore, qScore)));// 得分率差=最高得分率-最低得分率
279
         classQ.setNd(MarkingUtil.div(avgScore, qScore));// 难度
279
         classQ.setNd(MarkingUtil.div(avgScore, qScore));// 难度
280
         String[] ndStr = questionNdAndQfd(params, 1, classQ.getNd());
280
         String[] ndStr = questionNdAndQfd(params, 1, classQ.getNd());
281
         classQ.setNdms(ndStr[0]);// 难度描述
281
         classQ.setNdms(ndStr[0]);// 难度描述
428
                 double avgScore = MarkingUtil.div(sumScore, groupStuQuestions.size());
428
                 double avgScore = MarkingUtil.div(sumScore, groupStuQuestions.size());
429
                 sqr.setStunum(groupStuQuestions.size());
429
                 sqr.setStunum(groupStuQuestions.size());
430
                 sqr.setStuids(groupStuQuestions.stream().map(q -> q.getStudentid().toString()).collect(Collectors.joining(",")));
430
                 sqr.setStuids(groupStuQuestions.stream().map(q -> q.getStudentid().toString()).collect(Collectors.joining(",")));
431
-                sqr.setScorerate(MarkingUtil.calculateRate(sumScore, groupStuQuestions.size() * fullScore));
432
-                sqr.setAvgrate(MarkingUtil.calculateRate(avgScore, fullScore));
431
+                sqr.setScorerate(MarkingUtil.div(sumScore, groupStuQuestions.size() * fullScore));
432
+                sqr.setAvgrate(MarkingUtil.div(avgScore, fullScore));
433
             } else {
433
             } else {
434
                 groupStuids = null;
434
                 groupStuids = null;
435
                 sqr.setStunum(0);
435
                 sqr.setStunum(0);
462
                         double sectionStuAvgScore = MarkingUtil.div(sectionStuSumScore, sectionStuQuestions.size());
462
                         double sectionStuAvgScore = MarkingUtil.div(sectionStuSumScore, sectionStuQuestions.size());
463
                         sqrg.setStunum(sectionStuQuestions.size());
463
                         sqrg.setStunum(sectionStuQuestions.size());
464
                         sqrg.setStuids(sectionStuQuestions.stream().map(q -> q.getStudentid().toString()).collect(Collectors.joining(",")));
464
                         sqrg.setStuids(sectionStuQuestions.stream().map(q -> q.getStudentid().toString()).collect(Collectors.joining(",")));
465
-                        sqrg.setScorerate(MarkingUtil.calculateRate(sectionStuSumScore, sectionStuQuestions.size() * fullScore));
466
-                        sqrg.setAvgrate(MarkingUtil.calculateRate(sectionStuAvgScore, fullScore));
465
+                        sqrg.setScorerate(MarkingUtil.div(sectionStuSumScore, sectionStuQuestions.size() * fullScore));
466
+                        sqrg.setAvgrate(MarkingUtil.div(sectionStuAvgScore, fullScore));
467
                     }else{
467
                     }else{
468
                         sqrg.setStunum(0);
468
                         sqrg.setStunum(0);
469
                         sqrg.setScorerate(0.0);
469
                         sqrg.setScorerate(0.0);
580
                 // 获取平均分
580
                 // 获取平均分
581
                 double avgScore = MarkingUtil.div(sumScore, stuNum);
581
                 double avgScore = MarkingUtil.div(sumScore, stuNum);
582
                 // 获取平均得分率
582
                 // 获取平均得分率
583
-                double avgScoreRate = MarkingUtil.calculateRate(avgScore, fullScore);
583
+                double avgScoreRate = MarkingUtil.div(avgScore, fullScore);
584
                 sqs.setAvgscore(avgScore);
584
                 sqs.setAvgscore(avgScore);
585
                 sqs.setAvgrate(avgScoreRate);
585
                 sqs.setAvgrate(avgScoreRate);
586
             }else{
586
             }else{

+ 38
- 2
smarking/src/main/java/com/xhkjedu/smarking/service/report/report/MsrClassQuestionService.java View File

6
 import com.xhkjedu.smarking.mapper.report.reportother.MsrReportparamMapper;
6
 import com.xhkjedu.smarking.mapper.report.reportother.MsrReportparamMapper;
7
 import com.xhkjedu.smarking.mapper.report.reportsubject.MsrSubjectMapper;
7
 import com.xhkjedu.smarking.mapper.report.reportsubject.MsrSubjectMapper;
8
 import com.xhkjedu.smarking.model.exam.MsClass;
8
 import com.xhkjedu.smarking.model.exam.MsClass;
9
+import com.xhkjedu.smarking.model.report.reportclass.MsrClassQuestion;
9
 import com.xhkjedu.smarking.model.report.reportclass.MsrClassSubjectGrade;
10
 import com.xhkjedu.smarking.model.report.reportclass.MsrClassSubjectGrade;
10
 import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
11
 import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
11
 import com.xhkjedu.smarking.vo.report.reportother.ExamReportParams;
12
 import com.xhkjedu.smarking.vo.report.reportother.ExamReportParams;
110
         return msrClassQuestionMapper.listQuestionSummaryForObjsub(params);
111
         return msrClassQuestionMapper.listQuestionSummaryForObjsub(params);
111
     }
112
     }
112
 
113
 
113
-    public void listQuestionForXh(ExamReportParams params){
114
-
114
+    //学科报告-各班学科试题分析-得分率
115
+    public void listQuestionForXhScoreRate(ExamReportParams params){
116
+        params.setSelclass(3);
117
+        params.setClassids("0," + params.getClassids());//拼上全体
118
+        //获取选定班级的试题分析
119
+        List<MsrClassQuestion> questions = msrClassQuestionMapper.listQuestionForXh(params);
120
+        //获取所有题号
121
+        List<String> qns = questions.stream().map(MsrClassQuestion::getQn).distinct().collect(Collectors.toList());
122
+        //把试题按班级分组
123
+        Map<Integer,List<MsrClassQuestion>> classMap = questions.stream().collect(Collectors.groupingBy(MsrClassQuestion::getClassid));
124
+        List<Map<String,Object>> classList = new ArrayList<>();//班级试题
125
+        for(Map.Entry<Integer,List<MsrClassQuestion>> entry : classMap.entrySet()){
126
+            Map<String,Object> clMap = new HashMap<>();
127
+            clMap.put("classid",entry.getKey());
128
+            clMap.put("classname",entry.getValue().get(0).getClassname());
129
+            clMap.put("questions",entry.getValue());
130
+            classList.add(clMap);
131
+        }
115
     }
132
     }
133
+    //学科报告-各班学科试题分析-试题难度和区分度
134
+    public void listQuestionForXhNdAndQfd(ExamReportParams params){
135
+        params.setSelclass(4);
136
+        //获取选定班级的试题分析
137
+        List<MsrClassQuestion> questions = msrClassQuestionMapper.listQuestionForXh(params);
138
+        //获取所有题号
139
+        List<String> qns = questions.stream().map(MsrClassQuestion::getQn).distinct().collect(Collectors.toList());
140
+        //把试题按班级分组
141
+        Map<Integer,List<MsrClassQuestion>> classMap = questions.stream().collect(Collectors.groupingBy(MsrClassQuestion::getClassid));
142
+        List<Map<String,Object>> classList = new ArrayList<>();//班级试题
143
+        for(Map.Entry<Integer,List<MsrClassQuestion>> entry : classMap.entrySet()){
144
+            Map<String,Object> clMap = new HashMap<>();
145
+            clMap.put("classid",entry.getKey());
146
+            clMap.put("classname",entry.getValue().get(0).getClassname());
147
+            clMap.put("questions",entry.getValue());
148
+            classList.add(clMap);
149
+        }
150
+    }
151
+
116
 
152
 
117
 }
153
 }

+ 2
- 1
smarking/src/main/resources/mapper/paper/MsPaperQtypeMapper.xml View File

15
         <result column="mptname" property="mptname" />
15
         <result column="mptname" property="mptname" />
16
         <result column="mptnum" property="mptnum" />
16
         <result column="mptnum" property="mptnum" />
17
         <result column="mptorder" property="mptorder" />
17
         <result column="mptorder" property="mptorder" />
18
+        <result column="mptctype" property="ctype" />
18
         <result column="mptscore" property="mptscore" />
19
         <result column="mptscore" property="mptscore" />
19
         <collection property="questions" ofType="com.xhkjedu.smarking.vo.paper.MsPaperQtypeQuestionVo" javaType="java.util.List">
20
         <collection property="questions" ofType="com.xhkjedu.smarking.vo.paper.MsPaperQtypeQuestionVo" javaType="java.util.List">
20
             <result column="mptqid" property="mptqid" />
21
             <result column="mptqid" property="mptqid" />
61
     </resultMap>
62
     </resultMap>
62
     <!--试题详情-->
63
     <!--试题详情-->
63
     <select id="listPaperQtypeQuestions" resultMap="qtypesQuestion">
64
     <select id="listPaperQtypeQuestions" resultMap="qtypesQuestion">
64
-        select t.mptid,t.mpid,t.mptqn,t.mptname,t.mptnum,t.mptorder,t.mptscore,tq.mptqid,tq.questionid,tq.questionpid,tq.qanswer as answer,tq.qscore,tq.qn,
65
+        select t.mptid,t.mpid,t.mptqn,t.mptname,t.mptnum,t.mptorder,t.ctype as mptctype ,t.mptscore,tq.mptqid,tq.questionid,tq.questionpid,tq.qanswer as answer,tq.qscore,tq.qn,
65
         tq.qorder,tq.loseoption,tq.scoreset,COALESCE(tq.complexity, q.complexity) as complexity,q.qtypeid,q.qtypename,q.ctype qctype,
66
         tq.qorder,tq.loseoption,tq.scoreset,COALESCE(tq.complexity, q.complexity) as complexity,q.qtypeid,q.qtypename,q.ctype qctype,
66
         q.qstem,q.qstemtxt,q.qoption,q.qanswer,q.qanalyze,q.hashear,q.hearfile,q.qlevel,q.sorder,
67
         q.qstem,q.qstemtxt,q.qoption,q.qanswer,q.qanalyze,q.hashear,q.hearfile,q.qlevel,q.sorder,
67
         fq.snum,fq.qstem as mqstem,fq.complexity as mcomplexity,fq.qtypeid mqtypeid,fq.qtypename mqtypename,fq.ctype mctype,
68
         fq.snum,fq.qstem as mqstem,fq.complexity as mcomplexity,fq.qtypeid mqtypeid,fq.qtypename mqtypename,fq.ctype mctype,

+ 7
- 3
smarking/src/main/resources/mapper/report/reportclass/MsrClassQuestionMapper.xml View File

93
     <!--学科报告-各班学科试题分析-->
93
     <!--学科报告-各班学科试题分析-->
94
     <select id="listQuestionForXh" resultType="com.xhkjedu.smarking.model.report.reportclass.MsrClassQuestion">
94
     <select id="listQuestionForXh" resultType="com.xhkjedu.smarking.model.report.reportclass.MsrClassQuestion">
95
         select q.mptqid,q.classid,q.qn,q.qtype,
95
         select q.mptqid,q.classid,q.qn,q.qtype,
96
-        q.classavgrate,q.schoolavgrate,q.scorerate,q.scoreratec,q.qfd,q.qfdms,c.classname
96
+        q.classavgrate,q.schoolavgrate,q.scorerate,q.scoreratec,q.nd,q.ndms,q.qfd,q.qfdms,c.classname
97
         from msr_class_question q left join ms_class c on q.examid=c.examid
97
         from msr_class_question q left join ms_class c on q.examid=c.examid
98
         and q.subjectid=c.subjectid and q.classid=c.classid
98
         and q.subjectid=c.subjectid and q.classid=c.classid
99
-        where q.examid=#{param.examid} and q.subjectid=#{param.subjectid} and q.classid in
100
-        <foreach collection="param.classids" item="item" open="(" separator="," close=")">#{item}</foreach>
99
+        where q.examid=#{param.examid} and q.subjectid=#{param.subjectid}
100
+        <if test="param.selclass == 3">
101
+            and q.classid in
102
+            <foreach collection="param.classids" item="item" open="(" separator="," close=")">#{item}</foreach>
103
+        </if>
104
+        <if test="param.selclass == 4"> and q.classid = #{param.classid}</if>
101
         order by q.mptqid
105
         order by q.mptqid
102
     </select>
106
     </select>
103
 
107
 

Loading…
Cancel
Save