Browse Source

班级、学生题型分析

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

+ 4
- 1
sexam/src/main/java/com/xhkjedu/sexam/model/reportstu/ERStudentQtype.java View File

@@ -22,11 +22,14 @@ public class ERStudentQtype extends BaseBean {
22 22
     private Integer examid;
23 23
 
24 24
     //科目id
25
-    private Integer subjectid;
25
+    private String subjectid;
26 26
 
27 27
     //学生id
28 28
     private Integer studentid;
29 29
 
30
+    //试卷id
31
+    private Integer epid;
32
+
30 33
     //班级id
31 34
     private Integer classid;
32 35
 

+ 48
- 32
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperQtypeService.java View File

@@ -196,10 +196,10 @@ public class EPaperQtypeService {
196 196
         List<EPaperQtypeQuestion> uplist = new ArrayList<>();//改试卷中客观题选项数量
197 197
         List<QuestionOrderVo> pointqlist = new ArrayList<>();//用于存放知识点,以及知识点下得分
198 198
         List<EPaperQtypeQuestionVo> mquestions = new ArrayList<>();//存放单题和母题
199
+        List<QuestionOrderVo> complexitylist = new ArrayList<>();//试题难易度存放试题
199 200
 
200
-        //处理题型1单选题2多选题3主观题4判断对错5判断√×6判断TF7完形填空8阅读理解10任务型阅读11综合题12听力
201
-        List<Map> typelist = new ArrayList<>();//题型分析
202 201
         //处理出试卷中所有试题、知识点
202
+        List<Map> typelist = new ArrayList<>();//题型分析
203 203
         for(EPaperQtypeVo qt : qtypelist){
204 204
             List<Integer> qorderlist = new ArrayList<>();
205 205
             List<QuestionOrderVo> qtypeqlist = new ArrayList<>();
@@ -224,6 +224,7 @@ public class EPaperQtypeService {
224 224
                     //处理试题知识点占分
225 225
                     setPaperQuestionPointScore(pointqlist,qpoints,q,null,null);
226 226
                     setPaperQuestionQtypeScore(qtypeqlist,q,null,null);//处理试题题型
227
+                    setPaperQuestionComplexityScore(complexitylist,q,null,null);//处理试题难易度
227 228
                 }
228 229
                 if(q.getQlevel() == 3){
229 230
                     hasmt ++;
@@ -268,9 +269,8 @@ public class EPaperQtypeService {
268 269
                         }else{
269 270
                             mq.setMctype(112);
270 271
                         }
271
-
272
-                        mquestions.add(mq);
273 272
                         mq.setQlevel(qobj.getMqlevel());
273
+                        mq.setSonques(sonques);
274 274
                         //获取所有子题的试题题号
275 275
                         List<String> qns = sonques.stream().map(EPaperQtypeQuestionVo::getQn).collect(Collectors.toList());
276 276
                         String[] qnstr = qns.stream().toArray(String[]::new);
@@ -281,8 +281,10 @@ public class EPaperQtypeService {
281 281
                         //获取知识点
282 282
                         List<Map> qpoints = sonques.get(0).getPoints();
283 283
                         mq.setPoints(qpoints);
284
+                        mquestions.add(mq);
284 285
                         setPaperQuestionPointScore(pointqlist,qpoints,mq,qnstr,eptqidstr);
285 286
                         setPaperQuestionQtypeScore(qtypeqlist,mq,qnstr,eptqidstr);//处理试题题型
287
+                        setPaperQuestionComplexityScore(complexitylist,mq,qnstr,eptqidstr);//处理试题难易度
286 288
                     }
287 289
                 }
288 290
             }
@@ -325,17 +327,20 @@ public class EPaperQtypeService {
325 327
         ztmap.put("ranglist",ranglist);
326 328
 
327 329
         //难易度
328
-        Map<Integer,List<EPaperQtypeQuestionVo>> complxmap =  mquestions.stream().collect(Collectors.groupingBy(EPaperQtypeQuestionVo:: getComplexity, Collectors.toList()));
329 330
         List<Map> clist = new ArrayList<>();
330
-        for(Map.Entry<Integer, List<EPaperQtypeQuestionVo>> entry : complxmap.entrySet()){
331
-            Map cmap = new HashMap();
332
-            cmap.put("level",entry.getKey());
333
-            List<EPaperQtypeQuestionVo> aq = entry.getValue();
334
-            double cscore = aq.stream().collect(Collectors.summingDouble(EPaperQtypeQuestionVo:: getScore));
335
-            double scorerate = N_Utils.getDoubleDivideAndMulitiply(cscore, ePaper.getPscore());
336
-            cmap.put("score",cscore);
337
-            cmap.put("srate",scorerate);
338
-            clist.add(cmap);
331
+        if(N_Utils.isListNotEmpty(complexitylist)){
332
+            Map<String,List<QuestionOrderVo>> complxmap =  complexitylist.stream().collect(Collectors.groupingBy(QuestionOrderVo:: getId, Collectors.toList()));
333
+            for(Map.Entry<String, List<QuestionOrderVo>> entry : complxmap.entrySet()){
334
+                List<QuestionOrderVo> pgblist = entry.getValue();
335
+                Double score = pgblist.stream().mapToDouble(s -> s.getScore()).sum();
336
+                Double srate = N_Utils.getDoubleDivideAndMulitiply(score,ePaper.getPscore());
337
+                Map prate = new HashMap();
338
+                prate.put("level",Integer.parseInt(entry.getKey()));
339
+                prate.put("score",score);
340
+                prate.put("srate",srate);
341
+                prate.put("ques",pgblist);
342
+                clist.add(prate);
343
+            }
339 344
         }
340 345
 
341 346
         //知识点分析
@@ -449,6 +454,27 @@ public class EPaperQtypeService {
449 454
 
450 455
         qtypelist.add(qtype);
451 456
     }
457
+
458
+    //设置试题难易度
459
+    private void setPaperQuestionComplexityScore(List<QuestionOrderVo> complexityList,EPaperQtypeQuestionVo dq,String[] qnstr,Integer[] eptqidstr){
460
+        QuestionOrderVo qtype = new QuestionOrderVo();
461
+        qtype.setId(dq.getComplexity().toString());//存放试题难易度
462
+        qtype.setOrder(dq.getQorder());
463
+        qtype.setScore(dq.getScore());
464
+        qtype.setQlevel(dq.getQlevel());
465
+        if(qnstr == null){
466
+            qtype.setQns(new String[]{dq.getQn()});
467
+        }else{
468
+            qtype.setQns(qnstr);
469
+        }
470
+        if(eptqidstr == null){
471
+            qtype.setEptqids(new Integer[]{dq.getEptqid()});
472
+        }else{
473
+            qtype.setEptqids(eptqidstr);
474
+        }
475
+
476
+        complexityList.add(qtype);
477
+    }
452 478
     //保存试卷分析--附件
453 479
     private void savePaperAnalyzeForFj(EPaper ePaper,List<EPaperQtype> fjtypelist,List<EPaperQtypeQuestion> queslist){
454 480
         //保存之前先清除之前的试卷分析
@@ -507,7 +533,6 @@ public class EPaperQtypeService {
507 533
             double storerate = N_Utils.getDoubleDivideAndMulitiply(tscore, ePaper.getPscore());
508 534
             //获取小题题号
509 535
 
510
-            List<String> allqns = new ArrayList<>();
511 536
             List<Integer> orderlist = new ArrayList<>();
512 537
             List<Integer> eptqidlist = new ArrayList<>();
513 538
             List<String> qnlist = new ArrayList<>();
@@ -532,7 +557,7 @@ public class EPaperQtypeService {
532 557
             tmap.put("num",num);
533 558
             tmap.put("score",tscore);
534 559
             tmap.put("srate",storerate);
535
-            tmap.put("qns",anmap);
560
+            tmap.put("ques",anmap);
536 561
             qtlist.add(tmap);
537 562
         }
538 563
 
@@ -582,7 +607,7 @@ public class EPaperQtypeService {
582 607
                 //试题类型1单题2母题3子题
583 608
                 if(q.getQlevel() == 3){
584 609
                    if(!q.getQuestionpid().equals(qpid)){
585
-                       sonqlist = qlist.stream().filter(o -> o.getQuestionpid().equals(q.getQuestionpid())).collect(Collectors.toList());
610
+                       sonqlist = qlist.stream().filter(o -> q.getQlevel()==3 && q.getQuestionpid().equals(o.getQuestionpid())).collect(Collectors.toList());
586 611
                        EPaperQtypeQuestionVo mq = new EPaperQtypeQuestionVo();
587 612
                        mq.setQuestionid(q.getQuestionpid());
588 613
                        mq.setCtype(q.getMctype());
@@ -594,29 +619,20 @@ public class EPaperQtypeService {
594 619
                        mq.setQanswer(q.getMqanswer());
595 620
                        mq.setQorder(q.getQorder());
596 621
                        mq.setQlevel(q.getMqlevel());
597
-                       mq.setMhashear(q.getMhashear());
598
-                       mq.setMhearfile(q.getMhearfile());
599
-                       List<Map> allpoint = new ArrayList<>();
600
-                       for(EPaperQtypeQuestionVo sq : sonqlist){
601
-                           List<Map> sqpoints = sq.getPoints();
602
-                           for(Map p : sqpoints){
603
-                               if(!isExistEPaperPoints(allpoint,p)){
604
-                                   allpoint.add(p);
605
-                               }
606
-                           }
607
-                       }
622
+                       mq.setHashear(q.getMhashear());
623
+                       mq.setHearfile(q.getMhearfile());
608 624
                        Double mscore = sonqlist.stream().collect(Collectors.summingDouble(EPaperQtypeQuestionVo:: getScore));
609 625
                        mq.setScore(mscore);
610 626
                        mq.setSonques(sonqlist);
611
-                       mq.setPoints(allpoint);
627
+                       mq.setPoints(sonqlist.get(0).getPoints());
612 628
                        rtnqlist.add(mq);
613 629
                    }
614 630
                     qpid = q.getQuestionpid();
615 631
                 }else{
616
-                    EPaperQtypeQuestionVo mq = new EPaperQtypeQuestionVo();
632
+                    /*EPaperQtypeQuestionVo mq = new EPaperQtypeQuestionVo();
617 633
                     BeanUtils.copyProperties(q,mq);
618
-                    mq.setCtype(mq.getCtype());
619
-                    rtnqlist.add(mq);
634
+                    mq.setCtype(mq.getCtype());*/
635
+                    rtnqlist.add(q);
620 636
                 }
621 637
             }
622 638
             qt.setQuestions(rtnqlist);

+ 154
- 126
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportGenerateService.java View File

@@ -30,6 +30,7 @@ import com.xhkjedu.sexam.model.reportstu.ERstudentPoint;
30 30
 import com.xhkjedu.sexam.utils.ExamUtil;
31 31
 import com.xhkjedu.sexam.vo.paper.EPaperQtypeQuestionVo;
32 32
 import com.xhkjedu.sexam.vo.paper.EPaperQtypeVo;
33
+import com.xhkjedu.sexam.vo.paper.QuestionOrderVo;
33 34
 import com.xhkjedu.sexam.vo.report.ERClassScoreVo;
34 35
 import com.xhkjedu.sexam.vo.report.ERPaperVo;
35 36
 import com.xhkjedu.utils.N_Utils;
@@ -434,141 +435,154 @@ public class EReportGenerateService {
434 435
 
435 436
     //题型、试题、知识点
436 437
     private void setClassQuestion(Integer examid,List<Map> subjects,List<Map> classes){
437
-        //考试所有学生提交试卷情况
438
+        //考试所有学生提交试卷作答情况
438 439
         List<EPaperStudentQuestion> stulist = ePaperStudentQuestionMapper.listExamStudentsAnswer(examid);
439 440
 
440
-        List<ERclassQtype> rtypelist = new ArrayList<>();
441
-        List<ERclassQuestion> rqlist = new ArrayList<>();
442
-        List<ERclassQuestionPoint> rpointlist = new ArrayList<>();
443
-        List<ERStudentQtype> stuqtypes = new ArrayList<>();
444
-        List<ERstudentPoint> stupoints = new ArrayList<>();
441
+        List<ERclassQtype> rtypelist = new ArrayList<>();//班级题型
442
+        List<ERclassQuestion> rqueslist = new ArrayList<>();//班级试题
443
+        List<ERclassQuestionPoint> rpointlist = new ArrayList<>();//班级知识点
444
+        List<ERStudentQtype> stutypelist = new ArrayList<>();//学生题型
445
+        List<ERstudentPoint> stupointlist = new ArrayList<>();//学生知识点
445 446
 
446 447
         for(Map map : subjects){
447 448
             String subjectid = map.get("subjectid").toString();
449
+            String subjectname = map.get("subjectname").toString();
448 450
             Integer epid = Integer.parseInt(map.get("epid").toString());//获取试卷id
449 451
             Integer ptype = Integer.parseInt(map.get("ptype").toString());//试卷类型1题库2附件
450 452
             Double pscore = Double.parseDouble(map.get("pscore").toString());
451
-            List<EPaperQtypeVo> fjtypelist = new ArrayList<>();
452
-            if(ptype == 1){
453
-                fjtypelist = ePaperQtypeMapper.listPaperQtypeQuestions(epid);//试卷题型试题信息(题库)
454
-                setEPaperQtypeForQues(fjtypelist);
455
-            }else{
456
-                fjtypelist = ePaperQtypeMapper.listPaperQtypeQuesitonsForFj(epid);//试卷题型试题信息(附件)
457
-            }
458 453
 
459
-            //获取试卷只是分析
460
-            Map epa = ePaperAnalyzeMapper.getPaperAnalzyeByEpid(epid);
461
-            String qtypejson = epa.get("qnumjson").toString();//原试卷题型分析
462
-            List<Map> qtypelist = JSON.parseArray(qtypejson,Map.class);
463
-            for(int k = 0;k<qtypelist.size();k++){
464
-                
465
-            }
454
+            //获取试卷本身的分析
455
+            Map panalyze = ePaperAnalyzeMapper.getPaperAnalzyeByEpid(epid);
456
+            //获取指定试卷学生作答情况
457
+            List<EPaperStudentQuestion> paperstulist = stulist.stream().filter(s -> s.getEpid().equals(epid)).collect(Collectors.toList());
466 458
 
467
-            //遍及试卷处理题型下各班级得分情况
468
-            for(EPaperQtypeVo t : fjtypelist){
469
-                Double eptscore = t.getEptscore();
470
-                Double tgscore = 0.0;//题型下年级得分
471
-                int stunum = 0;
472
-                Map<Integer, ERClassScoreVo> tcmap = new HashMap<>();//题型下班级得分
473
-                String qnstr = "";
474
-                List<EPaperQtypeQuestionVo> questionVos = t.getQuestions();
475
-                for(int i=0;i<questionVos.size();i++){
476
-                    EPaperQtypeQuestionVo q = questionVos.get(i);
477
-                    if (i ==0){
478
-                        qnstr = q.getQn();
479
-                    }else{
480
-                        qnstr = qnstr + "," + q.getQn();
481
-                    }
459
+            if(ptype == 1){
460
+                //处理题型下试题
482 461
 
483
-                    //获取指定试题试题得分
484
-                    List<EPaperStudentQuestion> qstu = stulist.stream().filter(o -> o.getEpid().equals(t.getEpid())
485
-                             && o.getEptqid().equals(q.getEptqid())).collect(Collectors.toList());
486
-                    if(i == 0){
487
-                        stunum = qstu.size();
488
-                    }
489
-                    EPaperStudentQuestion maxscoreStu = qstu.stream().max(Comparator.comparing(EPaperStudentQuestion::getStuscore)).get();//最高分
490
-                    Double qgscore = qstu.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
491
-                    Double qgavgscore = N_Utils.getDoubleDivideAndMulitiply(qgscore,qstu.size());//年级平均分
492
-                    Double qgsrate = N_Utils.getDoubleDivideAndMulitiply(qgscore,q.getScore() * qstu.size());
493
-                    tgscore = ExamUtil.add(tgscore,qgscore);
462
+                //处理知识点
494 463
 
495
-                    for(Map classm : classes){
496
-                        Integer classid = Integer.parseInt(classm.get("classid").toString());
497
-                        List<EPaperStudentQuestion> classStu = qstu.stream().filter(o -> o.getClassid().equals(classid)).collect(Collectors.toList());
498
-                        EPaperStudentQuestion maxclassstu = classStu.stream().max(Comparator.comparing(EPaperStudentQuestion::getStuscore)).get();//最高分
499
-                        Double qallstu = classStu.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
500
-                        Double qcavgscore = N_Utils.getDoubleDivideAndMulitiply(qallstu,classStu.size());//年级平均分
501
-                        Double qcsrate = N_Utils.getDoubleDivideAndMulitiply(qallstu,q.getScore() * classStu.size());
502
-
503
-                        ERclassQuestion ercq = new ERclassQuestion();
504
-                        ercq.setExamid(examid);
505
-                        ercq.setClassid(classid);
506
-                        ercq.setSubjectid(subjectid);
507
-                        ercq.setEptqid(q.getEptqid());
508
-                        ercq.setQn(q.getQn());
509
-                        ercq.setQorder(q.getQorder());
510
-                        if(ptype == 1){
511
-                            ercq.setComplexity(q.getComplexity());
512
-                        }
513
-                        ercq.setClassmaxscore(maxclassstu.getStuscore());
514
-                        ercq.setClassavgscore(qcavgscore);
515
-                        ercq.setClasssrate(qcsrate);
516
-                        ercq.setGrademaxscore(maxscoreStu.getStuscore());
517
-                        ercq.setGradeavgscore(qgavgscore);
518
-                        ercq.setGradesrate(qgsrate);
519
-                        //处理单选题选项情况
520
-                        Map stuansmap = setPaperQuestionsForStu(q,classStu);
521
-                        ercq.setAnswerjson(stuansmap.get("answerlist").toString());
522
-                        ercq.setGoodstujson(stuansmap.get("goodlist").toString());
523
-                        ercq.setBadstujson(stuansmap.get("badlist").toString());
524
-                        rqlist.add(ercq);//单个试题统计
525
-
526
-                        if(tcmap.containsKey(classid)){
527
-                            ERClassScoreVo erClassScoreVo = tcmap.get(classid);
528
-                            if(i ==0){
529
-                                erClassScoreVo.setStunum(classStu.size());
530
-                                erClassScoreVo.setTcscore(0.0);
464
+                //处理难易度
465
+
466
+            }else{
467
+                //附件试卷,主要处理题型及题型下试题
468
+                String qtypejson = panalyze.get("qnumjson").toString();//原试卷题型分析
469
+                List<Map> qtypelist = JSON.parseArray(qtypejson,Map.class);
470
+                for(int k = 0;k<qtypelist.size();k++){
471
+                    Map qtypemap = qtypelist.get(k);
472
+                    String qtypename = qtypemap.get("qtypename").toString();
473
+                    Double score = Double.parseDouble(qtypemap.get("score").toString());//题型下试题总分值
474
+                    Double srate = Double.parseDouble(qtypemap.get("srate").toString());//题型下试题分值占比
475
+                    Integer num = Integer.parseInt(qtypemap.get("num").toString());//题型下试题数量
476
+                    Map ques = (Map) qtypemap.get("ques");//试题相关对象
477
+                    List<Integer> eptqids = (List<Integer>) ques.get("eptqids");//试卷中题型下试题id
478
+                    List<String> qns = (List<String>) ques.get("qns");//试卷中试题题号
479
+                    List<Integer> orders = (List<Integer>) ques.get("orders");//试卷中试题题号
480
+
481
+                    Double tgstuscore = 0.0;
482
+                    Double tgscore = 0.0;
483
+                    int gstunum = 0;
484
+                    Map<Integer,ERClassScoreVo> tclassmap = new HashMap<>();
485
+                    Map<Integer,ERStudentQtype> tstumap = new HashMap<>();
486
+
487
+                    for(int q = 0;q<eptqids.size();q++){
488
+                        Integer eptqid = eptqids.get(q);
489
+                        //获取改题所有学生作答情况
490
+                        List<EPaperStudentQuestion> qgstulist = paperstulist.stream().filter(s -> s.getEptqid().equals(eptqid)).collect(Collectors.toList());
491
+                        gstunum = qgstulist.size();
492
+                        EPaperStudentQuestion qgmaxstu = qgstulist.stream().max(Comparator.comparing(EPaperStudentQuestion::getStuscore)).get();
493
+                        Double qgscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
494
+                        Double qgstuscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
495
+                        Double qgavgscore = N_Utils.getDoubleDivideAndMulitiply(qgstuscore,gstunum);//年级平均分
496
+                        Double qgsrate = N_Utils.getDoubleDivideAndMulitiply(qgstuscore,qgscore);
497
+                        tgscore = ExamUtil.add(tgscore,qgscore);
498
+                        tgstuscore = ExamUtil.add(tgstuscore,qgstuscore);
499
+
500
+                        //处理试题班级学生作答
501
+                        for(Map classm : classes){
502
+                            Integer classid = Integer.parseInt(classm.get("classid").toString());
503
+                            List<EPaperStudentQuestion> qcstulist = qgstulist.stream().filter( s -> s.getClassid().equals(classid)).collect(Collectors.toList());
504
+                            int cstunum = qcstulist.size();//班级下试题作答学生数量
505
+                            EPaperStudentQuestion qcmaxstu = qcstulist.stream().max(Comparator.comparing(EPaperStudentQuestion::getStuscore)).get();
506
+                            Double qcscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
507
+                            Double qcstuscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
508
+                            Double qcavgscore = N_Utils.getDoubleDivideAndMulitiply(qcstuscore,cstunum);
509
+                            Double qcsrate = N_Utils.getDoubleDivideAndMulitiply(qcstuscore,qcscore);
510
+
511
+                            //班级单题情况
512
+                            ERclassQuestion ercq = new ERclassQuestion();
513
+                            ercq.setExamid(examid);
514
+                            ercq.setClassid(classid);
515
+                            ercq.setSubjectid(subjectid);
516
+                            ercq.setEptqid(eptqid);
517
+                            ercq.setQn(qns.get(q));
518
+                            ercq.setQorder(orders.get(q));
519
+                            ercq.setClassmaxscore(qcmaxstu.getStuscore());
520
+                            ercq.setClassavgscore(qcavgscore);
521
+                            ercq.setClasssrate(qcsrate);
522
+                            ercq.setGrademaxscore(qgmaxstu.getStuscore());
523
+                            ercq.setGradeavgscore(qgavgscore);
524
+                            ercq.setGradesrate(qgsrate);
525
+                            //处理单选题选项情况
526
+                            Map stuansmap = setPaperQuestionsForStuAnswer(qcstulist);
527
+                            ercq.setAnswerjson(stuansmap.get("answerlist").toString());
528
+                            ercq.setGoodstujson(stuansmap.get("goodlist").toString());
529
+                            ercq.setBadstujson(stuansmap.get("badlist").toString());
530
+                            rqueslist.add(ercq);//单个试题统计
531
+
532
+                            if(tclassmap.containsKey(classid)){
533
+                                ERClassScoreVo erClassScoreVo = tclassmap.get(classid);
534
+                                erClassScoreVo.setStuscore(ExamUtil.add(erClassScoreVo.getStuscore(), qcstuscore));
535
+                                erClassScoreVo.setCscore(ExamUtil.add(erClassScoreVo.getStuscore(), qcscore));
536
+                            }else{
537
+                                ERClassScoreVo erClassScoreVo = new ERClassScoreVo();
538
+                                erClassScoreVo.setStunum(cstunum);
539
+                                erClassScoreVo.setStuscore(erClassScoreVo.getStuscore());
540
+                                erClassScoreVo.setCscore(erClassScoreVo.getStuscore());
541
+                                tclassmap.put(classid,erClassScoreVo);
531 542
                             }
532
-                            erClassScoreVo.setTcscore(ExamUtil.add(erClassScoreVo.getTcscore(), qallstu));
533
-
534
-                        }else{
535
-                            ERClassScoreVo erClassScoreVo = new ERClassScoreVo();
536
-                            erClassScoreVo.setStunum(classStu.size());
537
-                            erClassScoreVo.setTcscore(0.0);
538
-                            erClassScoreVo.setTcscore(ExamUtil.add(erClassScoreVo.getTcscore(), qallstu));
539
-                            tcmap.put(classid,erClassScoreVo);
543
+                            setEPaperQuestionQtypesStu(qcstulist,tstumap);//设置学生题型下得分
540 544
                         }
541 545
                     }
542
-                }
543 546
 
544
-                Double tgavescore = N_Utils.getDoubleDivideAndMulitiply(tgscore,stunum);//题型下年级平均分
545
-                Double tgsrate = N_Utils.getDoubleDivideAndMulitiply(tgscore,eptscore * stunum);//年级得分率
546
-
547
-                for(Map.Entry<Integer,ERClassScoreVo> entry : tcmap.entrySet()){
548
-                    ERClassScoreVo erClassScoreVo = entry.getValue();
549
-                    ERclassQtype eRclassQtype = new ERclassQtype();
550
-                    eRclassQtype.setExamid(examid);
551
-                    eRclassQtype.setSubjectid(subjectid);
552
-                    eRclassQtype.setEpid(epid);
553
-                    eRclassQtype.setClassid(entry.getKey());
554
-                    eRclassQtype.setQtypename(t.getEptname());
555
-                    eRclassQtype.setScore(eptscore);
556
-                    eRclassQtype.setNum(t.getEptnum());
557
-                    eRclassQtype.setSrate(N_Utils.getDoubleDivideAndMulitiply(eptscore,pscore));
558
-                    eRclassQtype.setGradeavgscore(tgavescore);
559
-                    eRclassQtype.setGradesrate(tgsrate);
560
-                    eRclassQtype.setClassavgscore(N_Utils.getDoubleDivideAndMulitiply(erClassScoreVo.getTcscore(),erClassScoreVo.getStunum()));
561
-                    eRclassQtype.setClasssrate(N_Utils.getDoubleDivideAndMulitiply(erClassScoreVo.getTcscore(),eptscore * erClassScoreVo.getStunum() ));
562
-                    eRclassQtype.setQns(qnstr);
563
-
564
-                    rtypelist.add(eRclassQtype);
547
+                    Double tgavgscore = N_Utils.getDoubleDivideAndMulitiply(tgstuscore,gstunum);//题型下年级平均分
548
+                    Double tgsrate = N_Utils.getDoubleDivideAndMulitiply(tgstuscore,tgscore);//年级得分率
549
+
550
+                    //题型--班级得分
551
+                    for(Map.Entry<Integer,ERClassScoreVo> entry : tclassmap.entrySet()){
552
+                        ERClassScoreVo erClassScoreVo = entry.getValue();
553
+                        ERclassQtype eRclassQtype = new ERclassQtype();
554
+                        eRclassQtype.setExamid(examid);
555
+                        eRclassQtype.setSubjectid(subjectid);
556
+                        eRclassQtype.setEpid(epid);
557
+                        eRclassQtype.setClassid(entry.getKey());
558
+                        eRclassQtype.setQtypename(qtypename);
559
+                        eRclassQtype.setScore(score);
560
+                        eRclassQtype.setNum(num);
561
+                        eRclassQtype.setSrate(srate);
562
+                        eRclassQtype.setGradeavgscore(tgavgscore);
563
+                        eRclassQtype.setGradesrate(tgsrate);
564
+                        eRclassQtype.setClassavgscore(N_Utils.getDoubleDivideAndMulitiply(erClassScoreVo.getStuscore(),erClassScoreVo.getStunum()));
565
+                        eRclassQtype.setClasssrate(N_Utils.getDoubleDivideAndMulitiply(erClassScoreVo.getStuscore(),erClassScoreVo.getCscore()));
566
+                        eRclassQtype.setQns(qns.stream().map(String::valueOf).collect(Collectors.joining(",")));
567
+                        rtypelist.add(eRclassQtype);
568
+                    }
569
+
570
+                    //题型--学生得分
571
+                    for(Map.Entry<Integer,ERStudentQtype> entry : tstumap.entrySet()){
572
+                        ERStudentQtype erStudentQtype = entry.getValue();
573
+                        erStudentQtype.setExamid(examid);
574
+                        erStudentQtype.setSubjectid(subjectid);
575
+                        erStudentQtype.setEpid(epid);
576
+                        erStudentQtype.setQtypename(qtypename);
577
+                        erStudentQtype.setStusrate(N_Utils.getDoubleDivideAndMulitiply(erStudentQtype.getStuscore(),score));
578
+                        stutypelist.add(erStudentQtype);
579
+                    }
565 580
                 }
566 581
             }
567 582
 
568
-
569 583
             //仅有题库试卷有知识点
570 584
             if(ptype == 1){
571
-                String pointjson = epa.get("pointjson").toString();
585
+                String pointjson = panalyze.get("pointjson").toString();
572 586
                 List<Map> pointlist = JSON.parseArray(pointjson,Map.class);
573 587
                 //遍历知识点处理年级班级知识点情况
574 588
                 for(int j=0;j<pointlist.size();j++){
@@ -609,15 +623,15 @@ public class EReportGenerateService {
609 623
                         rpointlist.add(pointvo);
610 624
                     }
611 625
 
612
-                    setEPaperQuestionPointsStu(gstus,stupoints,subjectid,pointid,pointname);
626
+                    setEPaperQuestionPointsStu(gstus,stupointlist,subjectid,pointid,pointname);
613 627
                 }
614 628
             }
615 629
         }
616 630
         eRclassQtypeMapper.insertList(rtypelist);
617
-        eRclassQuestionMapper.insertList(rqlist);
631
+        eRclassQuestionMapper.insertList(rqueslist);
618 632
         eRclassQuestionPointMapper.insertList(rpointlist);
619
-        eRstudentPointMapper.insertList(stupoints);
620
-        eRstudentQtypeMapper.insertList(stuqtypes);
633
+        eRstudentPointMapper.insertList(stupointlist);
634
+        eRstudentQtypeMapper.insertList(stutypelist);
621 635
     }
622 636
     //处理题库试卷中子母题
623 637
     private void setEPaperQtypeForQues(List<EPaperQtypeVo> fjtypelist){
@@ -680,7 +694,9 @@ public class EReportGenerateService {
680 694
         return false;
681 695
     }
682 696
     //处理学生选项情况和得分情况
683
-    private Map setPaperQuestionsForStu(EPaperQtypeQuestionVo q,List<EPaperStudentQuestion> classStu){
697
+    private Map setPaperQuestionsForStuAnswer(List<EPaperStudentQuestion> classStu){
698
+        EPaperStudentQuestion q = classStu.get(0);//取第一条数据
699
+
684 700
         Map<String,List<Map>> answermap = new HashMap<>();
685 701
         List<Map> goodlist = new ArrayList<>();
686 702
         List<Map> badlist = new ArrayList<>();
@@ -716,9 +732,9 @@ public class EReportGenerateService {
716 732
                 //主观题
717 733
                 if(i==0){
718 734
                     //处理分数分段对应,用于分数段[0,50%)   [50%,80%),  [80%,100%]
719
-                    score8 = ExamUtil.getScoreRateScore(q.getScore(),0.8);
720
-                    score5 = ExamUtil.getScoreRateScore(q.getScore(),0.8);
721
-                    key1 = score8+"-"+q.getScore();
735
+                    score8 = ExamUtil.getScoreRateScore(q.getQscore(),0.8);
736
+                    score5 = ExamUtil.getScoreRateScore(q.getQscore(),0.8);
737
+                    key1 = score8+"-"+q.getQscore();
722 738
                     key2 = score8 + "-" + score5;
723 739
                     key3 = score5 + "-" + 0;
724 740
                     answermap.put(key1,new ArrayList<>());
@@ -762,6 +778,20 @@ public class EReportGenerateService {
762 778
         return rtnmap;
763 779
     }
764 780
 
781
+    //设置学生题型下试题得分
782
+    private void setEPaperQuestionQtypesStu(List<EPaperStudentQuestion> gstus,Map<Integer,ERStudentQtype> stumap){
783
+        for(EPaperStudentQuestion q : gstus){
784
+            if(stumap.containsKey(q.getStudentid())){
785
+                ERStudentQtype sq = stumap.get(q.getStudentid());
786
+                sq.setStuscore(ExamUtil.add(sq.getStuscore(), q.getStuscore()));
787
+            }else{
788
+                ERStudentQtype sq = new ERStudentQtype();
789
+                sq.setClassid(q.getClassid());
790
+                sq.setStudentid(q.getStudentid());
791
+                sq.setStuscore(q.getStuscore());
792
+            }
793
+        }
794
+    }
765 795
     //设置学生知识点关联试题得分
766 796
     private void setEPaperQuestionPointsStu(List<EPaperStudentQuestion> gstus,List<ERstudentPoint> stupoints,String subjectid,String pointid,String pointname){
767 797
         //把试题按学生进行分组然后进行计算
@@ -787,9 +817,7 @@ public class EReportGenerateService {
787 817
 
788 818
 
789 819
     }
790
-
791
-    //设置学生题型下试题得分
792
-    private void setEPaperQuestionQtypesStu(List<EPaperStudentQuestion> gstus,List<ERstudentPoint> stupoints){
793
-
820
+    //设置学生难易度下试题得分
821
+    private void setEPaperQuestionComplexitysStu(List<EPaperStudentQuestion> gstus,List<ERstudentPoint> stupoints){
794 822
     }
795 823
 }

+ 4
- 1
sexam/src/main/java/com/xhkjedu/sexam/vo/report/ERClassScoreVo.java View File

@@ -6,5 +6,8 @@ import lombok.Data;
6 6
 public class ERClassScoreVo {
7 7
     private Integer stunum;//学生数量
8 8
 
9
-    private Double tcscore = 0.0;//班级得分
9
+    private Double stuscore = 0.0;//单个试题班级学生下学生得分
10
+
11
+    private Double cscore= 0.0;//单个试题班级学生下试题总分
12
+
10 13
 }

+ 17
- 38
sstudy/src/main/java/com/xhkjedu/sstudy/service/question/QuestionService.java View File

@@ -375,6 +375,9 @@ public class QuestionService {
375 375
         if(question.getHashear() == null){
376 376
             question.setHashear(0);
377 377
         }
378
+        if(question.getSnum() == null){
379
+            question.setSnum(0);
380
+        }
378 381
 
379 382
         saveQues.add(question);
380 383
         map.put("questionid",questionid);
@@ -388,6 +391,7 @@ public class QuestionService {
388 391
                 sq.setCount(0);
389 392
                 sq.setQstate(1);
390 393
                 sq.setBelong(4);
394
+                sq.setHashear(0);
391 395
                 sq.setQuestionpid(questionid);
392 396
                 sq.setSubjectid(question.getSubjectid());
393 397
                 sq.setCreateid(question.getCreateid());
@@ -398,51 +402,26 @@ public class QuestionService {
398 402
                 sonmap.put("sorder",sq.getSorder());
399 403
                 sonmap.put("quesitonid",sqid);
400 404
                 sonlist.add(sonmap);
401
-
402
-                //知识点
403
-                List<TQuestionPoint> points = sq.getQuestionPoints();
404
-                if(points!=null && points.size()>0){
405
-                    for(TQuestionPoint p : points){
406
-                        TQuestionPoint mp = new TQuestionPoint();
407
-                        String mqpid = StudyUtil.getId();
408
-                        mp.setQpid(mqpid);
409
-                        mp.setQuestionid(questionid);
410
-                        mp.setPointid(p.getPointid());
411
-                        mp.setCreateid(question.getCreateid());
412
-                        mp.setCreatetime(timestamp);
413
-                        saveQPoints.add(mp);//母题关联所有子题关联知识点
414
-
415
-                        //子题关联知识点
416
-                        String qpid = StudyUtil.getId();
417
-                        p.setQpid(qpid);
418
-                        p.setQuestionid(sqid);
419
-                        p.setCreateid(question.getCreateid());
420
-                        p.setCreatetime(timestamp);
421
-                        p.setSchoolid(question.getSchoolid());
422
-                        saveQPoints.add(p);//子题关联知识点
423
-                    }
424
-                }
425 405
             }
426
-        }else{
427
-            //单题型母题关联知识点
428
-            //知识点
429
-            List<TQuestionPoint> points = question.getQuestionPoints();
430
-            if(points!=null && points.size()>0){
431
-                for(TQuestionPoint p : points){
432
-                    p.setQpid(StudyUtil.getId());
433
-                    p.setQuestionid(questionid);
434
-                    p.setCreateid(question.getCreateid());
435
-                    p.setCreatetime(timestamp);
436
-                    p.setSchoolid(question.getSchoolid());
437
-                    saveQPoints.add(p);
438
-                }
406
+        }
407
+
408
+        //单题型母题关联知识点
409
+        List<TQuestionPoint> points = question.getQuestionPoints();
410
+        if(points!=null && points.size()>0){
411
+            for(TQuestionPoint p : points){
412
+                p.setQpid(StudyUtil.getId());
413
+                p.setQuestionid(questionid);
414
+                p.setCreateid(question.getCreateid());
415
+                p.setCreatetime(timestamp);
416
+                p.setSchoolid(question.getSchoolid());
417
+                saveQPoints.add(p);
439 418
             }
440 419
         }
420
+
441 421
         map.put("sonlist",sonlist);
442 422
         return map;
443 423
     }
444 424
 
445
-
446 425
     //设置章节
447 426
     private void setSaveUpdateQuesitonDirector(QuestionVo qvo,TQuestion question,List<TQuestionDirector> saveQDirs){
448 427
         //原试题关联章节

+ 1
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/service/question/UserBasketService.java View File

@@ -83,6 +83,7 @@ public class UserBasketService {
83 83
                     bn.setQtypeid(b.getQtypeid());
84 84
                     bn.setQtypename(b.getQtypename());
85 85
                     bn.setPtnum(questions.size());
86
+                    bn.setCtype(b.getCtype());
86 87
                     Double ptscore = questions.stream().collect(Collectors.summingDouble(QuestionVo::getScore));
87 88
                     bn.setPtscore(ptscore);
88 89
                     bn.setQuestions(questions);

Loading…
Cancel
Save