Browse Source

学生试卷获取完善

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

+ 13
- 7
sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EPaperStudentService.java View File

527
     private void setQuestionsForPaper(List<Map> qtypes){
527
     private void setQuestionsForPaper(List<Map> qtypes){
528
         for(Map mt : qtypes){
528
         for(Map mt : qtypes){
529
             Integer ctype = Integer.parseInt(mt.get("ctype").toString());
529
             Integer ctype = Integer.parseInt(mt.get("ctype").toString());
530
+            List<Map> mqlist = new ArrayList<>();
530
             if(ctype == 11 || ctype == 16 || ctype == 17){
531
             if(ctype == 11 || ctype == 16 || ctype == 17){
531
                 //符合题、完形填空、任务型阅读
532
                 //符合题、完形填空、任务型阅读
532
                 List<Map> questions = (List<Map>) mt.get("questions");
533
                 List<Map> questions = (List<Map>) mt.get("questions");
533
                 Map<String,List<Map>> quemap = questions.stream().collect(Collectors.groupingBy(o -> o.get("questionpid").toString()));
534
                 Map<String,List<Map>> quemap = questions.stream().collect(Collectors.groupingBy(o -> o.get("questionpid").toString()));
534
-                List<Map> mqlist = new ArrayList<>();
535
+
535
                 for(Map.Entry<String,List<Map>> entry : quemap.entrySet()){
536
                 for(Map.Entry<String,List<Map>> entry : quemap.entrySet()){
536
                     List<Map> sonqlst = entry.getValue();
537
                     List<Map> sonqlst = entry.getValue();
537
                     Double sontotalsocre = sonqlst.stream().mapToDouble(o -> Double.parseDouble(o.get("score").toString())).sum();
538
                     Double sontotalsocre = sonqlst.stream().mapToDouble(o -> Double.parseDouble(o.get("score").toString())).sum();
547
                     mque.put("qorder",sque.get("qorder").toString());
548
                     mque.put("qorder",sque.get("qorder").toString());
548
                     mque.put("qn",sque.get("qn").toString());
549
                     mque.put("qn",sque.get("qn").toString());
549
                     mque.put("snum",Integer.parseInt(sque.get("snum").toString()));
550
                     mque.put("snum",Integer.parseInt(sque.get("snum").toString()));
550
-                    if(ctype == 12 && sque.get("mhearfile")!=null){
551
+                    Integer hashear = Integer.parseInt(sque.get("mhashear").toString());
552
+                    mque.put("hashear",hashear);
553
+                    if(ctype == 12 && hashear==1){
551
                         mque.put("hearfile",sque.get("mhearfile").toString());
554
                         mque.put("hearfile",sque.get("mhearfile").toString());
552
                     }else{
555
                     }else{
553
                         mque.put("hearfile","");
556
                         mque.put("hearfile","");
557
                     mque.put("stuscore",stuscore);
560
                     mque.put("stuscore",stuscore);
558
                     mqlist.add(mque);
561
                     mqlist.add(mque);
559
                 }
562
                 }
560
-
561
-                mt.put("questions",mqlist);
562
-
563
             }else if(ctype == 12){
563
             }else if(ctype == 12){
564
                 //听力题,包含单题和复合题
564
                 //听力题,包含单题和复合题
565
                 List<Map> questions = (List<Map>) mt.get("questions");
565
                 List<Map> questions = (List<Map>) mt.get("questions");
566
-                List<Map> mqlist = new ArrayList<>();
567
                 List<String> questionpids = new ArrayList<>();
566
                 List<String> questionpids = new ArrayList<>();
568
                 for(Map q : questions){
567
                 for(Map q : questions){
569
                     Integer qlevel = Integer.parseInt(q.get("qlevel").toString());
568
                     Integer qlevel = Integer.parseInt(q.get("qlevel").toString());
587
                             mque.put("qorder",q.get("qorder").toString());
586
                             mque.put("qorder",q.get("qorder").toString());
588
                             mque.put("qn",q.get("qn").toString());
587
                             mque.put("qn",q.get("qn").toString());
589
                             mque.put("snum",Integer.parseInt(q.get("snum").toString()));
588
                             mque.put("snum",Integer.parseInt(q.get("snum").toString()));
590
-                            if(ctype == 12 && q.get("mhearfile")!=null){
589
+                            Integer hashear = Integer.parseInt(q.get("mhashear").toString());
590
+                            mque.put("hashear",hashear);
591
+                            if(ctype == 12 && hashear == 1){
591
                                 mque.put("hearfile",q.get("mhearfile").toString());
592
                                 mque.put("hearfile",q.get("mhearfile").toString());
592
                             }else{
593
                             }else{
593
                                 mque.put("hearfile","");
594
                                 mque.put("hearfile","");
595
                             mque.put("score",sontotalsocre);
596
                             mque.put("score",sontotalsocre);
596
                             mque.put("stuscore",stuscore);
597
                             mque.put("stuscore",stuscore);
597
                             mque.put("sonques",sonques);
598
                             mque.put("sonques",sonques);
599
+                            mqlist.add(mque);
598
                         }
600
                         }
599
                     }
601
                     }
600
                 }
602
                 }
601
 
603
 
604
+            }else{
605
+                List<Map> questions = (List<Map>) mt.get("questions");
606
+                mqlist.addAll(questions);
602
             }
607
             }
608
+            mt.put("questions",mqlist);
603
         }
609
         }
604
     }
610
     }
605
 
611
 

+ 6
- 3
sexam/src/main/resources/mapper/paperstudent/EPaperStudentQuestionMapper.xml View File

161
             <result column="qtypeid" property="qtypeid"></result>
161
             <result column="qtypeid" property="qtypeid"></result>
162
             <result column="qtypename" property="qtypename"></result>
162
             <result column="qtypename" property="qtypename"></result>
163
             <result column="qctype" property="ctype"></result>
163
             <result column="qctype" property="ctype"></result>
164
-            <result column="qstem" property="qstem"></result>
164
+            <result column="hashear" property="hashear"></result>
165
+            <result column="qctype" property="ctype"></result>
166
+            <result column="hearfile" property="hearfile"></result>
165
             <result column="qoption" property="qoption"></result>
167
             <result column="qoption" property="qoption"></result>
166
             <result column="qlevel" property="qlevel"></result>
168
             <result column="qlevel" property="qlevel"></result>
167
             <result column="sorder" property="sorder"></result>
169
             <result column="sorder" property="sorder"></result>
172
             <result column="mqtypeid" property="mqtypeid"></result>
174
             <result column="mqtypeid" property="mqtypeid"></result>
173
             <result column="mqtypename" property="mqtypename"></result>
175
             <result column="mqtypename" property="mqtypename"></result>
174
             <result column="mctype" property="mctype"></result>
176
             <result column="mctype" property="mctype"></result>
177
+            <result column="mhashear" property="mhashear"></result>
175
             <result column="mhearfile" property="mhearfile"></result>
178
             <result column="mhearfile" property="mhearfile"></result>
176
         </collection>
179
         </collection>
177
     </resultMap>
180
     </resultMap>
178
     <select id="listQStuQuestionScore" resultMap="qtypesQuestion">
181
     <select id="listQStuQuestionScore" resultMap="qtypesQuestion">
179
         select pt.ctype,pt.eptname,pt.eptnum,pt.eptorder,pt.eptscore,
182
         select pt.ctype,pt.eptname,pt.eptnum,pt.eptorder,pt.eptscore,
180
                psq.epsqid,psq.questionid,psq.qorder,psq.qn,ptq.score,ptq.answer,psq.answered,psq.answertype,psq.stuanswer,
183
                psq.epsqid,psq.questionid,psq.qorder,psq.qn,ptq.score,ptq.answer,psq.answered,psq.answertype,psq.stuanswer,
181
-               psq.stuanswertxt,psq.eptqid,psq.stuscore,q.qstem,q.qoption,q.ctype qctype,q.qtypeid,
184
+               psq.stuanswertxt,psq.eptqid,psq.stuscore,q.qstem,q.qoption,q.ctype qctype,q.qtypeid,q.hashear,q.hearfile,
182
                q.qtypename,q.qlevel,q.snum,q.sorder,q.questionpid,mq.questionid mquestionid,mq.qstem mqstem,
185
                q.qtypename,q.qlevel,q.snum,q.sorder,q.questionpid,mq.questionid mquestionid,mq.qstem mqstem,
183
-               mq.qoption mqoption,mq.ctype mctype,mq.qtypeid mqtypeid,mq.qtypename mqtypename,mq.hearfile mhearfile
186
+               mq.qoption mqoption,mq.ctype mctype,mq.qtypeid mqtypeid,mq.qtypename mqtypename,mq.hashear mhashear,mq.hearfile mhearfile
184
         from e_paper_student_question psq left join e_paper_qtype_question ptq on psq.eptqid=ptq.eptqid
187
         from e_paper_student_question psq left join e_paper_qtype_question ptq on psq.eptqid=ptq.eptqid
185
         left join e_paper_qtype pt on pt.eptid=ptq.eptid
188
         left join e_paper_qtype pt on pt.eptid=ptq.eptid
186
         left join t_question q on psq.questionid=q.questionid
189
         left join t_question q on psq.questionid=q.questionid

Loading…
Cancel
Save