Browse Source

Merge remote-tracking branch 'origin/master' into ywx

tags/正式版本
雍文秀 2 years ago
parent
commit
fa5c46764f

+ 1
- 1
scommons/src/main/java/com/xhkjedu/utils/N_Utils.java View File

1023
     }
1023
     }
1024
 
1024
 
1025
     //处理题型中客观题
1025
     //处理题型中客观题
1026
-    private static int[] octypelist = new int[]{1,2,4,5,6,7,8,10};
1026
+    private static int[] octypelist = new int[]{1,2,4,5,6,7,8,10,16,17};
1027
     /**
1027
     /**
1028
      * @Description 判断ctype是否是客观题
1028
      * @Description 判断ctype是否是客观题
1029
      * @Param [ctype]
1029
      * @Param [ctype]

+ 0
- 9
sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/EPaperQtypeMapper.java View File

26
     //制作答题卡时获取试卷中试题
26
     //制作答题卡时获取试卷中试题
27
     List<Map> listPaperqtypeQuestionsForScan(@Param("epid") Integer epid);
27
     List<Map> listPaperqtypeQuestionsForScan(@Param("epid") Integer epid);
28
 
28
 
29
-    //保存试题正确答案
30
-    void updateBatchQuestionAnswer(@Param("list")List<EPaperQtypeQuestion> list);
31
-
32
-    //批量保存答题卡
33
-    void updateBatchQuestionForScan(@Param("list")List<EPaperQtypeQuestion> list);
34
-
35
-    //试卷中所有试题基础信息
36
-    List<EPaperQtypeQuestion> listQuestionsByEpid(@Param("epid") Integer epid);
37
-
38
     //根据试卷id删除试题
29
     //根据试卷id删除试题
39
     void deleteByEpid(@Param("epid") Integer epid);
30
     void deleteByEpid(@Param("epid") Integer epid);
40
 
31
 

+ 13
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/EPaperQtypeQuestionMapper.java View File

2
 
2
 
3
 import com.xhkjedu.sexam.base.TkMapper;
3
 import com.xhkjedu.sexam.base.TkMapper;
4
 import com.xhkjedu.sexam.model.paper.EPaperQtypeQuestion;
4
 import com.xhkjedu.sexam.model.paper.EPaperQtypeQuestion;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
5
 
8
 
6
 /**
9
 /**
7
  * @Description 题库题型试题
10
  * @Description 题库题型试题
9
  * Date 2022/7/19 8:57
12
  * Date 2022/7/19 8:57
10
  **/
13
  **/
11
 public interface EPaperQtypeQuestionMapper extends TkMapper<EPaperQtypeQuestion> {
14
 public interface EPaperQtypeQuestionMapper extends TkMapper<EPaperQtypeQuestion> {
15
+    //保存试题正确答案
16
+    void updateBatchQuestionAnswer(@Param("list") List<EPaperQtypeQuestion> list);
17
+
18
+    //批量保存答题卡
19
+    void updateBatchQuestionForScan(@Param("list")List<EPaperQtypeQuestion> list);
20
+
21
+    //修改客观题选项数量
22
+    void updateBatchQuestionOptionnum(@Param("list")List<EPaperQtypeQuestion> list);
12
 
23
 
24
+    //试卷中所有试题基础信息
25
+    List<EPaperQtypeQuestion> listQuestionsByEpid(@Param("epid") Integer epid);
13
 }
26
 }

+ 6
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperQtypeQuestion.java View File

56
     //作文格数
56
     //作文格数
57
     private Integer gnum;
57
     private Integer gnum;
58
 
58
 
59
+    //答题区高度
60
+    private Integer height;
61
+
62
+    //答题区富文本
63
+    private String queshtml;
64
+
59
     //难易度
65
     //难易度
60
     @Transient
66
     @Transient
61
     private Integer complexity;
67
     private Integer complexity;

+ 3
- 2
sexam/src/main/java/com/xhkjedu/sexam/service/exam/EBaseService.java View File

7
 import com.xhkjedu.sexam.mapper.exam.ESubjectMapper;
7
 import com.xhkjedu.sexam.mapper.exam.ESubjectMapper;
8
 import com.xhkjedu.sexam.mapper.paper.EPaperMapper;
8
 import com.xhkjedu.sexam.mapper.paper.EPaperMapper;
9
 import com.xhkjedu.sexam.mapper.paper.EPaperQtypeMapper;
9
 import com.xhkjedu.sexam.mapper.paper.EPaperQtypeMapper;
10
+import com.xhkjedu.sexam.mapper.paper.EPaperQtypeQuestionMapper;
10
 import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentMapper;
11
 import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentMapper;
11
 import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentQuestionMapper;
12
 import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentQuestionMapper;
12
 import com.xhkjedu.sexam.mapper.system.UserMapper;
13
 import com.xhkjedu.sexam.mapper.system.UserMapper;
54
     @Resource
55
     @Resource
55
     private EBaseMacMapper eBaseMacMapper;
56
     private EBaseMacMapper eBaseMacMapper;
56
     @Resource
57
     @Resource
57
-    private EPaperQtypeMapper ePaperQtypeMapper;
58
+    private EPaperQtypeQuestionMapper ePaperQtypeQuestionMapper;
58
     @Resource
59
     @Resource
59
     private EPaperStudentQuestionMapper ePaperStudentQuestionMapper;
60
     private EPaperStudentQuestionMapper ePaperStudentQuestionMapper;
60
 
61
 
225
             for (EPaper paper : papers) {
226
             for (EPaper paper : papers) {
226
                 Integer epid = paper.getEpid();
227
                 Integer epid = paper.getEpid();
227
                 //获取试卷中所有试题
228
                 //获取试卷中所有试题
228
-                List<EPaperQtypeQuestion> queslist = ePaperQtypeMapper.listQuestionsByEpid(epid);
229
+                List<EPaperQtypeQuestion> queslist = ePaperQtypeQuestionMapper.listQuestionsByEpid(epid);
229
                 for (EPaperStudent ps : studentList) {
230
                 for (EPaperStudent ps : studentList) {
230
                     for(EPaperQtypeQuestion q : queslist){
231
                     for(EPaperQtypeQuestion q : queslist){
231
                         EPaperStudentQuestion epsq = new EPaperStudentQuestion();
232
                         EPaperStudentQuestion epsq = new EPaperStudentQuestion();

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

158
                 if(q.getOptionnum()==null){
158
                 if(q.getOptionnum()==null){
159
                     q.setOptionnum(0);
159
                     q.setOptionnum(0);
160
                 }
160
                 }
161
-                Integer qorder = q.getQorder();
161
+                /*Integer qorder = q.getQorder();
162
                 if (ptype == 1 && ctype != 11) {
162
                 if (ptype == 1 && ctype != 11) {
163
                     q.setQn(qorder.toString());
163
                     q.setQn(qorder.toString());
164
                 } else if (ptype == 1 && ctype == 11) {
164
                 } else if (ptype == 1 && ctype == 11) {
165
                     q.setQn(qorder + "." + (i + 1));
165
                     q.setQn(qorder + "." + (i + 1));
166
-                }
166
+                }*/
167
                 if(q.getCtype() == 14){
167
                 if(q.getCtype() == 14){
168
                     q.setGnum(900);//语文作文格数
168
                     q.setGnum(900);//语文作文格数
169
                 }else if(q.getCtype() == 15){
169
                 }else if(q.getCtype() == 15){
191
     }
191
     }
192
 
192
 
193
     //保存试卷分析--题库
193
     //保存试卷分析--题库
194
-    private void savePaperAnalyzeForQuestion(EPaper ePaper){
194
+    public void savePaperAnalyzeForQuestion(EPaper ePaper){
195
         //保存之前先清除之前的试卷分析
195
         //保存之前先清除之前的试卷分析
196
         ePaperAnalyzeMapper.deleteByEpid(ePaper.getEpid());
196
         ePaperAnalyzeMapper.deleteByEpid(ePaper.getEpid());
197
         //总体分析(主观题、客观题)
197
         //总体分析(主观题、客观题)
198
         List<EPaperQtypeVo> qtypelist = ePaperQtypeMapper.listPaperQtypeQuestions(ePaper.getEpid());//试卷题型试题信息
198
         List<EPaperQtypeVo> qtypelist = ePaperQtypeMapper.listPaperQtypeQuestions(ePaper.getEpid());//试卷题型试题信息
199
         List<EPaperQtypeQuestionVo> queslist = new ArrayList<>();//试卷中所有试题(子题)
199
         List<EPaperQtypeQuestionVo> queslist = new ArrayList<>();//试卷中所有试题(子题)
200
         List<EPaperQPointVo> quespoints = new ArrayList<>();//试卷中所有单题和子题以及对应知识点
200
         List<EPaperQPointVo> quespoints = new ArrayList<>();//试卷中所有单题和子题以及对应知识点
201
+        List<EPaperQtypeQuestion> uplist = new ArrayList<>();//如果是客观题则获取客观题选项数量更改试卷中客观题选项数量
201
 
202
 
202
         //处理题型1单选题2多选题3主观题4判断对错5判断√×6判断TF7完形填空8阅读理解10任务型阅读11综合题12听力
203
         //处理题型1单选题2多选题3主观题4判断对错5判断√×6判断TF7完形填空8阅读理解10任务型阅读11综合题12听力
203
         List<Map> typelist = new ArrayList<>();//题型分析
204
         List<Map> typelist = new ArrayList<>();//题型分析
225
                 if(!qorderlist.contains(q.getQorder())){
226
                 if(!qorderlist.contains(q.getQorder())){
226
                     qorderlist.add(q.getQorder());
227
                     qorderlist.add(q.getQorder());
227
                 }
228
                 }
229
+                int ctype = q.getCtype();
230
+                if(ctype == 1 || ctype ==2 || ctype==4 || ctype ==5 || ctype==6){
231
+                    List<String> strlst = JSON.parseArray(q.getQoption(),String.class);
232
+                    EPaperQtypeQuestion eqq = new EPaperQtypeQuestion();
233
+                    eqq.setEptqid(q.getEptqid());
234
+                    eqq.setOptionnum(strlst.size());
235
+                    uplist.add(eqq);
236
+                }
228
             }
237
             }
229
 
238
 
230
             double storerate = N_Utils.getDoubleDivideAndMulitiply(qt.getEptscore(), ePaper.getPscore());
239
             double storerate = N_Utils.getDoubleDivideAndMulitiply(qt.getEptscore(), ePaper.getPscore());
231
-            EPaperQsVo tvo = new EPaperQsVo();
232
             Map tmap = new HashMap();
240
             Map tmap = new HashMap();
233
             tmap.put("qtname",qt.getEptname());
241
             tmap.put("qtname",qt.getEptname());
234
             tmap.put("num",qt.getEptnum());
242
             tmap.put("num",qt.getEptnum());
337
         epa.setComplexityjson(JSON.toJSONString(clist));//难易度分析
345
         epa.setComplexityjson(JSON.toJSONString(clist));//难易度分析
338
         epa.setPointjson(JSON.toJSONString(pointlist));//知识点分析
346
         epa.setPointjson(JSON.toJSONString(pointlist));//知识点分析
339
         ePaperAnalyzeMapper.insertUseGeneratedKeys(epa);
347
         ePaperAnalyzeMapper.insertUseGeneratedKeys(epa);
340
-
348
+        if(N_Utils.isListNotEmpty(uplist)){
349
+            ePaperQtypeQuestionMapper.updateBatchQuestionOptionnum(uplist);
350
+        }
341
     }
351
     }
342
 
352
 
343
     //保存试卷分析--附件
353
     //保存试卷分析--附件
524
     public void saveQuesitonAnswer(EPaper ePaper){
534
     public void saveQuesitonAnswer(EPaper ePaper){
525
         List<EPaperQtypeQuestion> questions = ePaper.getQuestions();
535
         List<EPaperQtypeQuestion> questions = ePaper.getQuestions();
526
         if(questions != null && questions.size() > 0){
536
         if(questions != null && questions.size() > 0){
527
-            ePaperQtypeMapper.updateBatchQuestionAnswer(questions);
537
+            ePaperQtypeQuestionMapper.updateBatchQuestionAnswer(questions);
528
             ePaper.setAnswered(1);
538
             ePaper.setAnswered(1);
529
             ePaperMapper.updateEPaperAnswered(ePaper);
539
             ePaperMapper.updateEPaperAnswered(ePaper);
530
             //设置完答案进行匹配
540
             //设置完答案进行匹配
539
         Integer examstate = Integer.parseInt(map.get("examstate").toString());
549
         Integer examstate = Integer.parseInt(map.get("examstate").toString());
540
         if(examstate > 0){
550
         if(examstate > 0){
541
             //获取试卷中原试题答案
551
             //获取试卷中原试题答案
542
-            List<EPaperQtypeQuestion> yqlist = ePaperQtypeMapper.listQuestionsByEpid(epid);
552
+            List<EPaperQtypeQuestion> yqlist = ePaperQtypeQuestionMapper.listQuestionsByEpid(epid);
543
             List<EPaperQtypeQuestion> changeQs = new ArrayList<>();//改变答案的试题
553
             List<EPaperQtypeQuestion> changeQs = new ArrayList<>();//改变答案的试题
544
             for(EPaperQtypeQuestion tq : questions){
554
             for(EPaperQtypeQuestion tq : questions){
545
                 EPaperQtypeQuestion yq = yqlist.stream().filter(y -> y.getEptqid().equals(tq.getEptqid())).findFirst().orElse(null);
555
                 EPaperQtypeQuestion yq = yqlist.stream().filter(y -> y.getEptqid().equals(tq.getEptqid())).findFirst().orElse(null);
635
     public Map getPaperAndQuesitons(Integer epid){
645
     public Map getPaperAndQuesitons(Integer epid){
636
         Map eps = ePaperMapper.getExamPaperAndSubject(epid);//考试考试科目名称
646
         Map eps = ePaperMapper.getExamPaperAndSubject(epid);//考试考试科目名称
637
         List<Map> qtypes = new ArrayList<>();//题型试题
647
         List<Map> qtypes = new ArrayList<>();//题型试题
638
-        if(eps!=null && eps.get("ptype")!=null){
639
-            int ptype = Integer.parseInt(eps.get("ptype").toString());//试卷类型1题库2附件
648
+        if(eps!=null){
640
             qtypes = ePaperQtypeMapper.listPaperqtypeQuestionsForScan(epid);
649
             qtypes = ePaperQtypeMapper.listPaperqtypeQuestionsForScan(epid);
641
-            if(ptype == 1){
642
-                //处理试卷中试题选项数量
643
-                for(Map qtm : qtypes){
644
-                    List<Map> qlist = (List<Map>) qtm.get("questions");
645
-                    for(Map qm : qlist){
646
-                        String qoption = qm.get("qoption").toString();
647
-                        Integer ctype = Integer.parseInt(qm.get("ctype").toString());
648
-                        if(ctype == 1 || ctype ==2 || ctype==4 || ctype ==5 || ctype==6 ){
649
-                            List<String> strlst = JSON.parseArray(qoption,String.class);
650
-                            qm.put("qoption","");
651
-                            qm.put("optionnum",strlst.size());
652
-                        }else if(ctype == 7 || ctype == 8 || ctype ==10){
653
-                            //完形填空、阅读理解、任务型阅读
654
-                            List<QuestionOptionVo> qopt = JSON.parseArray(qoption,QuestionOptionVo.class);
655
-                            qm.put("optionnum",qopt.get(0).getSqoptions().size());
656
-                            qm.put("quenum",qopt.size());
657
-                            qm.put("qoption","");
658
-
659
-                        }
660
-                    }
661
-                }
662
-            }
663
 
650
 
664
             //设置答题卡需要默认值
651
             //设置答题卡需要默认值
665
             if(eps.get("scantronnote") == null){
652
             if(eps.get("scantronnote") == null){
693
             paper.setScantronnum(pn);
680
             paper.setScantronnum(pn);
694
         }
681
         }
695
         ePaperMapper.updatePaperScantron(paper);
682
         ePaperMapper.updatePaperScantron(paper);
696
-        ePaperQtypeMapper.updateBatchQuestionForScan(questions);
683
+        ePaperQtypeQuestionMapper.updateBatchQuestionForScan(questions);
697
         if(paper.getPstate() == 1){
684
         if(paper.getPstate() == 1){
698
             eSubjectMapper.updateEsubjectStateByEpid(1,paper.getEpid());
685
             eSubjectMapper.updateEsubjectStateByEpid(1,paper.getEpid());
699
             //提交之后把答题卡base图片转成pdf
686
             //提交之后把答题卡base图片转成pdf

+ 3
- 2
sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EPaperStudentService.java View File

3
 import com.alibaba.fastjson.JSON;
3
 import com.alibaba.fastjson.JSON;
4
 import com.xhkjedu.sexam.mapper.paper.EPaperFileMapper;
4
 import com.xhkjedu.sexam.mapper.paper.EPaperFileMapper;
5
 import com.xhkjedu.sexam.mapper.paper.EPaperQtypeMapper;
5
 import com.xhkjedu.sexam.mapper.paper.EPaperQtypeMapper;
6
+import com.xhkjedu.sexam.mapper.paper.EPaperQtypeQuestionMapper;
6
 import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentMapper;
7
 import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentMapper;
7
 import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentQuestionMapper;
8
 import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentQuestionMapper;
8
 import com.xhkjedu.sexam.mapper.paperstudent.EScanbatchMapper;
9
 import com.xhkjedu.sexam.mapper.paperstudent.EScanbatchMapper;
42
     @Resource
43
     @Resource
43
     private EPaperStudentMapper ePaperStudentMapper;
44
     private EPaperStudentMapper ePaperStudentMapper;
44
     @Resource
45
     @Resource
45
-    private EPaperQtypeMapper ePaperQtypeMapper;
46
+    private EPaperQtypeQuestionMapper ePaperQtypeQuestionMapper;
46
     @Resource
47
     @Resource
47
     private EPaperStudentQuestionMapper ePaperStudentQuestionMapper;
48
     private EPaperStudentQuestionMapper ePaperStudentQuestionMapper;
48
     @Resource
49
     @Resource
131
     //保存学生试卷关联信息
132
     //保存学生试卷关联信息
132
     private void savePaperStudentQuestion(EPaperStudentVo psvo) {
133
     private void savePaperStudentQuestion(EPaperStudentVo psvo) {
133
         //生成学生试卷
134
         //生成学生试卷
134
-        List<EPaperQtypeQuestion> pqlist = ePaperQtypeMapper.listQuestionsByEpid(psvo.getEpid());
135
+        List<EPaperQtypeQuestion> pqlist = ePaperQtypeQuestionMapper.listQuestionsByEpid(psvo.getEpid());
135
 
136
 
136
         List<EPaperStudentQuestion> psqlist = new ArrayList<>();
137
         List<EPaperStudentQuestion> psqlist = new ArrayList<>();
137
         for (EPaperQtypeQuestion q : pqlist) {
138
         for (EPaperQtypeQuestion q : pqlist) {

+ 1
- 0
sexam/src/main/java/com/xhkjedu/sexam/vo/paper/EPaperQPointVo.java View File

13
     private String pointname;//知识点名称
13
     private String pointname;//知识点名称
14
 
14
 
15
     private String questionid;//试题id
15
     private String questionid;//试题id
16
+    private Integer eptqid;//试题id
16
     private double score;//分值
17
     private double score;//分值
17
     private Integer qorder;//试题排序
18
     private Integer qorder;//试题排序
18
 }
19
 }

+ 14
- 7
sexam/src/main/resources/mapper/paper/EPaperQtypeMapper.xml View File

40
             <result column="mqanalyze" property="mqanalyze"></result>
40
             <result column="mqanalyze" property="mqanalyze"></result>
41
             <result column="mqlevel" property="mqlevel"></result>
41
             <result column="mqlevel" property="mqlevel"></result>
42
             <collection property="points" ofType="com.xhkjedu.sexam.vo.paper.EPaperQPointVo" javaType="java.util.List"
42
             <collection property="points" ofType="com.xhkjedu.sexam.vo.paper.EPaperQPointVo" javaType="java.util.List"
43
-                        column="questionid" select="listQuestionPoints">
43
+                        column="{questionid=questionid,qlevel=qlevel,questionpid=questionpid" select="listQuestionPoints">
44
                 <result column="pointid" property="pointid"></result>
44
                 <result column="pointid" property="pointid"></result>
45
                 <result column="pointname" property="pointname"></result>
45
                 <result column="pointname" property="pointname"></result>
46
             </collection>
46
             </collection>
62
     <select id="listQuestionPoints" resultType="com.xhkjedu.sexam.vo.paper.EPaperQPointVo">
62
     <select id="listQuestionPoints" resultType="com.xhkjedu.sexam.vo.paper.EPaperQPointVo">
63
         select qp.pointid,p.pointname from t_question_point qp
63
         select qp.pointid,p.pointname from t_question_point qp
64
         left join t_point p on qp.pointid=p.pointid
64
         left join t_point p on qp.pointid=p.pointid
65
-        where qp.questionid=#{questionid} order by p.pointorder
65
+        where
66
+        <if test="qlevel==1">
67
+            qp.questionid=#{questionid}
68
+        </if>
69
+        <if test="qlevel==3">
70
+            qp.questionid=#{questionpid}
71
+        </if>
72
+        order by p.pointorder
66
     </select>
73
     </select>
67
 
74
 
68
     <!--试卷题型试题信息(附件)-->
75
     <!--试卷题型试题信息(附件)-->
109
             <result column="optionnum" property="optionnum"></result>
116
             <result column="optionnum" property="optionnum"></result>
110
             <result column="coord" property="coord"></result>
117
             <result column="coord" property="coord"></result>
111
             <result column="gnum" property="gnum"></result>
118
             <result column="gnum" property="gnum"></result>
112
-            <result column="qoption" property="qoption"></result>
119
+            <result column="height" property="height"></result>
120
+            <result column="queshtml" property="queshtml"></result>
113
         </collection>
121
         </collection>
114
     </resultMap>
122
     </resultMap>
115
 
123
 
116
     <!--制作答题卡时获取试卷中试题-->
124
     <!--制作答题卡时获取试卷中试题-->
117
     <select id="listPaperqtypeQuestionsForScan" resultMap="qtypesQuestionsForScan">
125
     <select id="listPaperqtypeQuestionsForScan" resultMap="qtypesQuestionsForScan">
118
-        select t.eptname ,t.ctype,t.eptnum,t.eptorder,t.eptscore,
119
-        tq.eptqid,tq.ctype qctype,tq.score,tq.qorder,tq.qn,tq.optionnum,tq.coord,tq.gnum,q.qoption
126
+        select t.eptname,t.ctype,t.eptnum,t.eptorder,t.eptscore,tq.eptqid,tq.ctype qctype,tq.score,
127
+        tq.qorder,tq.qn,tq.optionnum,tq.coord,tq.gnum,tq.height,tq.queshtml
120
         from e_paper_qtype_question tq  left join e_paper_qtype t on t.eptid=tq.eptid
128
         from e_paper_qtype_question tq  left join e_paper_qtype t on t.eptid=tq.eptid
121
-        left join t_question q on tq.questionid=q.questionid
122
-        where t.epid=#{epid} order by t.eptorder,tq.qorder,q.sorder
129
+        where t.epid=#{epid} order by t.eptorder,tq.qorder
123
     </select>
130
     </select>
124
 
131
 
125
     <!--保存试题正确答案-->
132
     <!--保存试题正确答案-->

+ 75
- 0
sexam/src/main/resources/mapper/paper/EPaperQtypeQuestionMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sexam.mapper.paper.EPaperQtypeQuestionMapper">
4
+
5
+    <!--保存试题正确答案-->
6
+    <update id="updateBatchQuestionAnswer">
7
+        update e_paper_qtype_question set
8
+        <trim prefix="answer=case" suffix="end">
9
+            <foreach collection="list" item="q">
10
+                when eptqid=#{q.eptqid} then #{q.answer}
11
+            </foreach>
12
+        </trim>
13
+        <where>
14
+            <foreach collection="list" item="q" separator="or">
15
+                eptqid=#{q.eptqid}
16
+            </foreach>
17
+        </where>
18
+    </update>
19
+
20
+    <!--保存试卷答题卡坐标-->
21
+    <update id="updateBatchQuestionForScan">
22
+        update e_paper_qtype_question
23
+        <trim prefix="set" suffixOverrides=",">
24
+            <trim prefix="coord = case" suffix="end,">
25
+                <foreach collection="list" item="q">
26
+                    when eptqid=#{q.eptqid} then #{q.coord}
27
+                </foreach>
28
+            </trim>
29
+            <trim prefix="gnum = case" suffix="end,">
30
+                <foreach collection="list" item="q">
31
+                    when eptqid=#{q.eptqid} then #{q.gnum}
32
+                </foreach>
33
+            </trim>
34
+            <trim prefix="height = case" suffix="end,">
35
+                <foreach collection="list" item="q">
36
+                    when eptqid=#{q.eptqid} then #{q.height}
37
+                </foreach>
38
+            </trim>
39
+            <trim prefix="queshtml = case" suffix="end,">
40
+                <foreach collection="list" item="q">
41
+                    when eptqid=#{q.eptqid} then #{q.queshtml}
42
+                </foreach>
43
+            </trim>
44
+        </trim>
45
+        <where>
46
+            <foreach collection="list" item="q" separator="or">
47
+                eptqid=#{q.eptqid}
48
+            </foreach>
49
+        </where>
50
+    </update>
51
+
52
+    <!--保存主观题选项数量-->
53
+    <update id="updateBatchQuestionOptionnum">
54
+        update e_paper_qtype_question
55
+        <trim prefix="set" suffixOverrides=",">
56
+            <trim prefix="optionnum = case" suffix="end,">
57
+                <foreach collection="list" item="q">
58
+                    when eptqid=#{q.eptqid} then #{q.optionnum}
59
+                </foreach>
60
+            </trim>
61
+        </trim>
62
+        <where>
63
+            <foreach collection="list" item="q" separator="or">
64
+                eptqid=#{q.eptqid}
65
+            </foreach>
66
+        </where>
67
+    </update>
68
+
69
+    <!--试卷中所有试题基础信息-->
70
+    <select id="listQuestionsByEpid" resultType="com.xhkjedu.sexam.model.paper.EPaperQtypeQuestion">
71
+        select * from e_paper_qtype_question where epid=#{epid} order by qorder
72
+    </select>
73
+
74
+
75
+</mapper>

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

20
     @Test
20
     @Test
21
     void contextLoads() {
21
     void contextLoads() {
22
         EPaper ePaper = new EPaper();
22
         EPaper ePaper = new EPaper();
23
-        ePaper.setEpid(68);
24
-        ePaper.setPnum(15);
25
-        ePaper.setPscore(172.0);
23
+        ePaper.setEpid(289);
24
+        ePaper.setPnum(7);
25
+        ePaper.setPscore(80.0);
26
 
26
 
27
-        ePaperQtypeService.chandleScantronFile(156);
27
+        ePaperQtypeService.savePaperAnalyzeForQuestion(ePaper);
28
     }
28
     }
29
 
29
 
30
 }
30
 }

+ 2
- 3
sstudy/src/main/java/com/xhkjedu/sstudy/service/question/UserBasketService.java View File

69
                 List<QuestionVo> questions = b.getQuestions();
69
                 List<QuestionVo> questions = b.getQuestions();
70
 
70
 
71
                 List<QuestionVo> tllist = questions.stream().filter( o -> o.getHashear() ==1).collect(Collectors.toList());
71
                 List<QuestionVo> tllist = questions.stream().filter( o -> o.getHashear() ==1).collect(Collectors.toList());
72
-                if(N_Utils.isNotEmpty(tllist)){
72
+                if(N_Utils.isListNotEmpty(tllist)){
73
                     hearqs.addAll(tllist);
73
                     hearqs.addAll(tllist);
74
 
74
 
75
                     questions = questions.stream().filter( o -> o.getHashear() ==0).collect(Collectors.toList());
75
                     questions = questions.stream().filter( o -> o.getHashear() ==0).collect(Collectors.toList());
80
                 b.setQuestions(questions);
80
                 b.setQuestions(questions);
81
             }
81
             }
82
 
82
 
83
-            if(N_Utils.isNotEmpty(hearqs)){
83
+            if(N_Utils.isListNotEmpty(hearqs)){
84
                 UserBasketVo tlvo = new UserBasketVo();
84
                 UserBasketVo tlvo = new UserBasketVo();
85
                 tlvo.setQtypename("听力题");
85
                 tlvo.setQtypename("听力题");
86
                 tlvo.setPtnum(hearqs.size());
86
                 tlvo.setPtnum(hearqs.size());
88
                 tlvo.setPtscore(scoretotal);
88
                 tlvo.setPtscore(scoretotal);
89
                 tlvo.setQuestions(hearqs);
89
                 tlvo.setQuestions(hearqs);
90
                 baskets.add(0,tlvo);
90
                 baskets.add(0,tlvo);
91
-
92
             }
91
             }
93
         }else{
92
         }else{
94
             for (UserBasketVo b : baskets) {
93
             for (UserBasketVo b : baskets) {

+ 5
- 2
sstudy/src/main/resources/mapper/question/QuestionMapper.xml View File

245
         <if test="question.pointid!=null and question.pointid!='0'.toString() and question.pointid!=''">
245
         <if test="question.pointid!=null and question.pointid!='0'.toString() and question.pointid!=''">
246
             and qp.pointid=#{question.pointid}
246
             and qp.pointid=#{question.pointid}
247
         </if>
247
         </if>
248
-        <if test="question.qtypeid!=null and question.qtypeid!='0'.toString() and question.qtypeid!=''">
249
-            and q.qtypeid=#{question.qtypeid}
248
+        <if test="question.hashear!=null and question.hashear == 1">
249
+            and q.hashear=1
250
+        </if>
251
+        <if test="question.hashear!=1 and question.qtypeid!=null and question.qtypeid!='0'.toString() and question.qtypeid!=''">
252
+            and q.hashear=0 and q.qtypeid=#{question.qtypeid}
250
         </if>
253
         </if>
251
         <if test="question.complexity!=null and question.complexity!=0">
254
         <if test="question.complexity!=null and question.complexity!=0">
252
             and q.complexity=#{question.complexity}
255
             and q.complexity=#{question.complexity}

Loading…
Cancel
Save