Browse Source

题库分析

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

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

@@ -23,6 +23,7 @@ import java.util.List;
23 23
 import java.util.regex.Matcher;
24 24
 import java.util.regex.Pattern;
25 25
 import java.util.stream.Collectors;
26
+import java.util.stream.IntStream;
26 27
 
27 28
 /**
28 29
  * @author WN
@@ -1006,4 +1007,21 @@ public class N_Utils {
1006 1007
         return md5.getMD5ofStr(md5.getMD5ofStr(md5.getMD5ofStr(pwd)));
1007 1008
     }
1008 1009
 
1010
+    //处理题型中客观题
1011
+    private static int[] octypelist = new int[]{1,2,4,5,6,7,8};
1012
+    /**
1013
+     * @Description 判断ctype是否是客观题
1014
+     * @Param [ctype]
1015
+     * @Return boolean 如果是客观题返回true,否则返回主观题
1016
+     * @Author wn
1017
+     * @Date 2022/7/20 15:20
1018
+     **/
1019
+    public static boolean isObjectiveQuestion(Integer ctype){
1020
+        if(ctype != null && ctype != 0){
1021
+            return IntStream.of(octypelist).anyMatch(x -> x == ctype);
1022
+        }else{
1023
+            return false;
1024
+        }
1025
+    }
1026
+
1009 1027
 }

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperQtypeController.java View File

@@ -75,4 +75,11 @@ public class EPaperQtypeController {
75 75
         Map map = ePaperQtypeService.getPaperQtDetail(paper.getEpid());
76 76
         return new ResultVo(0,"成功获取试卷详情",map);
77 77
     }
78
+
79
+    @PostMapping("/savean")
80
+    public ResultVo saveAlype(@RequestBody EPaper paper){
81
+        N_Utils.validation(new Object[]{paper.getEpid(),"试卷id",1});
82
+        ePaperQtypeService.savePaperAnalyze(paper);
83
+        return new ResultVo(0,"成功保存试卷分析");
84
+    }
78 85
 }

+ 2
- 1
sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/EPaperQtypeMapper.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sexam.mapper.paper;
2 2
 
3 3
 import com.xhkjedu.sexam.base.TkMapper;
4 4
 import com.xhkjedu.sexam.model.paper.EPaperQtype;
5
+import com.xhkjedu.sexam.vo.paper.EPaperQtypeVo;
5 6
 import org.apache.ibatis.annotations.Param;
6 7
 
7 8
 import java.util.List;
@@ -15,5 +16,5 @@ import java.util.Map;
15 16
 public interface EPaperQtypeMapper extends TkMapper<EPaperQtype> {
16 17
 
17 18
     //题型试题详情
18
-    List<Map> listPaperQtypeQuestions(@Param("epid") Integer epid);
19
+    List<EPaperQtypeVo> listPaperQtypeQuestions(@Param("epid") Integer epid);
19 20
 }

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

@@ -1,7 +1,7 @@
1 1
 package com.xhkjedu.sexam.model.paper;
2 2
 
3 3
 import com.xhkjedu.sexam.model.BaseBean;
4
-import com.xhkjedu.sexam.vo.paper.QPointVo;
4
+import com.xhkjedu.sexam.vo.paper.EPaperQPointVo;
5 5
 import lombok.Data;
6 6
 
7 7
 import javax.persistence.Id;
@@ -50,6 +50,6 @@ public class EPaperQtypeQuestion extends BaseBean {
50 50
 
51 51
     //试题关联知识点
52 52
     @Transient
53
-    private List<QPointVo> points = new ArrayList<>();
53
+    private List<EPaperQPointVo> points = new ArrayList<>();
54 54
 
55 55
 }

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/ESubjectScantron.java View File

@@ -25,6 +25,9 @@ public class ESubjectScantron extends BaseBean {
25 25
     //试卷类型1题库2答题卡3仅答题卡
26 26
     private Integer ptype;
27 27
 
28
+    //试题处理题型
29
+    private Integer ctype;
30
+
28 31
     //试题id
29 32
     private String questionid;
30 33
 

+ 5
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/ESubjectScantronQtype.java View File

@@ -5,6 +5,8 @@ import lombok.Data;
5 5
 
6 6
 import javax.persistence.Id;
7 7
 import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+import java.util.List;
8 10
 
9 11
 @Table(name = "e_subject_scantron_qtype")
10 12
 @Data
@@ -36,4 +38,7 @@ public class ESubjectScantronQtype extends BaseBean {
36 38
 
37 39
     //创建时间
38 40
     private Integer createtime;
41
+
42
+    @Transient
43
+    private List<ESubjectScantron> questions;//试题
39 44
 }

+ 1
- 8
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperFjtypeService.java View File

@@ -99,20 +99,15 @@ public class EPaperFjtypeService {
99 99
 
100 100
     //保存题型--题型下试题
101 101
     private void saveFjtypeQuestion(EPaper paper,List<EPaperFjtype> fjtypelist){
102
-        int qorder = 1;//答题卡试题排序
103
-        int qtorder = 1;//答题卡题型排序
104
-
105 102
         List<EPaperFjtypeQuestion> saveques = new ArrayList<>();
106 103
         for(EPaperFjtype fjt : fjtypelist){
107 104
             List<EPaperFjtypeQuestion> quelist = fjt.getQuestions();//题型下试题
108 105
             fjt.setEpfjid(paper.getEpid());
109 106
             fjt.setCreateid(paper.getHandleid());
110 107
             fjt.setCreatetime(paper.getHandletime());
111
-            fjt.setEpfjorder(qtorder);
112 108
             fjt.setEpfjnum(quelist.size());
113 109
             double tscore = quelist.stream().collect(Collectors.summingDouble(EPaperFjtypeQuestion :: getScore));
114 110
             fjt.setEpfjscore(tscore);
115
-             qtorder ++;
116 111
         }
117 112
         //批量保存题型信息
118 113
         ePaperFjtypeMapper.insertList(fjtypelist);
@@ -120,8 +115,6 @@ public class EPaperFjtypeService {
120 115
             for(EPaperFjtypeQuestion q : fjt.getQuestions()){
121 116
                 q.setEpfjid(fjt.getId());
122 117
                 q.setEpid(paper.getEpid());
123
-                q.setOrder(qorder);
124
-                qorder ++;
125 118
                 saveques.add(q);
126 119
             }
127 120
         }
@@ -162,7 +155,7 @@ public class EPaperFjtypeService {
162 155
         ztmap.put("pscore",ePaper.getPscore());
163 156
         ztmap.put("ranglist",ranglist);
164 157
 
165
-        //题型分布
158
+        //题型分布(保存大题型及分组)
166 159
         List<EPaperQsVo> qtlist = new ArrayList<>();
167 160
         for(EPaperFjtype fjt : fjtypelist){
168 161
             EPaperQsVo qvo = new EPaperQsVo();

+ 92
- 37
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperQtypeService.java View File

@@ -8,16 +8,16 @@ import com.xhkjedu.sexam.mapper.paper.EPaperQtypeMapper;
8 8
 import com.xhkjedu.sexam.mapper.paper.EPaperQtypeQuestionMapper;
9 9
 import com.xhkjedu.sexam.model.exam.ESubject;
10 10
 import com.xhkjedu.sexam.model.paper.*;
11
+import com.xhkjedu.sexam.vo.paper.EPaperQPointVo;
11 12
 import com.xhkjedu.sexam.vo.paper.EPaperQsVo;
13
+import com.xhkjedu.sexam.vo.paper.EPaperQtypeQuestionVo;
14
+import com.xhkjedu.sexam.vo.paper.EPaperQtypeVo;
12 15
 import com.xhkjedu.utils.N_Utils;
13 16
 import org.springframework.stereotype.Service;
14 17
 import org.springframework.transaction.annotation.Transactional;
15 18
 
16 19
 import javax.annotation.Resource;
17
-import java.util.ArrayList;
18
-import java.util.HashMap;
19
-import java.util.List;
20
-import java.util.Map;
20
+import java.util.*;
21 21
 import java.util.stream.Collectors;
22 22
 
23 23
 /**
@@ -60,7 +60,7 @@ public class EPaperQtypeService {
60 60
         //保存题型试题信息
61 61
         savePaperQtype(paper,qtypelist);
62 62
         //保存作业分析
63
-        savePaperAnalyze(paper,qtypelist,queslist);
63
+        savePaperAnalyze(paper);
64 64
         //更加试卷状态是否需要生成分析和更改科目状态
65 65
         if(paper.getPstate()!=null && paper.getPstate() == 1){
66 66
             //如果提交试卷,更改科目状态
@@ -90,45 +90,81 @@ public class EPaperQtypeService {
90 90
 
91 91
     //保存试卷题型试题信息
92 92
     private void savePaperQtype(EPaper epaper,List<EPaperQtype> qtypelist){
93
-        int ptorder = 1;//题型排序
94
-        int qorder = 1;//试题排序
95 93
         List<EPaperQtypeQuestion> qtqs = new ArrayList<>();
96 94
         for(EPaperQtype qtype : qtypelist){
97 95
             List<EPaperQtypeQuestion> qlst = qtype.getQuestions();
98 96
             qtype.setEpid(epaper.getEpid());
99
-            qtype.setEptorder(ptorder);
100 97
             qtype.setCreateid(epaper.getHandleid());
101 98
             qtype.setCreatetime(epaper.getHandletime());
102 99
             qtype.setEptnum(qlst.size());
103 100
             Double ptscore = qlst.stream().collect(Collectors.summingDouble(EPaperQtypeQuestion::getScore));
104 101
             qtype.setEptscore(ptscore);
105
-            ptorder++;
106 102
         }
107 103
         ePaperQtypeMapper.insertList(qtypelist);//保存题型
108 104
         for(EPaperQtype qtype : qtypelist){
109 105
             for(EPaperQtypeQuestion q : qtype.getQuestions()){
110 106
                 q.setEpid(epaper.getEpid());
111 107
                 q.setEptid(qtype.getId());
112
-                q.setOrder(qorder);
113
-                qorder++;
114 108
                 qtqs.add(q);
115 109
             }
116 110
         }
117 111
         ePaperQtypeQuestionMapper.insertList(qtqs);
118 112
     }
119 113
 
120
-    //保存试卷分析
121
-    private void savePaperAnalyze(EPaper ePaper,List<EPaperQtype> qtypelist,List<EPaperQtypeQuestion> queslist){
114
+    //保存试卷分析List<EPaperQtype> qtypelist,List<EPaperQtypeQuestion> queslist
115
+    public void savePaperAnalyze(EPaper ePaper){
122 116
         //保存之前先清除之前的试卷分析
123 117
         ePaperAnalyzeMapper.deleteByEpid(ePaper.getEpid());
124 118
         //总体分析(主观题、客观题)
119
+        List<EPaperQtypeVo> qtypelist = ePaperQtypeMapper.listPaperQtypeQuestions(ePaper.getEpid());//试卷题型试题信息
120
+        List<EPaperQtypeQuestionVo> queslist = new ArrayList<>();//试卷中所有试题
121
+        List<EPaperQPointVo> quespoints = new ArrayList<>();//试卷中所有试题包含子题已经题号和对应知识点
122
+
125 123
         //处理题型1单选题2多选题3主观题4判断对错5判断√×6判断TF7完形填空8阅读理解10任务型阅读11综合题12听力
124
+        //处理出试卷中所有试题、知识点
125
+        for(EPaperQtypeVo qt : qtypelist){
126
+            for(EPaperQtypeQuestionVo q : qt.getQuestions()){
127
+                queslist.add(q);
128
+                if(q.getQlevel() == 0 && q.getHasson() == 1){
129
+                    //说明试题有子题
130
+                    /*for(EPaperQtypeQuestionVo sq : q.getSonquestions()){
131
+                        List<EPaperQPointVo> pointslist = sq.getPoints();
132
+                        if(pointslist != null && pointslist.size()>0){
133
+                            for(EPaperQPointVo point : pointslist){
134
+                                EPaperQPointVo p = new EPaperQPointVo();
135
+                                p.setPointid(point.getPointid());
136
+                                p.setPointname(point.getPointname());
137
+                                p.setQuestionid(sq.getQuestionid());
138
+                                p.setOrder(q.getOrder());
139
+                                p.setScore(sq.getScore());
140
+                                quespoints.add(p);
141
+                            }
142
+                        }
143
+                    }*/
144
+                }else{
145
+                    List<EPaperQPointVo> pointslist = q.getPoints();
146
+                    if(pointslist != null && pointslist.size()>0){
147
+                        for(EPaperQPointVo point : pointslist){
148
+                            EPaperQPointVo p = new EPaperQPointVo();
149
+                            p.setPointid(point.getPointid());
150
+                            p.setPointname(point.getPointname());
151
+                            p.setQuestionid(q.getQuestionid());
152
+                            p.setOrder(q.getOrder());
153
+                            p.setScore(q.getScore());
154
+                            quespoints.add(p);
155
+                        }
156
+                    }
157
+                }
158
+            }
159
+        }
160
+
161
+        //总体分布
126 162
         int znum = 0;
127 163
         double zscore = 0;
128 164
         int knum = 0;
129 165
         double kscore = 0;
130
-        for(EPaperQtypeQuestion q : queslist){
131
-            if(q.getCtype() == 3 || q.getCtype() == 11){
166
+        for(EPaperQtypeQuestionVo q : queslist){
167
+            if(!N_Utils.isObjectiveQuestion(q.getCtype())){
132 168
                 znum ++;
133 169
                 zscore = zscore + q.getScore();
134 170
             }else{
@@ -136,7 +172,6 @@ public class EPaperQtypeService {
136 172
                 kscore = kscore + q.getScore();
137 173
             }
138 174
         }
139
-
140 175
         double znumrate = N_Utils.getIntegerDivideAndMulitiply(znum, ePaper.getPnum());
141 176
         double knumrate = 100-znumrate;
142 177
         double zscorerate = N_Utils.getDoubleDivideAndMulitiply(zscore, ePaper.getPscore());
@@ -152,35 +187,56 @@ public class EPaperQtypeService {
152 187
         ztmap.put("ranglist",ranglist);
153 188
 
154 189
         //题型分布
155
-        List<EPaperQsVo> qtlist = new ArrayList<>();
156
-        for(EPaperQtype qt : qtypelist){
157
-            EPaperQsVo qvo = new EPaperQsVo();
158
-            qvo.setQtname(qt.getEptname());
159
-            qvo.setNum(qt.getEptnum());
160
-            qvo.setScore(qt.getEptscore());
161
-            double scorerate = N_Utils.getDoubleDivideAndMulitiply(qt.getEptscore(), ePaper.getPscore());
162
-            qvo.setSrate(scorerate);
163
-            qtlist.add(qvo);
190
+        queslist.stream().sorted(Comparator.comparing(EPaperQtypeQuestionVo::getOrder)).collect(Collectors.toList());
191
+        Map<String,List<EPaperQtypeQuestionVo>> qtypemap =  queslist.stream().collect(Collectors.groupingBy(EPaperQtypeQuestionVo:: getQtypeid, Collectors.toList()));
192
+        List<EPaperQsVo> typelist = new ArrayList<>();
193
+        for(Map.Entry<String, List<EPaperQtypeQuestionVo>> entry : qtypemap.entrySet()){
194
+            List<EPaperQtypeQuestionVo> aq = entry.getValue();
195
+            double tscore = aq.stream().collect(Collectors.summingDouble(EPaperQtypeQuestionVo:: getScore));
196
+            double storerate = N_Utils.getDoubleDivideAndMulitiply(tscore, ePaper.getPscore());
197
+            EPaperQsVo tvo = new EPaperQsVo();
198
+            tvo.setQtname(aq.get(0).getQtypename());
199
+            tvo.setNum(aq.size());
200
+            tvo.setScore(tscore);
201
+            tvo.setSrate(storerate);
202
+            typelist.add(tvo);
164 203
         }
165
-
166 204
         //难易度
167
-        Map<Integer,List<EPaperQtypeQuestion>> complxmap =  queslist.stream().collect(Collectors.groupingBy(EPaperQtypeQuestion :: getComplexity,Collectors.toList()));
205
+        Map<Integer,List<EPaperQtypeQuestionVo>> complxmap =  queslist.stream().collect(Collectors.groupingBy(EPaperQtypeQuestionVo:: getComplexity, Collectors.toList()));
168 206
         List<Map> clist = new ArrayList<>();
169
-        for(Map.Entry<Integer, List<EPaperQtypeQuestion>> entry : complxmap.entrySet()){
207
+        for(Map.Entry<Integer, List<EPaperQtypeQuestionVo>> entry : complxmap.entrySet()){
170 208
             Map cmap = new HashMap();
171 209
             cmap.put("level",entry.getKey());
172
-            List<EPaperQtypeQuestion> aq = entry.getValue();
173
-            double cscore = aq.stream().collect(Collectors.summingDouble(EPaperQtypeQuestion:: getScore));
210
+            List<EPaperQtypeQuestionVo> aq = entry.getValue();
211
+            double cscore = aq.stream().collect(Collectors.summingDouble(EPaperQtypeQuestionVo:: getScore));
174 212
             double scorerate = N_Utils.getDoubleDivideAndMulitiply(cscore, ePaper.getPscore());
213
+            cmap.put("score",cscore);
175 214
             cmap.put("srate",scorerate);
176 215
             clist.add(cmap);
177 216
         }
178 217
 
218
+        //知识点
219
+        Map<String,List<EPaperQPointVo>> pointmap =  quespoints.stream().collect(Collectors.groupingBy(EPaperQPointVo:: getPointid, Collectors.toList()));
220
+        List<Map> pointlist = new ArrayList<>();
221
+        for(Map.Entry<String, List<EPaperQPointVo>> entry : pointmap.entrySet()){
222
+            Map pm = new HashMap();
223
+            List<EPaperQPointVo> pvo = entry.getValue();
224
+            double cscore = pvo.stream().collect(Collectors.summingDouble(EPaperQPointVo:: getScore));
225
+            double scorerate = N_Utils.getDoubleDivideAndMulitiply(cscore, ePaper.getPscore());
226
+            List<Integer> thlist = pvo.stream().map(EPaperQPointVo :: getOrder).collect(Collectors.toList());
227
+            pm.put("pointname",pvo.get(0).getPointname());
228
+            pm.put("score",cscore);
229
+            pm.put("srate",scorerate);
230
+            pm.put("order",thlist);
231
+            pointlist.add(pm);
232
+        }
233
+
179 234
         EPaperAnalyze epa = new EPaperAnalyze();
180
-        epa.setEpaid(ePaper.getEpid());
181
-        epa.setAlljson(JSON.toJSONString(ztmap));
182
-        epa.setQnumjson(JSON.toJSONString(qtlist));
183
-        epa.setComplexityjson(JSON.toJSONString(clist));
235
+        epa.setEpid(ePaper.getEpid());
236
+        epa.setAlljson(JSON.toJSONString(ztmap));//总体分析
237
+        epa.setQnumjson(JSON.toJSONString(typelist));//试题栏题型分析
238
+        epa.setComplexityjson(JSON.toJSONString(clist));//难易度分析
239
+        epa.setPointjson(JSON.toJSONString(pointlist));//知识点分析
184 240
         ePaperAnalyzeMapper.insertUseGeneratedKeys(epa);
185 241
 
186 242
     }
@@ -208,7 +264,7 @@ public class EPaperQtypeService {
208 264
         //保存题型试题信息
209 265
         savePaperQtype(paper,qtypelist);
210 266
         //保存作业分析
211
-        savePaperAnalyze(paper,qtypelist,queslist);
267
+        savePaperAnalyze(paper);
212 268
         //更加试卷状态是否需要生成分析和更改科目状态
213 269
         if(paper.getPstate()!=null && paper.getPstate() == 1){
214 270
             //如果提交试卷,更改科目状态
@@ -217,7 +273,6 @@ public class EPaperQtypeService {
217 273
         }
218 274
     }
219 275
 
220
-
221 276
     /**
222 277
      * @Description  题库试卷详情
223 278
      * @Param [epid]
@@ -227,7 +282,7 @@ public class EPaperQtypeService {
227 282
      **/
228 283
     public Map getPaperQtDetail(Integer epid) {
229 284
         Map map = ePaperMapper.getExamPaperDetailByEpid(epid);//试卷信息
230
-        List<Map> fjtypelist = ePaperQtypeMapper.listPaperQtypeQuestions(epid);//试卷题型试题信息
285
+        List<EPaperQtypeVo> fjtypelist = ePaperQtypeMapper.listPaperQtypeQuestions(epid);//试卷题型试题信息
231 286
         map.put("qtypes",fjtypelist);
232 287
         return map;
233 288
     }

sexam/src/main/java/com/xhkjedu/sexam/vo/paper/QPointVo.java → sexam/src/main/java/com/xhkjedu/sexam/vo/paper/EPaperQPointVo.java View File

@@ -8,7 +8,11 @@ import lombok.Data;
8 8
  * Date 2022/7/19 10:03
9 9
  **/
10 10
 @Data
11
-public class QPointVo {
11
+public class EPaperQPointVo {
12 12
     private String pointid;//知识点id
13 13
     private String pointname;//知识点名称
14
+
15
+    private String questionid;//试题id
16
+    private double score;//分值
17
+    private Integer order;//试题排序
14 18
 }

+ 68
- 0
sexam/src/main/java/com/xhkjedu/sexam/vo/paper/EPaperQtypeQuestionVo.java View File

@@ -0,0 +1,68 @@
1
+package com.xhkjedu.sexam.vo.paper;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.ArrayList;
6
+import java.util.List;
7
+
8
+/**
9
+ * @Description 题库试卷题型下试题集合
10
+ * @Author WN
11
+ * Date 2022/7/20 14:17
12
+ **/
13
+@Data
14
+public class EPaperQtypeQuestionVo {
15
+    //考试试卷题型试题表
16
+    private Integer eptqid;
17
+
18
+    //考试试卷题型表id
19
+    private Integer eptid;
20
+
21
+    //试题id
22
+    private String questionid;
23
+
24
+    //试题分值
25
+    private Double score;
26
+
27
+    //试题排序
28
+    private Integer order;
29
+
30
+    //试题处理题型
31
+    private Integer ctype;
32
+
33
+    //试题题型
34
+    private String qtypeid;
35
+
36
+    //试题题型名称
37
+    private String qtypename;
38
+
39
+    //试题题干
40
+    private String qstem;
41
+
42
+    //试题选项
43
+    private String qoption;
44
+
45
+    //试题答案
46
+    private String qanswer;
47
+
48
+    //试题分析
49
+    private String qanalyze;
50
+
51
+    //难易度
52
+    private Integer complexity;
53
+
54
+    //试题类型0母题1子题
55
+    private Integer qlevel;
56
+
57
+    //是否包含子题0不包含1包含
58
+    private Integer hasson;
59
+
60
+    //母题id
61
+    private String questionpid;
62
+
63
+    //试题关联知识点
64
+    private List<EPaperQPointVo> points = new ArrayList<>();
65
+
66
+    //子试题集合
67
+    private List<EPaperQtypeQuestionVo> sonquestions = new ArrayList<>();
68
+}

+ 32
- 0
sexam/src/main/java/com/xhkjedu/sexam/vo/paper/EPaperQtypeVo.java View File

@@ -0,0 +1,32 @@
1
+package com.xhkjedu.sexam.vo.paper;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.ArrayList;
6
+import java.util.List;
7
+
8
+/**
9
+ * @Description 题库试卷题型
10
+ * @Author WN
11
+ * Date 2022/7/20 14:17
12
+ **/
13
+@Data
14
+public class EPaperQtypeVo {
15
+    //考试试卷题型表
16
+    private Integer eptid;
17
+
18
+    //题型名称
19
+    private String eptname;
20
+
21
+    //题型下试题数量
22
+    private Integer eptnum;
23
+
24
+    //题型排序
25
+    private Integer eptorder;
26
+
27
+    //题型下试题总分值
28
+    private Double eptscore;
29
+
30
+    //试题集合
31
+    private List<EPaperQtypeQuestionVo> questions = new ArrayList<>();
32
+}

+ 0
- 1
sexam/src/main/resources/mapper/paper/EPaperFjtypeMapper.xml View File

@@ -13,7 +13,6 @@
13 13
         <collection property="questions" ofType="java.util.Map">
14 14
             <result column="epfjqid" property="epfjqid"></result>
15 15
             <result column="epfjid" property="epfjid"></result>
16
-            <result column="epid" property="epid"></result>
17 16
             <result column="qtypeid" property="qtypeid"></result>
18 17
             <result column="qtypename" property="qtypename"></result>
19 18
             <result column="ctype" property="ctype"></result>

+ 4
- 2
sexam/src/main/resources/mapper/paper/EPaperMapper.xml View File

@@ -16,7 +16,7 @@
16 16
     <!--教师出卷列表-->
17 17
     <select id="listExamPapersByTeacherid" resultType="java.util.Map">
18 18
         select es.esid,es.subjectid,es.sdate,es.begintime,es.endtime,es.teacherid,u2.username as teachername,es.esstate,es.ptype
19
-        ,ep.epid,ep.pnum,ep.pscore,ep.answered,s.subjectname,ep.handleid,u.username as handlename,es.examid,e.examname
19
+        ,ep.epid,ep.pnum,ep.pscore,ep.answered,s.subjectname,ep.handleid,u.username as handlename,es.examid,e.examname,e.examtype
20 20
         from e_subject es left join e_paper ep on es.esid=ep.esid
21 21
         left join t_subject s on es.subjectid=s.subjectid
22 22
         left join e_base e on es.examid=e.examid
@@ -28,12 +28,14 @@
28 28
 
29 29
     <!--试卷详情-->
30 30
     <select id="getExamPaperDetailByEpid" resultType="java.util.Map">
31
-        select ep.epid,ep.examid,ep.ptype,ep.pnum,ep.pscore,ep.answered,ep.hearfile,
31
+        select ep.epid,ep.examid,e.examname,e.gradeid,e.examtype,e.exammode,e.examstate,e.monitored,ep.ptype,ep.pnum,
32
+               ep.pscore,ep.answered,ep.hearfile,u2.username teachername,
32 33
         ep.handleid,ep.handletime,s.subjectname,u.username as handlename,es.sdate,es.begintime,es.endtime
33 34
         from e_paper ep left join e_base e on ep.examid=e.examid
34 35
         left join t_subject s on ep.subjectid=s.subjectid
35 36
         left join t_user u on ep.handleid=u.userid
36 37
         left join e_subject es on ep.esid=es.esid
38
+        left join t_user u2 on es.teacherid=u2.userid
37 39
         where ep.epid=#{epid}
38 40
     </select>
39 41
 

+ 35
- 38
sexam/src/main/resources/mapper/paper/EPaperQtypeMapper.xml View File

@@ -3,14 +3,13 @@
3 3
 <mapper namespace="com.xhkjedu.sexam.mapper.paper.EPaperQtypeMapper">
4 4
 
5 5
     <!--试卷题型试题信息-->
6
-    <resultMap id="qtypeQuestions" type="java.util.Map">
6
+    <resultMap id="qtypesQuestion" type="com.xhkjedu.sexam.vo.paper.EPaperQtypeVo">
7 7
         <result column="eptid" property="eptid"></result>
8
-        <result column="epid" property="epid"></result>
9 8
         <result column="eptname" property="eptname"></result>
10 9
         <result column="eptnum" property="eptnum"></result>
11 10
         <result column="eptorder" property="eptorder"></result>
12 11
         <result column="eptscore" property="eptscore"></result>
13
-        <collection property="questions" ofType="java.util.Map" javaType="java.util.List">
12
+        <collection property="questions" ofType="com.xhkjedu.sexam.vo.paper.EPaperQtypeQuestionVo" javaType="java.util.List">
14 13
             <result column="eptqid" property="eptqid"></result>
15 14
             <result column="eptid" property="eptid"></result>
16 15
             <result column="questionid" property="questionid"></result>
@@ -26,60 +25,58 @@
26 25
             <result column="complexity" property="complexity"></result>
27 26
             <result column="qlevel" property="qlevel"></result>
28 27
             <result column="hasson" property="hasson"></result>
29
-            <collection property="points" ofType="java.util.Map" javaType="java.util.List"
28
+            <collection property="points" ofType="com.xhkjedu.sexam.vo.paper.EPaperQPointVo" javaType="java.util.List"
30 29
                         column="questionid" select="listQuestionPoints">
31 30
                 <result column="pointid" property="pointid"></result>
32 31
                 <result column="pointname" property="pointname"></result>
33 32
             </collection>
34
-            <collection property="sonquestions" ofType="java.util.Map" javaType="java.util.List"
35
-                        column="questionid=questionid" select="listSonQuestions">
36
-                <result column="questionid" property="questionid"></result>
37
-                <result column="score" property="score"></result>
38
-                <result column="order" property="order"></result>
39
-                <result column="qtypeid" property="qtypeid"></result>
40
-                <result column="qtypename" property="qtypename"></result>
41
-                <result column="ctype" property="ctype"></result>
42
-                <result column="qstem" property="qstem"></result>
43
-                <result column="qoption" property="qoption"></result>
44
-                <result column="qanswer" property="qanswer"></result>
45
-                <result column="qanalyze" property="qanalyze"></result>
46
-                <result column="complexity" property="complexity"></result>
47
-                <result column="qlevel" property="qlevel"></result>
48
-                <result column="hasson" property="hasson"></result>
49
-                <result column="questionpid" property="questionpid"></result>
50
-                <collection property="sonpoints" ofType="java.util.Map" javaType="java.util.List"
51
-                            column="questionid=questionid" select="listSonQuestionPoints">
52
-                    <result column="pointid" property="pointid"></result>
53
-                    <result column="pointname" property="pointname"></result>
54
-                </collection>
33
+            <collection property="sonquestions" ofType="com.xhkjedu.sexam.vo.paper.EPaperQtypeQuestionVo" javaType="java.util.List"
34
+                        column="questionid" select="listSonQuestions" >
55 35
             </collection>
56 36
         </collection>
57 37
     </resultMap>
58
-
59
-
60
-    <select id="listPaperQtypeQuestions" resultMap="qtypeQuestions">
61
-        select t.eptid,t.epid,t.eptname,t.eptnum,t.eptorder,t.eptscore,tq.eptqid,tq.eptid,tq.questionid,
38
+    <!--子题信息和关联知识点(题型-母题-子题-子题知识点 不能放在一个resultMap中处理不支持三层)-->
39
+    <resultMap id="qtypeSonQuestions" type="com.xhkjedu.sexam.vo.paper.EPaperQtypeQuestionVo">
40
+        <result column="questionid" property="questionid"></result>
41
+        <result column="score" property="score"></result>
42
+        <result column="order" property="order"></result>
43
+        <result column="qtypeid" property="qtypeid"></result>
44
+        <result column="qtypename" property="qtypename"></result>
45
+        <result column="ctype" property="ctype"></result>
46
+        <result column="qstem" property="qstem"></result>
47
+        <result column="qoption" property="qoption"></result>
48
+        <result column="qanswer" property="qanswer"></result>
49
+        <result column="qanalyze" property="qanalyze"></result>
50
+        <result column="complexity" property="complexity"></result>
51
+        <result column="qlevel" property="qlevel"></result>
52
+        <result column="hasson" property="hasson"></result>
53
+        <result column="questionpid" property="questionpid"></result>
54
+        <collection property="points" ofType="com.xhkjedu.sexam.vo.paper.EPaperQPointVo" javaType="java.util.List"
55
+                    column="questionid" select="listQuestionPoints">
56
+            <result column="pointid" property="pointid"></result>
57
+            <result column="pointname" property="pointname"></result>
58
+        </collection>
59
+    </resultMap>
60
+    <!--试题详情-->
61
+    <select id="listPaperQtypeQuestions" resultMap="qtypesQuestion">
62
+        select t.eptid,t.epid,t.eptname,t.eptnum,t.eptorder,t.eptscore,tq.eptqid,tq.questionid,
62 63
                tq.score,tq.order,q.qtypeid,q.qtypename,q.ctype,q.qstem,q.qoption,q.qanswer,q.qanalyze,
63
-               q.complexity,q.qlevel,q.hasson,q.questionpid
64
+               q.complexity,q.qlevel,q.hasson
64 65
         from e_paper_qtype_question tq left join e_paper_qtype t on t.eptid=tq.eptid
65 66
                              left join t_question q on tq.questionid=q.questionid
66 67
         where t.epid=#{epid} order by t.eptorder,tq.order
67 68
     </select>
68 69
     <!--试题关联知识点-->
69
-    <select id="listQuestionPoints" resultType="java.util.Map">
70
+    <select id="listQuestionPoints" resultType="com.xhkjedu.sexam.vo.paper.EPaperQPointVo">
70 71
         select qp.pointid,p.pointname from t_question_point qp
71 72
         left join t_point p on qp.pointid=p.pointid
72 73
         where qp.questionid=#{questionid} order by p.pointorder
73 74
     </select>
74 75
     <!--子题-->
75
-    <select id="listSonQuestions" resultType="java.util.Map">
76
+    <select id="listSonQuestions"  resultMap="qtypeSonQuestions">
76 77
         select q.questionid,q.qtypeid,q.qtypename,q.ctype,q.qstem,q.qoption,q.qanswer,q.qanalyze,
77
-               q.complexity,q.qlevel,q.hasson,q.questionpid from t_question q where q.questionpid=#{questionid}
78
-    </select>
79
-    <select id="listSonQuestionPoints" resultType="java.util.Map">
80
-        select qp.pointid,p.pointname from t_question_point qp
81
-        left join t_point p on qp.pointid=p.pointid
82
-        where qp.questionid=#{questionid} order by p.pointorder
78
+               q.complexity,q.qlevel,q.hasson,q.sorder,q.questionpid from t_question q
79
+        where q.questionpid=#{questionid} order by q.sorder
83 80
     </select>
84 81
     
85 82
 </mapper>

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

@@ -1,13 +1,29 @@
1 1
 package com.xhkjedu.sexam;
2 2
 
3
+import com.xhkjedu.sexam.model.paper.EPaper;
4
+import com.xhkjedu.sexam.service.paper.EPaperQtypeService;
3 5
 import org.junit.jupiter.api.Test;
4 6
 import org.springframework.boot.test.context.SpringBootTest;
5 7
 
8
+import javax.annotation.Resource;
9
+
6 10
 @SpringBootTest
7 11
 class SexamApplicationTests {
8 12
 
13
+    @Resource
14
+    private EPaperQtypeService ePaperQtypeService;
15
+
9 16
     @Test
10 17
     void contextLoads() {
18
+        EPaper epaper = new EPaper();
19
+        epaper.setEpid(5);
20
+        epaper.setPnum(4);
21
+        epaper.setPscore(50.0);
22
+        saveA(epaper);
23
+    }
24
+
25
+    private void saveA(EPaper epaper){
26
+        ePaperQtypeService.savePaperAnalyze(epaper);
11 27
     }
12 28
 
13 29
 }

+ 3
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/model/question/TQuestion.java View File

@@ -56,6 +56,9 @@ public class TQuestion extends BaseBean {
56 56
     //是否包含子题0不包含1包含
57 57
     private Integer hasson;
58 58
 
59
+    //子题排序
60
+    private Integer sorder;
61
+
59 62
     //试题对应母题id
60 63
     private String questionpid;
61 64
 

+ 10
- 4
sstudy/src/main/java/com/xhkjedu/sstudy/service/question/QuestionService.java View File

@@ -354,14 +354,12 @@ public class QuestionService {
354 354
         int timestamp = N_Utils.getSecondTimestamp();
355 355
         question.setCount(0);
356 356
         question.setQstate(1);
357
-        question.setQlevel(0);
358
-        question.setHasson(1);
359 357
         question.setBelong(4);
360 358
         question.setCreatetime(timestamp);
361 359
         String questionid = StudyUtil.getId();
362 360
         question.setQuestionid(questionid);
363 361
         saveQues.add(question);
364
-        if(question.getCtype() ==11 || question.getCtype() ==12){
362
+        if(question.getQlevel() == 0 && question.getHasson() ==1){//是母体并且包含子题
365 363
             List<TQuestion> sonques = question.getQuestions();
366 364
             for(TQuestion sq : sonques){
367 365
                 String sqid = StudyUtil.getId();
@@ -387,7 +385,15 @@ public class QuestionService {
387 385
                         p.setCreateid(question.getCreateid());
388 386
                         p.setCreatetime(timestamp);
389 387
                         p.setSchoolid(question.getSchoolid());
390
-                        saveQPoints.add(p);
388
+                        saveQPoints.add(p);//子题关联知识点
389
+
390
+                        TQuestionPoint mp = new TQuestionPoint();
391
+                        mp.setQpid(StudyUtil.getId());
392
+                        mp.setQuestionid(questionid);
393
+                        mp.setPointid(p.getPointid());
394
+                        mp.setCreateid(question.getCreateid());
395
+                        mp.setCreatetime(timestamp);
396
+                        saveQPoints.add(p);//母题关联所有子题关联知识点
391 397
                     }
392 398
                 }
393 399
             }

+ 1
- 1
sstudy/src/main/resources/mapper/paperstudent/PaperStudentMapper.xml View File

@@ -218,7 +218,7 @@
218 218
         <if test="ps.stoptime!=null and ps.stoptime!=0">
219 219
             and UNIX_TIMESTAMP(FROM_UNIXTIME(pg.starttime,'%Y%m%d'))&lt;=#{ps.stoptime}
220 220
         </if>
221
-        GROUP BY ps.psid ORDER BY pg.starttime DESC,p.createtime DESC
221
+        GROUP BY ps.psid ORDER BY pg.starttime DESC,p.createtime DESC,p.psid desc
222 222
     </select>
223 223
     <!--提交作业-->
224 224
     <update id="submitPaper">

Loading…
Cancel
Save