|
@@ -8,6 +8,7 @@ import com.xhkjedu.sstudy.mapper.paper.*;
|
8
|
8
|
import com.xhkjedu.sstudy.mapper.paperstudent.PaperStudentMapper;
|
9
|
9
|
import com.xhkjedu.sstudy.model.paper.*;
|
10
|
10
|
import com.xhkjedu.sstudy.model.paperstudent.TPaperStudent;
|
|
11
|
+import com.xhkjedu.sstudy.utils.StudyUtil;
|
11
|
12
|
import com.xhkjedu.sstudy.vo.paper.*;
|
12
|
13
|
import com.xhkjedu.sstudy.vo.paperstudent.PaperSearchVo;
|
13
|
14
|
import com.xhkjedu.sstudy.vo.question.QuestionVo;
|
|
@@ -88,7 +89,7 @@ public class PaperService {
|
88
|
89
|
//保存答题卡信息
|
89
|
90
|
savePaperScantronQtype(paper,qtypes);
|
90
|
91
|
//保存分析
|
91
|
|
- //savePaperScantronAnalyze(paperid,paper.getSchoolid());
|
|
92
|
+ savePaperScantronAnalyze(paper,qtypes,scanlist);
|
92
|
93
|
}
|
93
|
94
|
|
94
|
95
|
}catch (Exception e){
|
|
@@ -138,8 +139,7 @@ public class PaperService {
|
138
|
139
|
paperScantronQtypeMapper.deleteByPaperid(paper.getPaperid()); //保存答题卡信息
|
139
|
140
|
savePaperScantronQtype(paper, qtypes);
|
140
|
141
|
//删除分析信息
|
141
|
|
- //paperAnalyzeMapper.deleteByPaperid(paper.getPaperid());
|
142
|
|
- //savePaperScantronAnalyze(paper.getPaperid(), paper.getSchoolid()); //保存分析
|
|
142
|
+ savePaperScantronAnalyze(paper,qtypes,scanlist); //保存分析
|
143
|
143
|
|
144
|
144
|
rtn = true;
|
145
|
145
|
}
|
|
@@ -151,8 +151,6 @@ public class PaperService {
|
151
|
151
|
return rtn;
|
152
|
152
|
}
|
153
|
153
|
|
154
|
|
-
|
155
|
|
-
|
156
|
154
|
/**
|
157
|
155
|
* 保存作业
|
158
|
156
|
* @Param [paper]
|
|
@@ -219,14 +217,94 @@ public class PaperService {
|
219
|
217
|
}
|
220
|
218
|
|
221
|
219
|
//保存答题卡分析
|
222
|
|
- private Integer savePaperScantronAnalyze(Integer paperid,Integer schoolid){
|
223
|
|
- List<Map<String, Object>> list = paperScantronMapper.listQtypeAnalyze(paperid);
|
|
220
|
+ private Integer savePaperScantronAnalyze(TPaper paper,List<TPaperScantronQtype> qtypes,List<TPaperScantron> scanlist){
|
|
221
|
+ int znum = 0;
|
|
222
|
+ double zscore = 0;
|
|
223
|
+ int knum = 0;
|
|
224
|
+ double kscore = 0;
|
|
225
|
+ for(TPaperScantron q : scanlist){
|
|
226
|
+ if(N_Utils.isObjectiveQuestion(q.getCtype())){
|
|
227
|
+ knum ++;
|
|
228
|
+ kscore = kscore + q.getPsscore();
|
|
229
|
+ }else{
|
|
230
|
+ znum ++;
|
|
231
|
+ zscore = zscore + q.getPsscore();
|
|
232
|
+ }
|
|
233
|
+ }
|
|
234
|
+
|
|
235
|
+ double znumrate = N_Utils.getIntegerDivideAndMulitiply(znum, paper.getPapernum());
|
|
236
|
+ double knumrate = N_Utils.getDoubleReduce(100.0, znumrate);
|
|
237
|
+
|
|
238
|
+ double zscorerate = N_Utils.getDoubleDivideAndMulitiply(zscore, paper.getPapernum());
|
|
239
|
+ double kscorerate = N_Utils.getDoubleReduce(100.0,zscorerate);
|
|
240
|
+
|
|
241
|
+ List<Map> ranglist = new ArrayList<>();
|
|
242
|
+ Map zgmap = new TreeMap();
|
|
243
|
+ zgmap.put("qtname","主观题");
|
|
244
|
+ zgmap.put("score",zscore);
|
|
245
|
+ zgmap.put("num",znum);
|
|
246
|
+ zgmap.put("srate",zscorerate);
|
|
247
|
+ zgmap.put("nrate",znumrate);
|
|
248
|
+ ranglist.add(zgmap);
|
|
249
|
+ Map kgmap = new TreeMap();
|
|
250
|
+ kgmap.put("qtname","客观题");
|
|
251
|
+ kgmap.put("score",kscore);
|
|
252
|
+ kgmap.put("num",knum);
|
|
253
|
+ kgmap.put("srate",kscorerate);
|
|
254
|
+ kgmap.put("nrate",knumrate);
|
|
255
|
+ ranglist.add(kgmap);
|
|
256
|
+
|
|
257
|
+ Map ztmap = new TreeMap<>();
|
|
258
|
+ ztmap.put("pnum", paper.getPapernum());
|
|
259
|
+ ztmap.put("pscore",paper.getPaperscore());
|
|
260
|
+ ztmap.put("ranglist",ranglist);
|
|
261
|
+
|
|
262
|
+ //题型分布(按照名称进行分组)
|
|
263
|
+ qtypes.stream().sorted(Comparator.comparing(TPaperScantronQtype::getPstorder)).collect(Collectors.toList());
|
|
264
|
+ Map<String,List<TPaperScantronQtype>> qtypemap = qtypes.stream().collect(Collectors.groupingBy(TPaperScantronQtype:: getQtypename, Collectors.toList()));
|
|
265
|
+ List<Map> qtlist = new ArrayList<>();
|
|
266
|
+ for(Map.Entry<String, List<TPaperScantronQtype>> entry : qtypemap.entrySet()){
|
|
267
|
+ List<TPaperScantronQtype> aq = entry.getValue();
|
|
268
|
+ int num = aq.stream().mapToInt(TPaperScantronQtype::getPstnum).sum();
|
|
269
|
+ double tscore = aq.stream().collect(Collectors.summingDouble(TPaperScantronQtype:: getPstscore));
|
|
270
|
+ double storerate = N_Utils.getDoubleDivideAndMulitiply(tscore, paper.getPaperscore());
|
|
271
|
+ //获取小题题号
|
|
272
|
+ List<Integer> orderlist = new ArrayList<>();
|
|
273
|
+ List<Integer> eptqidlist = new ArrayList<>();
|
|
274
|
+ List<Double> scorelist = new ArrayList<>();
|
|
275
|
+ List<String> qnamelist = new ArrayList<>();
|
|
276
|
+ for(TPaperScantronQtype t : aq){
|
|
277
|
+ List<TPaperScantron> qlist = t.getScantrons();
|
|
278
|
+ for(TPaperScantron q : qlist){
|
|
279
|
+ orderlist.add(q.getPsorder());
|
|
280
|
+ eptqidlist.add(q.getId());
|
|
281
|
+ scorelist.add(q.getPsscore());
|
|
282
|
+ qnamelist.add(q.getQtypename());
|
|
283
|
+ }
|
|
284
|
+ }
|
|
285
|
+
|
|
286
|
+ Map anmap = new TreeMap();//题型对应试题的id和基础信息
|
|
287
|
+ anmap.put("orders",orderlist);
|
|
288
|
+ anmap.put("eptqids",eptqidlist);
|
|
289
|
+ anmap.put("scores",scorelist);
|
|
290
|
+ anmap.put("qtypenames",qnamelist);
|
|
291
|
+
|
|
292
|
+ Map tmap = new TreeMap();
|
|
293
|
+ tmap.put("qtname",entry.getKey());
|
|
294
|
+ tmap.put("qtid",aq.get(0).getPsqtypeid());
|
|
295
|
+ tmap.put("num",num);
|
|
296
|
+ tmap.put("score",tscore);
|
|
297
|
+ tmap.put("srate",storerate);
|
|
298
|
+ tmap.put("ques",anmap);
|
|
299
|
+ qtlist.add(tmap);
|
|
300
|
+ }
|
224
|
301
|
|
225
|
302
|
TPaperAnalyze paperAnalyze = new TPaperAnalyze();
|
226
|
|
- paperAnalyze.setPaperid(paperid);
|
227
|
|
- paperAnalyze.setQtypejson(JSON.toJSONString(list));
|
|
303
|
+ paperAnalyze.setPaperid(paper.getPaperid());
|
|
304
|
+ paperAnalyze.setQtypejson(JSON.toJSONString(qtlist));
|
|
305
|
+ paperAnalyze.setAlljson(JSON.toJSONString(ztmap));
|
228
|
306
|
|
229
|
|
- paperAnalyze.setSchoolid(schoolid);
|
|
307
|
+ paperAnalyzeMapper.deleteByPaperid(paper.getPaperid());//先删除原分析
|
230
|
308
|
paperAnalyzeMapper.insertUseGeneratedKeys(paperAnalyze);
|
231
|
309
|
return paperAnalyze.getId();
|
232
|
310
|
}
|
|
@@ -271,7 +349,7 @@ public class PaperService {
|
271
|
349
|
paperid = savePaper(paper);//保存作业
|
272
|
350
|
paper.setPaperid(paperid);
|
273
|
351
|
savePaperQtype(paper, qtypes);//保存作业题型信息
|
274
|
|
- //generatePaperAnalyze(paperid, paper.getSchoolid());//生成作业分析
|
|
352
|
+ generatePaperAnalyze(paper);//生成作业分析
|
275
|
353
|
}catch (Exception e){
|
276
|
354
|
log.error("保存结构性试题作业失败:" + e.getMessage());
|
277
|
355
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
@@ -402,23 +480,364 @@ public class PaperService {
|
402
|
480
|
* @Date 2020/6/10 9:57
|
403
|
481
|
* @return java.lang.Integer
|
404
|
482
|
**/
|
405
|
|
- private Integer generatePaperAnalyze(Integer paperid, Integer schoolid) {
|
406
|
|
- //1.题型统计
|
407
|
|
- List<Map<String, Object>> rateList = paperQtypeQuestionMapper.paperTypeAnalyze(paperid);
|
408
|
|
- //2.难易度统计
|
409
|
|
- List<Map<String, Object>> complexityRateList = paperQtypeQuestionMapper.complexityRateAnalyze(paperid);
|
410
|
|
- //3.知识点统计
|
411
|
|
- List<Map<String, Object>> pointRateList = paperQtypeQuestionMapper.pointRateAnalyze(paperid);
|
|
483
|
+ private Integer generatePaperAnalyze(TPaper paper) {
|
|
484
|
+ //获取是试卷试题
|
|
485
|
+ List<PaperQtypeVo> qtypelist = paperQtypeMapper.listPaperQtypeQuestions(paper.getPaperid());
|
|
486
|
+ List<QuestionOrderVo> pointqlist = new ArrayList<>();//用于存放知识点,以及知识点下得分
|
|
487
|
+ List<PaperQtypeQuesVo> mquestions = new ArrayList<>();//存放单题和母题
|
|
488
|
+ List<QuestionOrderVo> complexitylist = new ArrayList<>();//试题难易度存放试题
|
|
489
|
+ List<QuestionPointVo> quesplist = new ArrayList<>();//单题、母题对应知识点
|
|
490
|
+
|
|
491
|
+ //处理出试卷中所有试题、知识点
|
|
492
|
+ List<Map> typelist = new ArrayList<>();//题型分析
|
|
493
|
+ for(PaperQtypeVo qt : qtypelist){
|
|
494
|
+ List<Integer> qorderlist = new ArrayList<>();
|
|
495
|
+ List<QuestionOrderVo> qtypeqlist = new ArrayList<>();
|
|
496
|
+ List<PaperQtypeQuesVo> tqlist = qt.getQuelist();
|
|
497
|
+ int hasmt = 0;
|
|
498
|
+ for(PaperQtypeQuesVo q : tqlist){
|
|
499
|
+ int ctype = q.getCtype();
|
|
500
|
+ //单题的pid设置为默认值,方便后续进行单题和母题处理
|
|
501
|
+ if(q.getQlevel()==1){
|
|
502
|
+ q.setQuestionpid("000");
|
|
503
|
+ //判断试题是否是客观题
|
|
504
|
+ if(N_Utils.isObjectiveQuestion(ctype)){
|
|
505
|
+ //判断试题是否是客观题,暂时用mctype进行标识
|
|
506
|
+ q.setMctype(111);
|
|
507
|
+ }else{
|
|
508
|
+ q.setMctype(112);
|
|
509
|
+ }
|
|
510
|
+ //设置知识点
|
|
511
|
+ mquestions.add(q);
|
|
512
|
+ //获取试题知识点
|
|
513
|
+ List<Map> qpoints = q.getPoints();
|
|
514
|
+ //处理试题知识点占分
|
|
515
|
+ setPaperQuestionPointScore(pointqlist,quesplist,qpoints,q,null,null);
|
|
516
|
+ setPaperQuestionQtypeScore(qtypeqlist,q,null,null);//处理试题题型
|
|
517
|
+ setPaperQuestionComplexityScore(complexitylist,q,null,null);//处理试题难易度
|
|
518
|
+ }
|
|
519
|
+ if(q.getQlevel() == 3){
|
|
520
|
+ hasmt ++;
|
|
521
|
+ }
|
|
522
|
+ if(!qorderlist.contains(q.getPtqorder())){
|
|
523
|
+ qorderlist.add(q.getPtqorder());
|
|
524
|
+ }
|
|
525
|
+ }
|
|
526
|
+
|
|
527
|
+ if(hasmt > 0){
|
|
528
|
+ //说明该题型下有复合题,复合体进行知识点、题型下试题题号及id进行操作
|
|
529
|
+ Map<String,List<PaperQtypeQuesVo>> quesMap = tqlist.stream().collect(Collectors.groupingBy(PaperQtypeQuesVo:: getQuestionpid, Collectors.toList()));
|
|
530
|
+ for(Map.Entry<String, List<PaperQtypeQuesVo>> entry : quesMap.entrySet()){
|
|
531
|
+ if(!entry.getKey().equals("000")){
|
|
532
|
+ //说明该题为母题,
|
|
533
|
+ PaperQtypeQuesVo mq = new PaperQtypeQuesVo();
|
|
534
|
+ List<PaperQtypeQuesVo> sonques = entry.getValue();
|
|
535
|
+ int k = 0;//如果k大于1说明有小题是主观题,则母题为主观题
|
|
536
|
+ double score = 0;
|
|
537
|
+ for(PaperQtypeQuesVo sq : sonques){
|
|
538
|
+ if(!N_Utils.isObjectiveQuestion(sq.getCtype())){
|
|
539
|
+ k++;
|
|
540
|
+ }
|
|
541
|
+ score = N_Utils.getDoubleSum(score,sq.getPtqscore());
|
|
542
|
+ }
|
|
543
|
+
|
|
544
|
+ PaperQtypeQuesVo qobj = sonques.get(0);
|
|
545
|
+ mq.setQuestionid(qobj.getQuestionpid());
|
|
546
|
+ mq.setComplexity(qobj.getMcomplexity());
|
|
547
|
+ mq.setPtqorder(qobj.getPtqorder());
|
|
548
|
+ mq.setPtqscore(score);
|
|
549
|
+ mq.setQtypename(qobj.getMqtypename());
|
|
550
|
+ if(k == 0){
|
|
551
|
+ mq.setMctype(111);
|
|
552
|
+ }else{
|
|
553
|
+ mq.setMctype(112);
|
|
554
|
+ }
|
|
555
|
+ mq.setQlevel(qobj.getMqlevel());
|
|
556
|
+ mq.setSonques(sonques);
|
|
557
|
+ //获取所有子题的试题题号
|
|
558
|
+ List<String> qns = sonques.stream().map(PaperQtypeQuesVo::getQn).collect(Collectors.toList());
|
|
559
|
+ String[] qnstr = qns.stream().toArray(String[]::new);
|
|
560
|
+ //所有子题的试题eptqid
|
|
561
|
+ List<Integer> eptqids = sonques.stream().map(PaperQtypeQuesVo::getPtqid).collect(Collectors.toList());
|
|
562
|
+ Integer[] eptqidstr = eptqids.stream().toArray(Integer[]::new);
|
|
563
|
+
|
|
564
|
+ //获取知识点
|
|
565
|
+ List<Map> qpoints = sonques.get(0).getPoints();
|
|
566
|
+ mq.setPoints(qpoints);
|
|
567
|
+ mquestions.add(mq);
|
|
568
|
+ setPaperQuestionPointScore(pointqlist,quesplist,qpoints,mq,qnstr,eptqids);
|
|
569
|
+ setPaperQuestionQtypeScore(qtypeqlist,mq,qnstr,eptqidstr);//处理试题题型
|
|
570
|
+ setPaperQuestionComplexityScore(complexitylist,mq,qnstr,eptqidstr);//处理试题难易度
|
|
571
|
+ }
|
|
572
|
+ }
|
|
573
|
+ }
|
|
574
|
+
|
|
575
|
+ //试题题型分析数据
|
|
576
|
+ double storerate = N_Utils.getDoubleDivideAndMulitiply(qt.getPtscore(), paper.getPaperscore());
|
|
577
|
+ Map tmap = new TreeMap();
|
|
578
|
+ tmap.put("qtid",qt.getPtid());
|
|
579
|
+ tmap.put("qtname",qt.getQtypename());
|
|
580
|
+ tmap.put("num",qt.getPtnum());
|
|
581
|
+ tmap.put("score",qt.getPtscore());
|
|
582
|
+ tmap.put("srate",storerate);
|
|
583
|
+ qtypeqlist = qtypeqlist.stream().sorted(Comparator.comparing(QuestionOrderVo::getOrder)).collect(Collectors.toList());
|
|
584
|
+ tmap.put("ques",qtypeqlist);
|
|
585
|
+ typelist.add(tmap);
|
|
586
|
+ }
|
|
587
|
+
|
|
588
|
+ //试题总体分布进行分析
|
|
589
|
+ //客观题集合
|
|
590
|
+ List<PaperQtypeQuesVo> ktlst = mquestions.stream().filter(q->q.getMctype() == 111).collect(Collectors.toList());
|
|
591
|
+ int ktnum = ktlst.size();
|
|
592
|
+ double ktscore = ktlst.stream().collect(Collectors.summingDouble(PaperQtypeQuesVo:: getPtqscore));
|
|
593
|
+ double ktnrate = N_Utils.getIntegerDivideAndMulitiply(ktnum, paper.getPapernum());
|
|
594
|
+ double ktsrate = N_Utils.getDoubleDivideAndMulitiply(ktscore, paper.getPaperstate());
|
|
595
|
+ List<PaperQsVo> ranglist = new ArrayList<>();
|
|
596
|
+ ranglist.add(new PaperQsVo("客观题", ktscore, ktnum, ktsrate, ktnrate));
|
|
597
|
+ PaperQsVo zgq = new PaperQsVo();
|
|
598
|
+ zgq.setQtname("主观题");
|
|
599
|
+ zgq.setNum(paper.getPapernum() - ktnum);
|
|
600
|
+ zgq.setNrate(N_Utils.getDoubleReduce(100.0,ktnrate));
|
|
601
|
+ zgq.setScore(N_Utils.getDoubleReduce(paper.getPaperscore(),ktscore));
|
|
602
|
+ zgq.setSrate(N_Utils.getDoubleReduce(100.0,ktsrate));
|
|
603
|
+ ranglist.add(zgq);
|
|
604
|
+ Map ztmap = new TreeMap<>();
|
|
605
|
+ ztmap.put("pnum", paper.getPapernum());
|
|
606
|
+ ztmap.put("pscore",paper.getPaperscore());
|
|
607
|
+ ztmap.put("ranglist",ranglist);
|
|
608
|
+
|
|
609
|
+ //难易度
|
|
610
|
+ List<Map> clist = new ArrayList<>();
|
|
611
|
+ if(N_Utils.isListNotEmpty(complexitylist)){
|
|
612
|
+ Map<String,List<QuestionOrderVo>> complxmap = complexitylist.stream().collect(Collectors.groupingBy(QuestionOrderVo:: getId, Collectors.toList()));
|
|
613
|
+ for(Map.Entry<String, List<QuestionOrderVo>> entry : complxmap.entrySet()){
|
|
614
|
+ List<QuestionOrderVo> pgblist = entry.getValue();
|
|
615
|
+ Double score = pgblist.stream().mapToDouble(s -> s.getScore()).sum();
|
|
616
|
+ Double srate = N_Utils.getDoubleDivideAndMulitiply(score,paper.getPaperscore());
|
|
617
|
+ Map prate = new TreeMap();
|
|
618
|
+ prate.put("level",Integer.parseInt(entry.getKey()));
|
|
619
|
+ prate.put("score",score);
|
|
620
|
+ prate.put("srate",srate);
|
|
621
|
+ prate.put("ques",pgblist.stream().sorted(Comparator.comparing(QuestionOrderVo::getOrder)).collect(Collectors.toList()));
|
|
622
|
+ clist.add(prate);
|
|
623
|
+ }
|
|
624
|
+ }
|
|
625
|
+
|
|
626
|
+ //知识点分析
|
|
627
|
+ List<Map> pointlist = new ArrayList<>();
|
|
628
|
+ if(N_Utils.isListNotEmpty(pointqlist)){
|
|
629
|
+ Map<String,List<QuestionOrderVo>> pointmap = pointqlist.stream().collect(Collectors.groupingBy(QuestionOrderVo::getId,Collectors.toList()));
|
|
630
|
+ //根据指示进行分组,
|
|
631
|
+ for(Map.Entry<String, List<QuestionOrderVo>> entry : pointmap.entrySet()){
|
|
632
|
+ List<QuestionOrderVo> pgblist = entry.getValue();
|
|
633
|
+ //获取知识点的总分
|
|
634
|
+ Double score = pgblist.stream().mapToDouble(s -> s.getScore()).sum();
|
|
635
|
+ Double srate = N_Utils.getDoubleDivideAndMulitiply(score,paper.getPaperscore());
|
|
636
|
+ Map prate = new TreeMap();
|
|
637
|
+ prate.put("pointid",entry.getKey());
|
|
638
|
+ prate.put("pointname",pgblist.get(0).getName());
|
|
639
|
+ prate.put("score",score);
|
|
640
|
+ prate.put("srate",srate);
|
|
641
|
+ prate.put("ques",pgblist.stream().sorted(Comparator.comparing(QuestionOrderVo::getOrder)).collect(Collectors.toList()));
|
|
642
|
+ pointlist.add(prate);
|
|
643
|
+ }
|
|
644
|
+ }
|
|
645
|
+
|
412
|
646
|
TPaperAnalyze paperAnalyze = new TPaperAnalyze();
|
413
|
|
- paperAnalyze.setPaperid(paperid);
|
414
|
|
- paperAnalyze.setQtypejson(JSON.toJSONString(rateList));
|
415
|
|
- paperAnalyze.setComplexityjson(JSON.toJSONString(complexityRateList));
|
416
|
|
- paperAnalyze.setPointjson(JSON.toJSONString(pointRateList));
|
417
|
|
- paperAnalyze.setSchoolid(schoolid);
|
|
647
|
+ paperAnalyze.setPaperid(paper.getPaperid());
|
|
648
|
+ paperAnalyze.setAlljson(JSON.toJSONString(ztmap));//总体分析
|
|
649
|
+ paperAnalyze.setQtypejson(JSON.toJSONString(typelist));//试题栏题型分析
|
|
650
|
+ paperAnalyze.setComplexityjson(JSON.toJSONString(clist));//难易度分析
|
|
651
|
+ paperAnalyze.setPointjson(JSON.toJSONString(pointlist));//知识点分析
|
|
652
|
+ paperAnalyze.setQuespointjson(JSON.toJSONString(quesplist));
|
|
653
|
+
|
|
654
|
+ paperAnalyzeMapper.deleteByPaperid(paper.getPaperid());
|
418
|
655
|
paperAnalyzeMapper.insertUseGeneratedKeys(paperAnalyze);
|
419
|
656
|
return paperAnalyze.getId();
|
420
|
657
|
}
|
421
|
658
|
|
|
659
|
+ //设置知识点
|
|
660
|
+ private void setPaperQuestionPointScore(List<QuestionOrderVo> pointqlist,List<QuestionPointVo> quesplist,List<Map> qpoints,PaperQtypeQuesVo dq,String[] qnstr,List<Integer> eptqids){
|
|
661
|
+ if(N_Utils.isListNotEmpty(qpoints)){
|
|
662
|
+ if(qpoints.size() == 1){
|
|
663
|
+ //试题只有一个知识点
|
|
664
|
+ Map pointmap = qpoints.get(0);
|
|
665
|
+ QuestionOrderVo qpoint = new QuestionOrderVo();
|
|
666
|
+ qpoint.setId(pointmap.get("pointid").toString());
|
|
667
|
+ qpoint.setName(pointmap.get("pointname").toString());
|
|
668
|
+ qpoint.setOrder(dq.getPtqorder());
|
|
669
|
+ qpoint.setScore(dq.getPtqscore());
|
|
670
|
+ qpoint.setQlevel(dq.getQlevel());
|
|
671
|
+ qpoint.setQuestionid(dq.getQuestionid());
|
|
672
|
+ if(qnstr == null){
|
|
673
|
+ qpoint.setQns(new String[]{dq.getQn()});
|
|
674
|
+ }else{
|
|
675
|
+ qpoint.setQns(qnstr);
|
|
676
|
+ }
|
|
677
|
+
|
|
678
|
+ if(N_Utils.isListEmpty(eptqids)){
|
|
679
|
+ qpoint.setPtqids(new Integer[]{dq.getPtqid()});
|
|
680
|
+ }else{
|
|
681
|
+ Integer[] eptqidstr = eptqids.stream().toArray(Integer[]::new);
|
|
682
|
+ qpoint.setPtqids(eptqidstr);
|
|
683
|
+ }
|
|
684
|
+ pointqlist.add(qpoint);
|
|
685
|
+
|
|
686
|
+ //试题对应知识点
|
|
687
|
+ QuestionPointVo questionPointVo = new QuestionPointVo();
|
|
688
|
+ questionPointVo.setOrder(dq.getPtqorder());
|
|
689
|
+ questionPointVo.setScore(dq.getPtqscore());
|
|
690
|
+ questionPointVo.setQlevel(dq.getQlevel());
|
|
691
|
+ questionPointVo.setQuestionid(dq.getQuestionid());
|
|
692
|
+ List<Map> pointids = new ArrayList<>();
|
|
693
|
+ Map map = new HashMap();
|
|
694
|
+ map.put("pointid",pointmap.get("pointid").toString());
|
|
695
|
+ map.put("score",dq.getPtqscore());
|
|
696
|
+ pointids.add(map);
|
|
697
|
+ questionPointVo.setPointids(pointids);
|
|
698
|
+
|
|
699
|
+ if(N_Utils.isListEmpty(eptqids)){
|
|
700
|
+ List<Integer> saveids = new ArrayList<>();
|
|
701
|
+ saveids.add(dq.getPtqid());
|
|
702
|
+ questionPointVo.setPtqids(saveids);
|
|
703
|
+ questionPointVo.setPtqid(dq.getPtqid());
|
|
704
|
+ }else{
|
|
705
|
+ questionPointVo.setPtqids(eptqids);
|
|
706
|
+ questionPointVo.setPtqid(0);
|
|
707
|
+ }
|
|
708
|
+ quesplist.add(questionPointVo);
|
|
709
|
+ }else{
|
|
710
|
+
|
|
711
|
+ //试题有多个知识点
|
|
712
|
+ //计算每个知识点所占分值(平均分配)
|
|
713
|
+ Double[] avgps = StudyUtil.getPointAvgScore(qpoints.size(), dq.getPtqscore());
|
|
714
|
+ List<Map> pointids = new ArrayList<>();
|
|
715
|
+ for(int m = 0; m<qpoints.size();m++){
|
|
716
|
+ Map pointmap = qpoints.get(m);
|
|
717
|
+ QuestionOrderVo qpoint = new QuestionOrderVo();
|
|
718
|
+ qpoint.setId(pointmap.get("pointid").toString());
|
|
719
|
+ qpoint.setName(pointmap.get("pointname").toString());
|
|
720
|
+ qpoint.setOrder(dq.getPtqorder());
|
|
721
|
+ qpoint.setQlevel(dq.getQlevel());
|
|
722
|
+ qpoint.setQuestionid(dq.getQuestionid());
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+ Map quesmap = new HashMap();//试题对应知识点
|
|
726
|
+ quesmap.put("pointid",pointmap.get("pointid").toString());
|
|
727
|
+
|
|
728
|
+ if(avgps.length == 2 && (m+1) == qpoints.size()){
|
|
729
|
+ //不能整除分,并且是最后一个知识点
|
|
730
|
+ qpoint.setScore(avgps[1]);
|
|
731
|
+ quesmap.put("score",avgps[1]);
|
|
732
|
+ }else{
|
|
733
|
+ qpoint.setScore(avgps[0]);
|
|
734
|
+ quesmap.put("score",avgps[0]);
|
|
735
|
+ }
|
|
736
|
+ pointids.add(quesmap);
|
|
737
|
+
|
|
738
|
+ //题号集合
|
|
739
|
+ if(qnstr == null){
|
|
740
|
+ qpoint.setQns(new String[]{dq.getQn()});
|
|
741
|
+ }else{
|
|
742
|
+ qpoint.setQns(qnstr);
|
|
743
|
+ }
|
|
744
|
+ //试卷中试题id集合
|
|
745
|
+ if(N_Utils.isListEmpty(eptqids)){
|
|
746
|
+ qpoint.setPtqids(new Integer[]{dq.getPtqid()});
|
|
747
|
+ }else{
|
|
748
|
+ Integer[] eptqidstr = eptqids.stream().toArray(Integer[]::new);
|
|
749
|
+ qpoint.setPtqids(eptqidstr);
|
|
750
|
+ }
|
|
751
|
+ pointqlist.add(qpoint);
|
|
752
|
+ }
|
|
753
|
+
|
|
754
|
+ //试题对应知识点
|
|
755
|
+ QuestionPointVo questionPointVo = new QuestionPointVo();
|
|
756
|
+ questionPointVo.setOrder(dq.getPtqorder());
|
|
757
|
+ questionPointVo.setScore(dq.getPtqscore());
|
|
758
|
+ questionPointVo.setQlevel(dq.getQlevel());
|
|
759
|
+ questionPointVo.setQuestionid(dq.getQuestionid());
|
|
760
|
+ questionPointVo.setPointids(pointids);
|
|
761
|
+ if(N_Utils.isListEmpty(eptqids)){
|
|
762
|
+ List<Integer> saveids = new ArrayList<>();
|
|
763
|
+ saveids.add(dq.getPtqid());
|
|
764
|
+ questionPointVo.setPtqids(saveids);
|
|
765
|
+ questionPointVo.setPtqid(dq.getPtqid());
|
|
766
|
+
|
|
767
|
+ }else{
|
|
768
|
+ questionPointVo.setPtqids(eptqids);
|
|
769
|
+ questionPointVo.setPtqid(0);
|
|
770
|
+ }
|
|
771
|
+ quesplist.add(questionPointVo);
|
|
772
|
+
|
|
773
|
+ }
|
|
774
|
+ } else{
|
|
775
|
+ QuestionPointVo questionPointVo = new QuestionPointVo();
|
|
776
|
+ questionPointVo.setOrder(dq.getPtqorder());
|
|
777
|
+ questionPointVo.setScore(dq.getPtqscore());
|
|
778
|
+ questionPointVo.setQlevel(dq.getQlevel());
|
|
779
|
+ questionPointVo.setQuestionid(dq.getQuestionid());
|
|
780
|
+ questionPointVo.setPointids(null);
|
|
781
|
+ if(N_Utils.isListEmpty(eptqids)){
|
|
782
|
+ List<Integer> saveids = new ArrayList<>();
|
|
783
|
+ saveids.add(dq.getPtqid());
|
|
784
|
+ questionPointVo.setPtqids(saveids);
|
|
785
|
+ questionPointVo.setPtqid(dq.getPtqid());
|
|
786
|
+ }else{
|
|
787
|
+ questionPointVo.setPtqids(eptqids);
|
|
788
|
+ questionPointVo.setPtqid(0);
|
|
789
|
+ }
|
|
790
|
+
|
|
791
|
+ quesplist.add(questionPointVo);
|
|
792
|
+ }
|
|
793
|
+ }
|
|
794
|
+
|
|
795
|
+ //设置题型下试题题号及分值
|
|
796
|
+ private void setPaperQuestionQtypeScore(List<QuestionOrderVo> qtypelist,PaperQtypeQuesVo dq,String[] qnstr,Integer[] eptqidstr){
|
|
797
|
+ QuestionOrderVo qtype = new QuestionOrderVo();
|
|
798
|
+ qtype.setId(dq.getQtypeid());
|
|
799
|
+ qtype.setName(dq.getQtypename());
|
|
800
|
+ qtype.setComplexity(dq.getComplexity());
|
|
801
|
+ qtype.setOrder(dq.getPtqorder());
|
|
802
|
+ qtype.setScore(dq.getPtqscore());
|
|
803
|
+ qtype.setQlevel(dq.getQlevel());
|
|
804
|
+ qtype.setQuestionid(dq.getQuestionid());
|
|
805
|
+ if(qnstr == null){
|
|
806
|
+ qtype.setQns(new String[]{dq.getQn()});
|
|
807
|
+ }else{
|
|
808
|
+ qtype.setQns(qnstr);
|
|
809
|
+ }
|
|
810
|
+ if(eptqidstr == null){
|
|
811
|
+ qtype.setPtqids(new Integer[]{dq.getPtqid()});
|
|
812
|
+ }else{
|
|
813
|
+ qtype.setPtqids(eptqidstr);
|
|
814
|
+ }
|
|
815
|
+
|
|
816
|
+ qtypelist.add(qtype);
|
|
817
|
+ }
|
|
818
|
+
|
|
819
|
+ //设置试题难易度
|
|
820
|
+ private void setPaperQuestionComplexityScore(List<QuestionOrderVo> complexityList,PaperQtypeQuesVo dq,String[] qnstr,Integer[] eptqidstr){
|
|
821
|
+ QuestionOrderVo qtype = new QuestionOrderVo();
|
|
822
|
+ qtype.setId(dq.getComplexity().toString());//存放试题难易度
|
|
823
|
+ qtype.setOrder(dq.getPtqorder());
|
|
824
|
+ qtype.setScore(dq.getPtqscore());
|
|
825
|
+ qtype.setQlevel(dq.getQlevel());
|
|
826
|
+ qtype.setQuestionid(dq.getQuestionid());
|
|
827
|
+ if(qnstr == null){
|
|
828
|
+ qtype.setQns(new String[]{dq.getQn()});
|
|
829
|
+ }else{
|
|
830
|
+ qtype.setQns(qnstr);
|
|
831
|
+ }
|
|
832
|
+ if(eptqidstr == null){
|
|
833
|
+ qtype.setPtqids(new Integer[]{dq.getPtqid()});
|
|
834
|
+ }else{
|
|
835
|
+ qtype.setPtqids(eptqidstr);
|
|
836
|
+ }
|
|
837
|
+
|
|
838
|
+ complexityList.add(qtype);
|
|
839
|
+ }
|
|
840
|
+
|
422
|
841
|
/**
|
423
|
842
|
*功能描述 详情--答题卡
|
424
|
843
|
* @author WN
|