Browse Source

完善小题分析

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

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

@@ -36,6 +36,15 @@ public class ERclassQuestion extends BaseBean {
36 36
     //试题排序
37 37
     private Integer qorder;
38 38
 
39
+    //分值
40
+    private Double score;
41
+
42
+    //难易度
43
+    private Integer complexity;
44
+
45
+    //题型名称
46
+    private String qtypename;
47
+
39 48
     //班级得分
40 49
     private Double classscore;
41 50
 

+ 18
- 12
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperQtypeService.java View File

@@ -14,7 +14,6 @@ import com.xhkjedu.sexam.vo.paper.*;
14 14
 import com.xhkjedu.utils.N_Utils;
15 15
 import com.xhkjedu.vo.ResultVo;
16 16
 import lombok.extern.slf4j.Slf4j;
17
-import org.springframework.beans.BeanUtils;
18 17
 import org.springframework.beans.factory.annotation.Autowired;
19 18
 import org.springframework.stereotype.Service;
20 19
 import org.springframework.transaction.annotation.Transactional;
@@ -266,6 +265,7 @@ public class EPaperQtypeService {
266 265
                         mq.setComplexity(qobj.getMcomplexity());
267 266
                         mq.setQorder(qobj.getQorder());
268 267
                         mq.setScore(score);
268
+                        mq.setQtypename(qobj.getMqtypename());
269 269
                         if(k == 0){
270 270
                             mq.setMctype(111);
271 271
                         }else{
@@ -293,9 +293,9 @@ public class EPaperQtypeService {
293 293
 
294 294
             //试题题型分析数据
295 295
             double storerate = N_Utils.getDoubleDivideAndMulitiply(qt.getEptscore(), ePaper.getPscore());
296
-            Map tmap = new HashMap();
297
-            tmap.put("qtname",qt.getEptname());
296
+            Map tmap = new TreeMap();
298 297
             tmap.put("qtid",qt.getEptid());
298
+            tmap.put("qtname",qt.getEptname());
299 299
             tmap.put("num",qt.getEptnum());
300 300
             tmap.put("score",qt.getEptscore());
301 301
             tmap.put("srate",storerate);
@@ -325,7 +325,7 @@ public class EPaperQtypeService {
325 325
         zgq.setScore(N_Utils.getDoubleReduce(ePaper.getPscore(),ktscore));
326 326
         zgq.setSrate(N_Utils.getDoubleReduce(100.0,ktsrate));
327 327
         ranglist.add(zgq);
328
-        Map ztmap = new HashMap<>();
328
+        Map ztmap = new TreeMap<>();
329 329
         ztmap.put("pnum", ePaper.getPnum());
330 330
         ztmap.put("pscore",ePaper.getPscore());
331 331
         ztmap.put("ranglist",ranglist);
@@ -338,7 +338,7 @@ public class EPaperQtypeService {
338 338
                 List<QuestionOrderVo> pgblist = entry.getValue();
339 339
                 Double score = pgblist.stream().mapToDouble(s -> s.getScore()).sum();
340 340
                 Double srate = N_Utils.getDoubleDivideAndMulitiply(score,ePaper.getPscore());
341
-                Map prate = new HashMap();
341
+                Map prate = new TreeMap();
342 342
                 prate.put("level",Integer.parseInt(entry.getKey()));
343 343
                 prate.put("score",score);
344 344
                 prate.put("srate",srate);
@@ -357,7 +357,7 @@ public class EPaperQtypeService {
357 357
                 //获取知识点的总分
358 358
                 Double score = pgblist.stream().mapToDouble(s -> s.getScore()).sum();
359 359
                 Double srate = N_Utils.getDoubleDivideAndMulitiply(score,ePaper.getPscore());
360
-                Map prate = new HashMap();
360
+                Map prate = new TreeMap();
361 361
                 prate.put("pointid",entry.getKey());
362 362
                 prate.put("pointname",pgblist.get(0).getName());
363 363
                 prate.put("score",score);
@@ -518,6 +518,7 @@ public class EPaperQtypeService {
518 518
         QuestionOrderVo qtype = new QuestionOrderVo();
519 519
         qtype.setId(dq.getQtypeid());
520 520
         qtype.setName(dq.getQtypename());
521
+        qtype.setComplexity(dq.getComplexity());
521 522
         qtype.setOrder(dq.getQorder());
522 523
         qtype.setScore(dq.getScore());
523 524
         qtype.setQlevel(dq.getQlevel());
@@ -584,14 +585,14 @@ public class EPaperQtypeService {
584 585
         double kscorerate = N_Utils.getDoubleReduce(100.0,zscorerate);
585 586
 
586 587
         List<Map> ranglist = new ArrayList<>();
587
-        Map zgmap = new HashMap();
588
+        Map zgmap = new TreeMap();
588 589
         zgmap.put("qtname","主观题");
589 590
         zgmap.put("score",zscore);
590 591
         zgmap.put("num",znum);
591 592
         zgmap.put("srate",zscorerate);
592 593
         zgmap.put("nrate",znumrate);
593 594
         ranglist.add(zgmap);
594
-        Map kgmap = new HashMap();
595
+        Map kgmap = new TreeMap();
595 596
         kgmap.put("qtname","客观题");
596 597
         kgmap.put("score",kscore);
597 598
         kgmap.put("num",knum);
@@ -599,7 +600,7 @@ public class EPaperQtypeService {
599 600
         kgmap.put("nrate",knumrate);
600 601
         ranglist.add(kgmap);
601 602
 
602
-        Map ztmap = new HashMap<>();
603
+        Map ztmap = new TreeMap<>();
603 604
         ztmap.put("pnum", ePaper.getPnum());
604 605
         ztmap.put("pscore",ePaper.getPscore());
605 606
         ztmap.put("ranglist",ranglist);
@@ -618,22 +619,27 @@ public class EPaperQtypeService {
618 619
             List<Integer> orderlist = new ArrayList<>();
619 620
             List<Integer> eptqidlist = new ArrayList<>();
620 621
             List<String> qnlist = new ArrayList<>();
621
-
622
+            List<Double> scorelist = new ArrayList<>();
623
+            List<String> qnamelist = new ArrayList<>();
622 624
             for(EPaperQtype t : aq){
623 625
                 List<EPaperQtypeQuestion> qlist = t.getQuestions();
624 626
                 for(EPaperQtypeQuestion q : qlist){
625 627
                     orderlist.add(q.getQorder());
626 628
                     eptqidlist.add(q.getId());
627 629
                     qnlist.add(q.getQn());
630
+                    scorelist.add(q.getScore());
631
+                    qnamelist.add(q.getQtypename());
628 632
                 }
629 633
             }
630 634
 
631
-            Map anmap = new HashMap();//题型对应试题的id和基础信息
635
+            Map anmap = new TreeMap();//题型对应试题的id和基础信息
632 636
             anmap.put("orders",orderlist);
633 637
             anmap.put("eptqids",eptqidlist);
634 638
             anmap.put("qns",qnlist);
639
+            anmap.put("scores",scorelist);
640
+            anmap.put("qtypenames",qnamelist);
635 641
 
636
-            Map tmap = new HashMap();
642
+            Map tmap = new TreeMap();
637 643
             tmap.put("qtname",entry.getKey());
638 644
             tmap.put("qtid",aq.get(0).getEptid());
639 645
             tmap.put("num",num);

+ 14
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportGenerateService.java View File

@@ -31,6 +31,7 @@ import org.springframework.stereotype.Service;
31 31
 import org.springframework.transaction.annotation.Transactional;
32 32
 
33 33
 import javax.annotation.Resource;
34
+import java.math.BigDecimal;
34 35
 import java.util.*;
35 36
 import java.util.stream.Collectors;
36 37
 
@@ -1749,6 +1750,11 @@ public class EReportGenerateService {
1749 1750
             List<Integer> eptqids = (List<Integer>) ques.get("eptqids");//试卷中题型下试题id
1750 1751
             List<String> qns = (List<String>) ques.get("qns");//试卷中试题题号
1751 1752
             List<Integer> orders = (List<Integer>) ques.get("orders");//试卷中试题题号
1753
+            List<String> qtypenames = (List<String>) ques.get("qtypenames");
1754
+            List<Object> scoresObj = (List<Object>) ques.get("scores");
1755
+            List<Double> scores  = scoresObj.stream().map((d) -> {
1756
+                return Double.valueOf(d + "");
1757
+            }).collect(Collectors.toList());
1752 1758
 
1753 1759
             Double tgstuscore = 0.0;//题型下学生得分
1754 1760
             Double tgscore = 0.0;//题型下试题总分
@@ -1789,6 +1795,8 @@ public class EReportGenerateService {
1789 1795
                     ercq.setEptqid(eptqid);
1790 1796
                     ercq.setQn(qns.get(q));
1791 1797
                     ercq.setQorder(orders.get(q));
1798
+                    ercq.setScore(scores.get(q));
1799
+                    ercq.setQtypename(qtypenames.get(q));
1792 1800
                     ercq.setClassscore(qcstuscore);
1793 1801
                     ercq.setClassmaxscore(qcmaxstu.getStuscore());
1794 1802
                     ercq.setClassavgscore(qcavgscore);
@@ -1904,6 +1912,9 @@ public class EReportGenerateService {
1904 1912
                 String order = quesmap.get("order").toString();//试题母题题号
1905 1913
                 String questionid = quesmap.get("questionid").toString();
1906 1914
                 List<String> qnslist = (List<String>) quesmap.get("qns");
1915
+                String quesname = quesmap.get("name").toString();
1916
+                Integer complexity = Integer.parseInt(quesmap.get("complexity").toString());
1917
+                Double quesscore = Double.parseDouble(quesmap.get("score").toString());
1907 1918
                 qns = qns + order + ",";
1908 1919
 
1909 1920
                 //获取集合中对应子题集合的数据
@@ -1999,6 +2010,9 @@ public class EReportGenerateService {
1999 2010
                     ercq.setEpid(examPaperClassVo.getEpid());
2000 2011
                     ercq.setEptqid(eptqid);
2001 2012
                     ercq.setQuestionid(questionid);
2013
+                    ercq.setQtypename(quesname);
2014
+                    ercq.setComplexity(complexity);
2015
+                    ercq.setScore(quesscore);
2002 2016
                     ercq.setQn(String.join(",", qnslist));
2003 2017
                     ercq.setQorder(Integer.parseInt(order));
2004 2018
                     ercq.setClassscore(qcstuscore);

+ 16
- 9
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportStudentService.java View File

@@ -156,15 +156,22 @@ public class EReportStudentService {
156 156
      * @Date 2022/8/25 16:54
157 157
      **/
158 158
     public List<Map> listSubjectQuestions(Integer examid, Integer studentid, String subjectid) {
159
-        List<Map> list = eRstudentMapper.listSubjectQuestions(examid, studentid, subjectid);
160
-        Double paperscore = list.stream().mapToDouble(s -> Double.parseDouble(s.get("qscore").toString())).sum();
161
-        for (Map m : list) {
162
-            Double stuscore = Double.parseDouble(m.get("stuscore").toString());
163
-            Double qscore = Double.parseDouble(m.get("qscore").toString());
164
-            Double stusrate = N_Utils.getDoubleDivideAndMulitiply(stuscore, qscore);
165
-            m.put("stusrate", stusrate);
166
-            Double srate = N_Utils.getDoubleDivideAndMulitiply(qscore, paperscore);
167
-            m.put("srate", srate);
159
+        Map map = ePaperMapper.getPaperByExamidAndSubjectid(examid, subjectid);
160
+        Integer ptype = Integer.parseInt(map.get("ptype").toString());
161
+        List<Map> list = new ArrayList<>();
162
+        if(ptype == 1){
163
+
164
+        }else{
165
+            list = eRstudentMapper.listSubjectQuestions(examid, studentid, subjectid);
166
+            Double paperscore = list.stream().mapToDouble(s -> Double.parseDouble(s.get("qscore").toString())).sum();
167
+            for (Map m : list) {
168
+                Double stuscore = Double.parseDouble(m.get("stuscore").toString());
169
+                Double qscore = Double.parseDouble(m.get("qscore").toString());
170
+                Double stusrate = N_Utils.getDoubleDivideAndMulitiply(stuscore, qscore);
171
+                m.put("stusrate", stusrate);
172
+                Double srate = N_Utils.getDoubleDivideAndMulitiply(qscore, paperscore);
173
+                m.put("srate", srate);
174
+            }
168 175
         }
169 176
         return list;
170 177
     }

+ 2
- 0
sexam/src/main/java/com/xhkjedu/sexam/vo/paper/QuestionOrderVo.java View File

@@ -14,6 +14,8 @@ public class QuestionOrderVo {
14 14
 
15 15
     private String name;
16 16
 
17
+    private Integer complexity;
18
+
17 19
     //试题类型1单题2母题
18 20
     private Integer qlevel;
19 21
 

+ 1
- 1
sexam/src/test/java/com/xhkjedu/sexam/SexamApplicationTests.java View File

@@ -18,7 +18,7 @@ class SexamApplicationTests {
18 18
 
19 19
     @Test
20 20
     void contextLoads() {
21
-//        eReportGenerateService.saveClassQuestions(2);
21
+        eReportGenerateService.saveClassQuestions(2);
22 22
 //        EPaper epaper = new EPaper();
23 23
 //        epaper.setEpid(6);
24 24
 //        epaper.setPnum(12);

Loading…
Cancel
Save