|
@@ -59,10 +59,10 @@ public class EReportGenerateQuestionService {
|
59
|
59
|
@Resource
|
60
|
60
|
private ERStudentComplexityMapper erStudentComplexityMapper;
|
61
|
61
|
|
62
|
|
- public void setClassQuestion(Integer examid, List<Map> subjects, List<Map> classes, EBase base) {
|
|
62
|
+ public void setClassQuestion(Integer examid, List<Map> subjects, List<Map> classes, EBase base){
|
63
|
63
|
Integer stuzero = base.getStuzero();//0分学生是否参与统计0不统计1统计(默认)
|
64
|
64
|
// 考试所有学生提交试卷作答情况 2023-12-27添加0分学生是否参与统计
|
65
|
|
- List<EPaperStudentQuestion> stulist = ePaperStudentQuestionMapper.listExamStudentsAnswer(examid,stuzero);
|
|
65
|
+ List<EPaperStudentQuestion> stulist = ePaperStudentQuestionMapper.listExamStudentsAnswer(examid);
|
66
|
66
|
if (N_Utils.isListNotEmpty(stulist)) {
|
67
|
67
|
List<ERclassQtype> rtypelist = new ArrayList<>();// 班级题型
|
68
|
68
|
List<ERStudentQtype> stutypelist = new ArrayList<>();// 学生题型
|
|
@@ -105,7 +105,7 @@ public class EReportGenerateQuestionService {
|
105
|
105
|
// 处理题型及题型下试题:附件显示题号为qn(order)作为排序使用
|
106
|
106
|
String qtypejson = panalyze.get("qnumjson").toString();// 原试卷题型分析
|
107
|
107
|
List<Map> qtypelist = JSON.parseArray(qtypejson, Map.class);
|
108
|
|
- setPaperQuestionFjQtypes(qtypelist, paperstulist, rtypelist, rqueslist, stutypelist, examPaperClassVo);
|
|
108
|
+ setPaperQuestionFjQtypes(qtypelist, paperstulist, rtypelist, rqueslist, stutypelist, examPaperClassVo,stuzero);
|
109
|
109
|
}
|
110
|
110
|
}
|
111
|
111
|
}
|
|
@@ -268,7 +268,7 @@ public class EReportGenerateQuestionService {
|
268
|
268
|
|
269
|
269
|
// 题型、试题、知识点、难易度--附件题型
|
270
|
270
|
private void setPaperQuestionFjQtypes(List<Map> qtypelist, List<EPaperStudentQuestion> paperstulist, List<ERclassQtype> rtypelist, List<ERclassQuestion> rqueslist,
|
271
|
|
- List<ERStudentQtype> stutypelist, ExamPaperClassVo examPaperClassVo) {
|
|
271
|
+ List<ERStudentQtype> stutypelist, ExamPaperClassVo examPaperClassVo,Integer stuzero) {
|
272
|
272
|
List<Map> classes = examPaperClassVo.getClasses();
|
273
|
273
|
for (int k = 0; k < qtypelist.size(); k++) {
|
274
|
274
|
Map qtypemap = qtypelist.get(k);
|
|
@@ -295,102 +295,144 @@ public class EReportGenerateQuestionService {
|
295
|
295
|
|
296
|
296
|
for (int q = 0; q < eptqids.size(); q++) {
|
297
|
297
|
Integer eptqid = eptqids.get(q);
|
298
|
|
- // 获取改题所有学生作答情况
|
299
|
|
- List<EPaperStudentQuestion> qgstulist = paperstulist.stream().filter(s -> s.getEptqid().equals(eptqid)).collect(Collectors.toList());
|
|
298
|
+ //所有学生,包含0分的
|
|
299
|
+ List<EPaperStudentQuestion> qgstulistZero = paperstulist.stream().filter(s -> s.getEptqid().equals(eptqid)).collect(Collectors.toList());
|
|
300
|
+ EPaperStudentQuestion ePaperStudentQuestion = qgstulistZero.get(0);//获取第一个对象用于后续生成
|
|
301
|
+
|
|
302
|
+ // 获取该题所有学生作答情况
|
|
303
|
+ List<EPaperStudentQuestion> qgstulist = new ArrayList<>();
|
|
304
|
+ if(stuzero == 0){//如果为0:0分学生不参与统计
|
|
305
|
+ qgstulist = qgstulistZero.stream().filter(s -> s.getStupaperscore() > 0).collect(Collectors.toList());
|
|
306
|
+
|
|
307
|
+ }else{
|
|
308
|
+ //1:0分学生参与统计
|
|
309
|
+ qgstulist.addAll(qgstulistZero);
|
|
310
|
+ }
|
300
|
311
|
gstunum = qgstulist.size();
|
301
|
|
- EPaperStudentQuestion qgmaxstu = qgstulist.stream().max(Comparator.comparing(EPaperStudentQuestion::getStuscore)).get();
|
302
|
|
- Double qgscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
|
303
|
|
- qgscore = N_Utils.formatDouble(qgscore, 1);
|
304
|
|
- Double qgstuscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
|
305
|
|
- qgstuscore = N_Utils.formatDouble(qgstuscore, 1);
|
306
|
|
- Double qgavgscore = N_Utils.getDoubleDivideForAvg(qgstuscore, gstunum);// 年级平均分
|
307
|
|
- Double qgsrate = N_Utils.getDoubleDivideAndMulitiply(qgstuscore, qgscore);
|
308
|
|
- tgscore = ExamUtil.add(tgscore, qgscore);
|
309
|
|
- tgstuscore = ExamUtil.add(tgstuscore, qgstuscore);
|
|
312
|
+
|
|
313
|
+ EPaperStudentQuestion qgmaxstu = null;
|
|
314
|
+ Double qgscore = 0D;
|
|
315
|
+ Double qgstuscore = 0D;
|
|
316
|
+ Double qgavgscore = 0D;
|
|
317
|
+ Double qgsrate = 0D;
|
|
318
|
+ if(gstunum > 0){
|
|
319
|
+ qgmaxstu = qgstulist.stream().max(Comparator.comparing(EPaperStudentQuestion::getStuscore)).get();
|
|
320
|
+ qgscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
|
|
321
|
+ qgscore = N_Utils.formatDouble(qgscore, 1);
|
|
322
|
+ qgstuscore = qgstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
|
|
323
|
+ qgstuscore = N_Utils.formatDouble(qgstuscore, 1);
|
|
324
|
+
|
|
325
|
+ qgavgscore = N_Utils.getDoubleDivideForAvg(qgstuscore, gstunum);// 年级平均分
|
|
326
|
+
|
|
327
|
+ qgsrate = N_Utils.getDoubleDivideAndMulitiply(qgstuscore, qgscore);
|
|
328
|
+ tgscore = ExamUtil.add(tgscore, qgscore);
|
|
329
|
+ tgstuscore = ExamUtil.add(tgstuscore, qgstuscore);
|
|
330
|
+ }
|
310
|
331
|
|
311
|
332
|
// 处理试题班级学生作答
|
312
|
333
|
for (Map classm : classes) {
|
313
|
334
|
Integer classid = Integer.parseInt(classm.get("classid").toString());
|
314
|
335
|
List<EPaperStudentQuestion> qcstulist = qgstulist.stream().filter(s -> s.getClassid().equals(classid)).collect(Collectors.toList());
|
315
|
|
- if (N_Utils.isListNotEmpty(qcstulist)) {
|
316
|
|
- int cstunum = qcstulist.size();// 班级下试题作答学生数量
|
317
|
|
- EPaperStudentQuestion qcmaxstu = qcstulist.stream().max(Comparator.comparing(EPaperStudentQuestion::getStuscore)).get();
|
318
|
|
- Double qcscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
|
|
336
|
+ List<EPaperStudentQuestion> qcstulistZero = qgstulistZero.stream().filter(s -> s.getClassid().equals(classid)).collect(Collectors.toList());
|
|
337
|
+
|
|
338
|
+ int cstunum = qcstulist.size();//// 班级下试题作答学生数量
|
|
339
|
+ EPaperStudentQuestion qcmaxstu = null;
|
|
340
|
+ Double qcscore = 0D;
|
|
341
|
+ Double qcstuscore = 0D;
|
|
342
|
+ Double qcavgscore = 0D;
|
|
343
|
+ Double qcsrate = 0D;
|
|
344
|
+ if(cstunum>0){
|
|
345
|
+ qcmaxstu = qcstulist.stream().max(Comparator.comparing(EPaperStudentQuestion::getStuscore)).get();
|
|
346
|
+ qcscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getQscore).sum();
|
319
|
347
|
qcscore = N_Utils.formatDouble(qcscore, 1);
|
320
|
|
- Double qcstuscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
|
|
348
|
+ qcstuscore = qcstulist.stream().mapToDouble(EPaperStudentQuestion::getStuscore).sum();
|
321
|
349
|
qcstuscore = N_Utils.formatDouble(qcstuscore, 1);
|
322
|
|
- Double qcavgscore = N_Utils.getDoubleDivideForAvg(qcstuscore, cstunum);
|
323
|
|
- Double qcsrate = N_Utils.getDoubleDivideAndMulitiply(qcstuscore, qcscore);
|
|
350
|
+ qcavgscore=N_Utils.getDoubleDivideForAvg(qcstuscore, cstunum);
|
|
351
|
+ qcsrate = N_Utils.getDoubleDivideAndMulitiply(qcstuscore, qcscore);
|
|
352
|
+ }
|
324
|
353
|
|
325
|
|
- // 班级单题情况
|
326
|
|
- ERclassQuestion ercq = new ERclassQuestion();
|
327
|
|
- ercq.setCtype(qcstulist.get(0).getCtype());
|
328
|
|
- ercq.setExamid(examPaperClassVo.getExamid());
|
329
|
|
- ercq.setClassid(classid);
|
330
|
|
- ercq.setSubjectid(examPaperClassVo.getSubjectid());
|
331
|
|
- ercq.setEpid(examPaperClassVo.getEpid());
|
332
|
|
- ercq.setEptqid(eptqid);
|
333
|
|
- ercq.setQn(qns.get(q));
|
334
|
|
- ercq.setQorder(orders.get(q));
|
335
|
|
- ercq.setScore(scores.get(q));
|
336
|
|
- ercq.setQtypename(qtypenames.get(q));
|
337
|
|
- ercq.setClassscore(qcstuscore);
|
|
354
|
+ // 班级单题情况
|
|
355
|
+ ERclassQuestion ercq = new ERclassQuestion();
|
|
356
|
+ ercq.setCtype(ePaperStudentQuestion.getCtype());
|
|
357
|
+ ercq.setExamid(examPaperClassVo.getExamid());
|
|
358
|
+ ercq.setClassid(classid);
|
|
359
|
+ ercq.setSubjectid(examPaperClassVo.getSubjectid());
|
|
360
|
+ ercq.setEpid(examPaperClassVo.getEpid());
|
|
361
|
+ ercq.setEptqid(eptqid);
|
|
362
|
+ ercq.setQn(qns.get(q));
|
|
363
|
+ ercq.setQorder(orders.get(q));
|
|
364
|
+ ercq.setScore(scores.get(q));
|
|
365
|
+ ercq.setQtypename(qtypenames.get(q));
|
|
366
|
+ ercq.setClassscore(qcstuscore);
|
|
367
|
+ if(qcmaxstu == null){
|
|
368
|
+ ercq.setClassmaxscore(0D);
|
|
369
|
+ }else{
|
338
|
370
|
ercq.setClassmaxscore(qcmaxstu.getStuscore());
|
339
|
|
- ercq.setClassavgscore(qcavgscore);
|
340
|
|
- ercq.setClasssrate(qcsrate);
|
341
|
|
- ercq.setClassratetype(ExamUtil.getScoreRateType(qcsrate));
|
342
|
|
- ercq.setGradescore(qgstuscore);
|
|
371
|
+ }
|
|
372
|
+ ercq.setClassavgscore(qcavgscore);
|
|
373
|
+ ercq.setClasssrate(qcsrate);
|
|
374
|
+ ercq.setClassratetype(ExamUtil.getScoreRateType(qcsrate));
|
|
375
|
+ ercq.setGradescore(qgstuscore);
|
|
376
|
+ if(qgmaxstu == null){
|
|
377
|
+ ercq.setGrademaxscore(0D);
|
|
378
|
+ }else{
|
343
|
379
|
ercq.setGrademaxscore(qgmaxstu.getStuscore());
|
344
|
|
- ercq.setGradeavgscore(qgavgscore);
|
345
|
|
- ercq.setGradesrate(qgsrate);
|
346
|
|
- // 处理单选题选项情况
|
347
|
|
- Map stuansmap = setPaperQuestionsForStuAnswer(qcstulist);
|
348
|
|
- ercq.setFullscorenum(N_Utils.str2Int(stuansmap.get("fullscorenum").toString()));
|
349
|
|
- ercq.setAnswerjson(stuansmap.get("answerlist").toString());
|
350
|
|
- if (N_Utils.isNotEmpty(stuansmap.get("goodlist"))) {
|
351
|
|
- ercq.setGoodstujson(stuansmap.get("goodlist").toString());
|
352
|
|
- }
|
353
|
|
- if (N_Utils.isNotEmpty(stuansmap.get("badlist"))) {
|
354
|
|
- ercq.setBadstujson(stuansmap.get("badlist").toString());
|
355
|
|
- }
|
356
|
|
- if (N_Utils.isNotEmpty(stuansmap.get("erroroption"))) {
|
357
|
|
- ercq.setErroroption(stuansmap.get("erroroption").toString());
|
358
|
|
- } else {
|
359
|
|
- ercq.setErroroption("");
|
360
|
|
- }
|
361
|
|
- rqueslist.add(ercq);// 单个试题统计
|
|
380
|
+ }
|
362
|
381
|
|
363
|
|
- if (tclassmap.containsKey(classid)) {
|
364
|
|
- ERClassScoreVo erClassScoreVo = tclassmap.get(classid);
|
365
|
|
- erClassScoreVo.setStuscore(ExamUtil.add(erClassScoreVo.getStuscore(), qcstuscore));
|
366
|
|
- erClassScoreVo.setCscore(ExamUtil.add(erClassScoreVo.getCscore(), qcscore));
|
367
|
|
- } else {
|
368
|
|
- ERClassScoreVo erClassScoreVo = new ERClassScoreVo();
|
369
|
|
- erClassScoreVo.setStunum(cstunum);
|
370
|
|
- erClassScoreVo.setStuscore(qcstuscore);
|
371
|
|
- erClassScoreVo.setCscore(qcscore);
|
372
|
|
- tclassmap.put(classid, erClassScoreVo);
|
373
|
|
- }
|
|
382
|
+ ercq.setGradeavgscore(qgavgscore);
|
|
383
|
+ ercq.setGradesrate(qgsrate);
|
374
|
384
|
|
375
|
|
- for (EPaperStudentQuestion psq : qcstulist) {
|
376
|
|
- if (tstumap.containsKey(psq.getStudentid())) {
|
377
|
|
- ERStudentQtype sq = tstumap.get(psq.getStudentid());
|
378
|
|
- sq.setStuscore(ExamUtil.add(sq.getStuscore(), psq.getStuscore()));
|
379
|
|
- } else {
|
380
|
|
- ERStudentQtype sq = new ERStudentQtype();
|
381
|
|
- sq.setClassid(psq.getClassid());
|
382
|
|
- sq.setStudentid(psq.getStudentid());
|
383
|
|
- sq.setStuscore(psq.getStuscore());
|
384
|
|
- tstumap.put(psq.getStudentid(), sq);
|
385
|
|
- }
|
|
385
|
+ // 处理单选题选项情况
|
|
386
|
+ Map stuansmap = setPaperQuestionsForStuAnswer(qcstulistZero);
|
|
387
|
+ ercq.setFullscorenum(N_Utils.str2Int(stuansmap.get("fullscorenum").toString()));
|
|
388
|
+ ercq.setAnswerjson(stuansmap.get("answerlist").toString());
|
|
389
|
+ if (N_Utils.isNotEmpty(stuansmap.get("goodlist"))) {
|
|
390
|
+ ercq.setGoodstujson(stuansmap.get("goodlist").toString());
|
|
391
|
+ }
|
|
392
|
+ if (N_Utils.isNotEmpty(stuansmap.get("badlist"))) {
|
|
393
|
+ ercq.setBadstujson(stuansmap.get("badlist").toString());
|
|
394
|
+ }
|
|
395
|
+ if (N_Utils.isNotEmpty(stuansmap.get("erroroption"))) {
|
|
396
|
+ ercq.setErroroption(stuansmap.get("erroroption").toString());
|
|
397
|
+ } else {
|
|
398
|
+ ercq.setErroroption("");
|
|
399
|
+ }
|
|
400
|
+
|
|
401
|
+ rqueslist.add(ercq);// 单个试题统计
|
|
402
|
+
|
|
403
|
+ if (tclassmap.containsKey(classid)) {
|
|
404
|
+ ERClassScoreVo erClassScoreVo = tclassmap.get(classid);
|
|
405
|
+ erClassScoreVo.setStuscore(ExamUtil.add(erClassScoreVo.getStuscore(), qcstuscore));
|
|
406
|
+ erClassScoreVo.setCscore(ExamUtil.add(erClassScoreVo.getCscore(), qcscore));
|
|
407
|
+ } else {
|
|
408
|
+ ERClassScoreVo erClassScoreVo = new ERClassScoreVo();
|
|
409
|
+ erClassScoreVo.setStunum(cstunum);
|
|
410
|
+ erClassScoreVo.setStuscore(qcstuscore);
|
|
411
|
+ erClassScoreVo.setCscore(qcscore);
|
|
412
|
+ tclassmap.put(classid, erClassScoreVo);
|
|
413
|
+ }
|
|
414
|
+
|
|
415
|
+ for (EPaperStudentQuestion psq : qcstulistZero) {
|
|
416
|
+ if (tstumap.containsKey(psq.getStudentid())) {
|
|
417
|
+ ERStudentQtype sq = tstumap.get(psq.getStudentid());
|
|
418
|
+ sq.setStuscore(ExamUtil.add(sq.getStuscore(), psq.getStuscore()));
|
|
419
|
+ } else {
|
|
420
|
+ ERStudentQtype sq = new ERStudentQtype();
|
|
421
|
+ sq.setClassid(psq.getClassid());
|
|
422
|
+ sq.setStudentid(psq.getStudentid());
|
|
423
|
+ sq.setStuscore(psq.getStuscore());
|
|
424
|
+ tstumap.put(psq.getStudentid(), sq);
|
386
|
425
|
}
|
387
|
426
|
}
|
388
|
427
|
}
|
389
|
428
|
}
|
390
|
429
|
|
391
|
|
- Double tgavgscore = N_Utils.getDoubleDivideForAvg(tgstuscore, gstunum);// 题型下年级平均分
|
392
|
|
- Double tgsrate = N_Utils.getDoubleDivideAndMulitiply(tgstuscore, tgscore);// 年级得分率
|
|
430
|
+ Double tgavgscore = 0D;
|
|
431
|
+ if(gstunum >0){
|
|
432
|
+ tgavgscore = N_Utils.getDoubleDivideForAvg(tgstuscore, gstunum);// 题型下年级平均分
|
|
433
|
+ }
|
393
|
434
|
|
|
435
|
+ Double tgsrate = N_Utils.getDoubleDivideAndMulitiply(tgstuscore, tgscore);// 年级得分率
|
394
|
436
|
// 题型--班级得分
|
395
|
437
|
for (Map.Entry<Integer, ERClassScoreVo> entry : tclassmap.entrySet()) {
|
396
|
438
|
ERClassScoreVo erClassScoreVo = entry.getValue();
|
|
@@ -408,12 +450,21 @@ public class EReportGenerateQuestionService {
|
408
|
450
|
eRclassQtype.setGradeavgscore(tgavgscore);
|
409
|
451
|
eRclassQtype.setGradesrate(tgsrate);
|
410
|
452
|
eRclassQtype.setClassscore(erClassScoreVo.getStuscore());
|
411
|
|
- eRclassQtype.setClassavgscore(N_Utils.getDoubleDivideForAvg(erClassScoreVo.getStuscore(), erClassScoreVo.getStunum()));
|
412
|
|
- eRclassQtype.setClasssrate(N_Utils.getDoubleDivideAndMulitiply(erClassScoreVo.getStuscore(), erClassScoreVo.getCscore()));
|
|
453
|
+ if(erClassScoreVo.getStunum() == 0){
|
|
454
|
+ eRclassQtype.setClassavgscore(0D);
|
|
455
|
+ }else{
|
|
456
|
+ eRclassQtype.setClassavgscore(N_Utils.getDoubleDivideForAvg(erClassScoreVo.getStuscore(), erClassScoreVo.getStunum()));
|
|
457
|
+ }
|
|
458
|
+
|
|
459
|
+ if(erClassScoreVo.getCscore() == 0){
|
|
460
|
+ eRclassQtype.setClasssrate(0D);
|
|
461
|
+ }else{
|
|
462
|
+ eRclassQtype.setClasssrate(N_Utils.getDoubleDivideAndMulitiply(erClassScoreVo.getStuscore(), erClassScoreVo.getCscore()));
|
|
463
|
+ }
|
|
464
|
+
|
413
|
465
|
eRclassQtype.setQns(qns.stream().map(String::valueOf).collect(Collectors.joining(",")));
|
414
|
466
|
rtypelist.add(eRclassQtype);
|
415
|
467
|
}
|
416
|
|
-
|
417
|
468
|
// 题型--学生得分
|
418
|
469
|
for (Map.Entry<Integer, ERStudentQtype> entry : tstumap.entrySet()) {
|
419
|
470
|
ERStudentQtype erStudentQtype = entry.getValue();
|