|
@@ -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
|
}
|