|
@@ -162,12 +162,7 @@ public class EPaperQtypeService {
|
162
|
162
|
if(q.getOptionnum()==null){
|
163
|
163
|
q.setOptionnum(0);
|
164
|
164
|
}
|
165
|
|
- /*Integer qorder = q.getQorder();
|
166
|
|
- if (ptype == 1 && ctype != 11) {
|
167
|
|
- q.setQn(qorder.toString());
|
168
|
|
- } else if (ptype == 1 && ctype == 11) {
|
169
|
|
- q.setQn(qorder + "." + (i + 1));
|
170
|
|
- }*/
|
|
165
|
+
|
171
|
166
|
if(q.getCtype() == 14){
|
172
|
167
|
q.setGnum(900);//语文作文格数
|
173
|
168
|
}else if(q.getCtype() == 15){
|
|
@@ -195,42 +190,50 @@ public class EPaperQtypeService {
|
195
|
190
|
}
|
196
|
191
|
|
197
|
192
|
//保存试卷分析--题库
|
198
|
|
- public void savePaperAnalyzeForQuestion(EPaper ePaper){
|
|
193
|
+ private void savePaperAnalyzeForQuestion(EPaper ePaper){
|
199
|
194
|
//保存之前先清除之前的试卷分析
|
200
|
195
|
ePaperAnalyzeMapper.deleteByEpid(ePaper.getEpid());
|
201
|
196
|
//总体分析(主观题、客观题)
|
202
|
197
|
List<EPaperQtypeVo> qtypelist = ePaperQtypeMapper.listPaperQtypeQuestions(ePaper.getEpid());//试卷题型试题信息
|
203
|
|
- List<EPaperQtypeQuestionVo> queslist = new ArrayList<>();//试卷中所有试题(子题)
|
204
|
|
- List<Map> quespoints = new ArrayList<>();//试卷中所有单题和子题以及对应知识点
|
205
|
|
- List<EPaperQtypeQuestion> uplist = new ArrayList<>();//如果是客观题则获取客观题选项数量更改试卷中客观题选项数量
|
|
198
|
+ List<EPaperQtypeQuestion> uplist = new ArrayList<>();//改试卷中客观题选项数量
|
|
199
|
+ List<QuestionOrderVo> pointqlist = new ArrayList<>();//用于存放知识点,以及知识点下得分
|
|
200
|
+ List<EPaperQtypeQuestionVo> mquestions = new ArrayList<>();//存放单题和母题
|
206
|
201
|
|
207
|
202
|
//处理题型1单选题2多选题3主观题4判断对错5判断√×6判断TF7完形填空8阅读理解10任务型阅读11综合题12听力
|
208
|
203
|
List<Map> typelist = new ArrayList<>();//题型分析
|
209
|
204
|
//处理出试卷中所有试题、知识点
|
210
|
205
|
for(EPaperQtypeVo qt : qtypelist){
|
211
|
206
|
List<Integer> qorderlist = new ArrayList<>();
|
212
|
|
- for(EPaperQtypeQuestionVo q : qt.getQuestions()){
|
213
|
|
- //处理试题关联知识点
|
214
|
|
- List<Map> pointslist = q.getPoints();
|
215
|
|
- if(pointslist != null && pointslist.size()>0){
|
216
|
|
- for(Map point : pointslist){
|
217
|
|
- Map p = new HashMap();
|
218
|
|
- p.put("pointid",point.get("pointid").toString());
|
219
|
|
- p.put("pointname",point.get("pointname").toString());
|
220
|
|
- p.put("eptqid",q.getEptqid());
|
221
|
|
- p.put("order",q.getQorder());
|
222
|
|
- p.put("score",q.getScore());
|
223
|
|
- quespoints.add(p);
|
224
|
|
- }
|
225
|
|
- }
|
|
207
|
+ List<QuestionOrderVo> qtypeqlist = new ArrayList<>();
|
|
208
|
+ List<EPaperQtypeQuestionVo> tqlist = qt.getQuestions();
|
|
209
|
+ int hasmt = 0;
|
|
210
|
+ for(EPaperQtypeQuestionVo q : tqlist){
|
|
211
|
+ int ctype = q.getCtype();
|
|
212
|
+ //单题的pid设置为默认值,方便后续进行单题和母题处理
|
226
|
213
|
if(q.getQlevel()==1){
|
227
|
214
|
q.setQuestionpid("000");
|
|
215
|
+ //判断试题是否是客观题
|
|
216
|
+ if(N_Utils.isObjectiveQuestion(ctype)){
|
|
217
|
+ //判断试题是否是客观题,暂时用mctype进行标识
|
|
218
|
+ q.setMctype(111);
|
|
219
|
+ }else{
|
|
220
|
+ q.setMctype(112);
|
|
221
|
+ }
|
|
222
|
+ //设置知识点
|
|
223
|
+ mquestions.add(q);
|
|
224
|
+ //获取试题知识点
|
|
225
|
+ List<Map> qpoints = q.getPoints();
|
|
226
|
+ //处理试题知识点占分
|
|
227
|
+ setPaperQuestionPointScore(pointqlist,qpoints,q,null,null);
|
|
228
|
+ setPaperQuestionQtypeScore(qtypeqlist,q,null,null);//处理试题题型
|
|
229
|
+ }
|
|
230
|
+ if(q.getQlevel() == 3){
|
|
231
|
+ hasmt ++;
|
228
|
232
|
}
|
229
|
|
- queslist.add(q);
|
230
|
233
|
if(!qorderlist.contains(q.getQorder())){
|
231
|
234
|
qorderlist.add(q.getQorder());
|
232
|
235
|
}
|
233
|
|
- int ctype = q.getCtype();
|
|
236
|
+ //为了处理客观题中选项数量
|
234
|
237
|
if(ctype == 1 || ctype ==2 || ctype==4 || ctype ==5 || ctype==6){
|
235
|
238
|
List<String> strlst = JSON.parseArray(q.getQoption(),String.class);
|
236
|
239
|
EPaperQtypeQuestion eqq = new EPaperQtypeQuestion();
|
|
@@ -240,54 +243,66 @@ public class EPaperQtypeService {
|
240
|
243
|
}
|
241
|
244
|
}
|
242
|
245
|
|
|
246
|
+ if(hasmt > 0){
|
|
247
|
+ //说明该题型下有复合题,复合体进行知识点、题型下试题题号及id进行操作
|
|
248
|
+ Map<String,List<EPaperQtypeQuestionVo>> quesMap = tqlist.stream().collect(Collectors.groupingBy(EPaperQtypeQuestionVo:: getQuestionpid, Collectors.toList()));
|
|
249
|
+ for(Map.Entry<String, List<EPaperQtypeQuestionVo>> entry : quesMap.entrySet()){
|
|
250
|
+ if(!entry.getKey().equals("000")){
|
|
251
|
+ //说明该题为母题,
|
|
252
|
+ EPaperQtypeQuestionVo mq = new EPaperQtypeQuestionVo();
|
|
253
|
+ List<EPaperQtypeQuestionVo> sonques = entry.getValue();
|
|
254
|
+ int k = 0;//如果k大于1说明有小题是主观题,则母题为主观题
|
|
255
|
+ double score = 0;
|
|
256
|
+ for(EPaperQtypeQuestionVo sq : sonques){
|
|
257
|
+ if(!N_Utils.isObjectiveQuestion(sq.getCtype())){
|
|
258
|
+ k++;
|
|
259
|
+ }
|
|
260
|
+ score = N_Utils.getDoubleSum(score,sq.getScore());
|
|
261
|
+ }
|
|
262
|
+
|
|
263
|
+ EPaperQtypeQuestionVo qobj = sonques.get(0);
|
|
264
|
+ mq.setQuestionid(qobj.getQuestionpid());
|
|
265
|
+ mq.setComplexity(qobj.getMcomplexity());
|
|
266
|
+ mq.setQorder(qobj.getQorder());
|
|
267
|
+ mq.setScore(score);
|
|
268
|
+ if(k == 0){
|
|
269
|
+ mq.setMctype(111);
|
|
270
|
+ }else{
|
|
271
|
+ mq.setMctype(112);
|
|
272
|
+ }
|
|
273
|
+
|
|
274
|
+ mquestions.add(mq);
|
|
275
|
+ mq.setQlevel(qobj.getMqlevel());
|
|
276
|
+ //获取所有子题的试题题号
|
|
277
|
+ List<String> qns = sonques.stream().map(EPaperQtypeQuestionVo::getQn).collect(Collectors.toList());
|
|
278
|
+ String[] qnstr = qns.stream().toArray(String[]::new);
|
|
279
|
+ //所有子题的试题eptqid
|
|
280
|
+ List<Integer> eptqids = sonques.stream().map(EPaperQtypeQuestionVo::getEptqid).collect(Collectors.toList());
|
|
281
|
+ Integer[] eptqidstr = eptqids.stream().toArray(Integer[]::new);
|
|
282
|
+
|
|
283
|
+ //获取知识点
|
|
284
|
+ List<Map> qpoints = sonques.get(0).getPoints();
|
|
285
|
+ mq.setPoints(qpoints);
|
|
286
|
+ setPaperQuestionPointScore(pointqlist,qpoints,mq,qnstr,eptqidstr);
|
|
287
|
+ setPaperQuestionQtypeScore(qtypeqlist,mq,qnstr,eptqidstr);//处理试题题型
|
|
288
|
+ }
|
|
289
|
+ }
|
|
290
|
+ }
|
|
291
|
+
|
|
292
|
+ //试题题型分析数据
|
243
|
293
|
double storerate = N_Utils.getDoubleDivideAndMulitiply(qt.getEptscore(), ePaper.getPscore());
|
244
|
294
|
Map tmap = new HashMap();
|
245
|
295
|
tmap.put("qtname",qt.getEptname());
|
246
|
296
|
tmap.put("num",qt.getEptnum());
|
247
|
297
|
tmap.put("score",qt.getEptscore());
|
248
|
298
|
tmap.put("srate",storerate);
|
249
|
|
- tmap.put("qns",qorderlist);
|
|
299
|
+ tmap.put("ques",qtypeqlist);
|
250
|
300
|
typelist.add(tmap);
|
251
|
301
|
}
|
252
|
302
|
|
253
|
|
- //获取出所有单题和母题,进行判断区分
|
254
|
|
- Map<String,List<EPaperQtypeQuestionVo>> quesMap = queslist.stream().collect(Collectors.groupingBy(EPaperQtypeQuestionVo:: getQuestionpid, Collectors.toList()));
|
255
|
|
- List<EPaperQtypeQuestionVo> mquestions = new ArrayList<>();//仅存放单题和母题
|
256
|
|
- for(Map.Entry<String, List<EPaperQtypeQuestionVo>> entry : quesMap.entrySet()){
|
257
|
|
- if(entry.getKey().equals("000")){
|
258
|
|
- for(EPaperQtypeQuestionVo dq : entry.getValue()){
|
259
|
|
- if(N_Utils.isObjectiveQuestion(dq.getCtype())){
|
260
|
|
- //判断试题是否是客观题,暂时用mctype进行标识
|
261
|
|
- dq.setMctype(111);
|
262
|
|
- }else{
|
263
|
|
- dq.setMctype(112);
|
264
|
|
- }
|
265
|
|
- mquestions.add(dq);
|
266
|
|
- }
|
267
|
|
- }else{
|
268
|
|
- EPaperQtypeQuestionVo mq = new EPaperQtypeQuestionVo();
|
269
|
|
- List<EPaperQtypeQuestionVo> sonques = entry.getValue();
|
270
|
|
- int k = 0;//如果k大于1说明有小题是主观题,则母题为主观题
|
271
|
|
- double score = 0;
|
272
|
|
- for(EPaperQtypeQuestionVo sq : sonques){
|
273
|
|
- if(!N_Utils.isObjectiveQuestion(sq.getCtype())){
|
274
|
|
- k++;
|
275
|
|
- }
|
276
|
|
- score = N_Utils.getDoubleSum(score,sq.getScore());
|
277
|
|
- }
|
278
|
|
-
|
279
|
|
- EPaperQtypeQuestionVo qobj = sonques.get(0);
|
280
|
|
- mq.setQuestionid(qobj.getQuestionpid());
|
281
|
|
- mq.setComplexity(qobj.getMcomplexity());
|
282
|
|
- mq.setScore(score);
|
283
|
|
- if(k == 0){
|
284
|
|
- mq.setMctype(111);
|
285
|
|
- }else{
|
286
|
|
- mq.setMctype(112);
|
287
|
|
- }
|
288
|
|
-
|
289
|
|
- mquestions.add(mq);
|
290
|
|
- }
|
|
303
|
+ //进行客观题选项处理
|
|
304
|
+ if(N_Utils.isListNotEmpty(uplist)){
|
|
305
|
+ ePaperQtypeQuestionMapper.updateBatchQuestionOptionnum(uplist);
|
291
|
306
|
}
|
292
|
307
|
|
293
|
308
|
//试题总体分布进行分析
|
|
@@ -325,22 +340,24 @@ public class EPaperQtypeService {
|
325
|
340
|
clist.add(cmap);
|
326
|
341
|
}
|
327
|
342
|
|
328
|
|
- //知识点
|
329
|
|
- Map<String,List<Map>> pointmap = quespoints.stream().collect(Collectors.groupingBy(item -> item.get("pointid").toString(), Collectors.toList()));
|
|
343
|
+ //知识点分析
|
330
|
344
|
List<Map> pointlist = new ArrayList<>();
|
331
|
|
- for(Map.Entry<String, List<Map>> entry : pointmap.entrySet()){
|
332
|
|
- Map pm = new HashMap();
|
333
|
|
- List<Map> pvo = entry.getValue();
|
334
|
|
- double cscore = pvo.stream().collect(Collectors.summingDouble(item -> Double.valueOf(item.get("score").toString())));
|
335
|
|
- double scorerate = N_Utils.getDoubleDivideAndMulitiply(cscore, ePaper.getPscore());
|
336
|
|
- List<Integer> thlist = pvo.stream().map(item -> Integer.parseInt(item.get("order").toString())).collect(Collectors.toList());
|
337
|
|
- thlist = thlist.stream().distinct().collect(Collectors.toList());
|
338
|
|
- pm.put("pointid",pvo.get(0).get("pointid").toString());
|
339
|
|
- pm.put("pointname",pvo.get(0).get("pointname").toString());
|
340
|
|
- pm.put("score",cscore);
|
341
|
|
- pm.put("srate",scorerate);
|
342
|
|
- pm.put("order",thlist);
|
343
|
|
- pointlist.add(pm);
|
|
345
|
+ if(N_Utils.isListNotEmpty(pointqlist)){
|
|
346
|
+ Map<String,List<QuestionOrderVo>> pointmap = pointqlist.stream().collect(Collectors.groupingBy(QuestionOrderVo::getId,Collectors.toList()));
|
|
347
|
+ //根据指示进行分组,
|
|
348
|
+ for(Map.Entry<String, List<QuestionOrderVo>> entry : pointmap.entrySet()){
|
|
349
|
+ List<QuestionOrderVo> pgblist = entry.getValue();
|
|
350
|
+ //获取知识点的总分
|
|
351
|
+ Double score = pgblist.stream().mapToDouble(s -> s.getScore()).sum();
|
|
352
|
+ Double srate = N_Utils.getDoubleDivideAndMulitiply(score,ePaper.getPscore());
|
|
353
|
+ Map prate = new HashMap();
|
|
354
|
+ prate.put("pointid",entry.getKey());
|
|
355
|
+ prate.put("pointname",pgblist.get(0).getName());
|
|
356
|
+ prate.put("score",score);
|
|
357
|
+ prate.put("srate",srate);
|
|
358
|
+ prate.put("ques",pgblist);
|
|
359
|
+ pointlist.add(prate);
|
|
360
|
+ }
|
344
|
361
|
}
|
345
|
362
|
|
346
|
363
|
EPaperAnalyze epa = new EPaperAnalyze();
|
|
@@ -350,11 +367,89 @@ public class EPaperQtypeService {
|
350
|
367
|
epa.setComplexityjson(JSON.toJSONString(clist));//难易度分析
|
351
|
368
|
epa.setPointjson(JSON.toJSONString(pointlist));//知识点分析
|
352
|
369
|
ePaperAnalyzeMapper.insertUseGeneratedKeys(epa);
|
353
|
|
- if(N_Utils.isListNotEmpty(uplist)){
|
354
|
|
- ePaperQtypeQuestionMapper.updateBatchQuestionOptionnum(uplist);
|
|
370
|
+ }
|
|
371
|
+
|
|
372
|
+ //设置知识点
|
|
373
|
+ private void setPaperQuestionPointScore(List<QuestionOrderVo> pointqlist,List<Map> qpoints,EPaperQtypeQuestionVo dq,String[] qnstr,Integer[] eptqidstr){
|
|
374
|
+ if(N_Utils.isListNotEmpty(qpoints)){
|
|
375
|
+ if(qpoints.size() == 1){
|
|
376
|
+ //试题只有一个知识点
|
|
377
|
+ Map pointmap = qpoints.get(0);
|
|
378
|
+ QuestionOrderVo qpoint = new QuestionOrderVo();
|
|
379
|
+ qpoint.setId(pointmap.get("pointid").toString());
|
|
380
|
+ qpoint.setName(pointmap.get("pointname").toString());
|
|
381
|
+ qpoint.setOrder(dq.getQorder());
|
|
382
|
+ qpoint.setScore(dq.getScore());
|
|
383
|
+ qpoint.setQlevel(dq.getQlevel());
|
|
384
|
+ if(qnstr == null){
|
|
385
|
+ qpoint.setQns(new String[]{dq.getQn()});
|
|
386
|
+ }else{
|
|
387
|
+ qpoint.setQns(qnstr);
|
|
388
|
+ }
|
|
389
|
+ if(eptqidstr == null){
|
|
390
|
+ qpoint.setEptqids(new Integer[]{dq.getEptqid()});
|
|
391
|
+ }else{
|
|
392
|
+ qpoint.setEptqids(eptqidstr);
|
|
393
|
+ }
|
|
394
|
+
|
|
395
|
+ pointqlist.add(qpoint);
|
|
396
|
+ }else{
|
|
397
|
+ //试题有多个知识点
|
|
398
|
+ //计算每个知识点所占分值(平均分配)
|
|
399
|
+ Double[] avgps = ExamUtil.getPointAvgScore(qpoints.size(),dq.getScore());
|
|
400
|
+ for(int m = 0; m<qpoints.size();m++){
|
|
401
|
+ Map pointmap = qpoints.get(m);
|
|
402
|
+ QuestionOrderVo qpoint = new QuestionOrderVo();
|
|
403
|
+ qpoint.setId(pointmap.get("pointid").toString());
|
|
404
|
+ qpoint.setName(pointmap.get("pointname").toString());
|
|
405
|
+ qpoint.setOrder(dq.getQorder());
|
|
406
|
+ qpoint.setQlevel(dq.getQlevel());
|
|
407
|
+
|
|
408
|
+ if(avgps.length == 2 && (m+1) == qpoints.size()){
|
|
409
|
+ //不能整除分,并且是最后一个知识点
|
|
410
|
+ qpoint.setScore(avgps[1]);
|
|
411
|
+ }else{
|
|
412
|
+ qpoint.setScore(avgps[0]);
|
|
413
|
+ }
|
|
414
|
+
|
|
415
|
+ //题号集合
|
|
416
|
+ if(qnstr == null){
|
|
417
|
+ qpoint.setQns(new String[]{dq.getQn()});
|
|
418
|
+ }else{
|
|
419
|
+ qpoint.setQns(qnstr);
|
|
420
|
+ }
|
|
421
|
+ //试卷中试题id集合
|
|
422
|
+ if(eptqidstr == null){
|
|
423
|
+ qpoint.setEptqids(new Integer[]{dq.getEptqid()});
|
|
424
|
+ }else{
|
|
425
|
+ qpoint.setEptqids(eptqidstr);
|
|
426
|
+ }
|
|
427
|
+ pointqlist.add(qpoint);
|
|
428
|
+ }
|
|
429
|
+ }
|
355
|
430
|
}
|
356
|
431
|
}
|
357
|
432
|
|
|
433
|
+ private void setPaperQuestionQtypeScore(List<QuestionOrderVo> qtypelist,EPaperQtypeQuestionVo dq,String[] qnstr,Integer[] eptqidstr){
|
|
434
|
+ QuestionOrderVo qtype = new QuestionOrderVo();
|
|
435
|
+ qtype.setId(dq.getQtypeid());
|
|
436
|
+ qtype.setName(dq.getQtypename());
|
|
437
|
+ qtype.setOrder(dq.getQorder());
|
|
438
|
+ qtype.setScore(dq.getScore());
|
|
439
|
+ qtype.setQlevel(dq.getQlevel());
|
|
440
|
+ if(qnstr == null){
|
|
441
|
+ qtype.setQns(new String[]{dq.getQn()});
|
|
442
|
+ }else{
|
|
443
|
+ qtype.setQns(qnstr);
|
|
444
|
+ }
|
|
445
|
+ if(eptqidstr == null){
|
|
446
|
+ qtype.setEptqids(new Integer[]{dq.getEptqid()});
|
|
447
|
+ }else{
|
|
448
|
+ qtype.setEptqids(eptqidstr);
|
|
449
|
+ }
|
|
450
|
+
|
|
451
|
+ qtypelist.add(qtype);
|
|
452
|
+ }
|
358
|
453
|
//保存试卷分析--附件
|
359
|
454
|
private void savePaperAnalyzeForFj(EPaper ePaper,List<EPaperQtype> fjtypelist,List<EPaperQtypeQuestion> queslist){
|
360
|
455
|
//保存之前先清除之前的试卷分析
|