Browse Source

Merge remote-tracking branch 'origin/master' into ywx

tags/正式版本
雍文秀 2 years ago
parent
commit
49e33838a9

+ 143
- 153
sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EPaperStudentService.java View File

@@ -67,15 +67,15 @@ public class EPaperStudentService {
67 67
         return ePaperStudentMapper.listExamPapersForStudent(eps.getStudentid());
68 68
     }
69 69
 
70
-    public Map getExamSubjectPaperByEpsid(Integer epsid){
70
+    public Map getExamSubjectPaperByEpsid(Integer epsid) {
71 71
         Map map = ePaperStudentMapper.getExamSubjectPaperByEpsid(epsid);
72 72
         Long times = null;
73
-        if(map.get("sdate")!=null && map.get("begintime")!=null && map.get("endtime")!=null){
73
+        if (map.get("sdate") != null && map.get("begintime") != null && map.get("endtime") != null) {
74 74
             long bg = ExamUtil.strToTimestamp(map.get("sdate").toString() + " " + map.get("begintime").toString() + ":00");
75 75
             long ed = ExamUtil.strToTimestamp(map.get("sdate").toString() + " " + map.get("endtime").toString() + ":00");
76
-            times = ExamUtil.subtract(ed,bg);
76
+            times = ExamUtil.subtract(ed, bg);
77 77
         }
78
-        map.put("times",times);
78
+        map.put("times", times);
79 79
         return map;
80 80
     }
81 81
 
@@ -125,14 +125,14 @@ public class EPaperStudentService {
125 125
                 questions = ePaperStudentMapper.listStuPaperFjQuestionsForAndroid(epsid);
126 126
             }
127 127
         }
128
-        if(ptype == 2){
128
+        if (ptype == 2) {
129 129
             List<Map> files = ePaperFileMapper.listPaperFiles(psvo.getEpid());
130
-            map.put("files",files);
130
+            map.put("files", files);
131 131
         }
132 132
 
133
-        ePaperStudentMapper.updateStuStartime(epsid,N_Utils.getSecondTimestamp());
134
-        map.put("paper",psvo);
135
-        map.put("questions",questions);
133
+        ePaperStudentMapper.updateStuStartime(epsid, N_Utils.getSecondTimestamp());
134
+        map.put("paper", psvo);
135
+        map.put("questions", questions);
136 136
         return map;
137 137
     }
138 138
 
@@ -200,12 +200,12 @@ public class EPaperStudentService {
200 200
             }
201 201
         }
202 202
 
203
-        if(ptype==2){
203
+        if (ptype == 2) {
204 204
             List<Map> files = ePaperFileMapper.listPaperFiles(psvo.getEpid());
205 205
             psvo.setFiles(files);
206 206
         }
207 207
         psvo.setQtypelist(questions);
208
-        ePaperStudentMapper.updateStuStartime(epsid,N_Utils.getSecondTimestamp());
208
+        ePaperStudentMapper.updateStuStartime(epsid, N_Utils.getSecondTimestamp());
209 209
         return psvo;
210 210
     }
211 211
 
@@ -220,17 +220,17 @@ public class EPaperStudentService {
220 220
         try {
221 221
             //学生作答提交时先判断试卷是否设置的正确答案
222 222
             PsqAnswerVo answerVo = ePaperStudentQuestionMapper.getPaperQuestionAnswer(psq.getEpsqid());
223
-            setCommitQuestion(psq,answerVo);
223
+            setCommitQuestion(psq, answerVo);
224 224
             ePaperStudentQuestionMapper.updateStuAnswer(psq);
225
-        }catch (Exception e){
226
-            log.error("提交试题失败:"+e.getMessage());
225
+        } catch (Exception e) {
226
+            log.error("提交试题失败:" + e.getMessage());
227 227
             throw new Exception("提交试题失败");
228 228
         }
229 229
 
230 230
     }
231 231
 
232 232
     //判断单道题情况
233
-    private void setCommitQuestion(EPaperStudentQuestion psq,PsqAnswerVo answerVo){
233
+    private void setCommitQuestion(EPaperStudentQuestion psq, PsqAnswerVo answerVo) {
234 234
         int timestamp = N_Utils.getSecondTimestamp();
235 235
         psq.setAnswertime(timestamp);
236 236
         int coverted = 1;//是否转换0未转换1已转换2转换失败
@@ -238,94 +238,94 @@ public class EPaperStudentService {
238 238
         List<String> stuanswers = JSON.parseArray(stuanswer, String.class);
239 239
         Double stuscore = 0D;
240 240
 
241
-        if(N_Utils.isListEmpty(stuanswers) && N_Utils.isEmpty(psq.getStuanswertxt())
242
-                && N_Utils.isEmpty(psq.getStuanswertxt())){
241
+        if (N_Utils.isListEmpty(stuanswers) && N_Utils.isEmpty(psq.getStuanswertxt())
242
+                && N_Utils.isEmpty(psq.getStuanswertxt())) {
243 243
             psq.setStuscore(stuscore);
244 244
             psq.setChecked(2);
245 245
             psq.setChecktime(timestamp);
246 246
             psq.setAnswered(0);
247
-        }else{
247
+        } else {
248 248
             //试卷已经设置了正确答案
249
-            if (answerVo.getAnswered() == 1){
249
+            if (answerVo.getAnswered() == 1) {
250 250
                 String qanswer = answerVo.getAnswer();
251
-                List<String> qanswers = JSON.parseArray(qanswer,String.class);
251
+                List<String> qanswers = JSON.parseArray(qanswer, String.class);
252 252
                 int ctype = answerVo.getCtype();
253
-                if(psq.getAnswertype() == 1){
254
-                    if(N_Utils.isObjectiveQuestion(ctype)){
253
+                if (psq.getAnswertype() == 1) {
254
+                    if (N_Utils.isObjectiveQuestion(ctype)) {
255 255
                         //客观题进行批阅
256
-                        if(ctype == 1 || ctype == 4 || ctype == 5 || ctype == 6){
256
+                        if (ctype == 1 || ctype == 4 || ctype == 5 || ctype == 6) {
257 257
                             //单选、判断
258
-                            if(stuanswer.equalsIgnoreCase(qanswer)) {
258
+                            if (stuanswer.equalsIgnoreCase(qanswer)) {
259 259
                                 stuscore = answerVo.getScore();
260 260
                             }
261
-                        }else if(ctype == 2){//多选
261
+                        } else if (ctype == 2) {//多选
262 262
                             //多选、选错不得分
263
-                            if(stuanswers.get(0).length() <= qanswer.length()){
263
+                            if (stuanswers.get(0).length() <= qanswer.length()) {
264 264
                                 String[] qanswerList = qanswers.get(0).split("");
265 265
                                 String[] stuanswerList = stuanswers.get(0).split("");
266 266
                                 int rightNum = 0;//选对个数
267
-                                for(String sa : stuanswerList){
267
+                                for (String sa : stuanswerList) {
268 268
                                     int right = 0;
269
-                                    for(String qa : qanswerList){
270
-                                        if(qa.equals(sa)){
269
+                                    for (String qa : qanswerList) {
270
+                                        if (qa.equals(sa)) {
271 271
                                             right = 1;
272
-                                            rightNum ++;
272
+                                            rightNum++;
273 273
                                         }
274 274
                                     }
275
-                                    if(right == 0){//说明选错
275
+                                    if (right == 0) {//说明选错
276 276
                                         rightNum = 0;
277 277
                                         break;
278 278
                                     }
279 279
                                 }
280
-                                if(rightNum>0){
281
-                                    if(qanswerList.length == rightNum){
280
+                                if (rightNum > 0) {
281
+                                    if (qanswerList.length == rightNum) {
282 282
                                         //全选对
283 283
                                         stuscore = answerVo.getScore();
284
-                                    }else if (qanswerList.length > rightNum){
284
+                                    } else if (qanswerList.length > rightNum) {
285 285
                                         //少选得半分
286
-                                        stuscore = ExamUtil.div(answerVo.getScore(),2,1);
286
+                                        stuscore = ExamUtil.div(answerVo.getScore(), 2, 1);
287 287
                                     }
288 288
                                 }
289 289
                             }
290
-                        }else if(ctype == 7 || ctype == 8 || ctype == 10){
290
+                        } else if (ctype == 7 || ctype == 8 || ctype == 10) {
291 291
                             //完形填空、阅读理解、任务型阅读
292
-                            Double qscore = ExamUtil.div(answerVo.getScore(),qanswers.size());
292
+                            Double qscore = ExamUtil.div(answerVo.getScore(), qanswers.size());
293 293
                             Double stuScoreDouble = 0d;
294
-                            for(int i=0;i<qanswers.size();i++){
295
-                                if(qanswers.get(i).equalsIgnoreCase(stuanswers.get(i))){
296
-                                    stuScoreDouble = ExamUtil.add(stuScoreDouble,qscore);
294
+                            for (int i = 0; i < qanswers.size(); i++) {
295
+                                if (qanswers.get(i).equalsIgnoreCase(stuanswers.get(i))) {
296
+                                    stuScoreDouble = ExamUtil.add(stuScoreDouble, qscore);
297 297
                                 }
298 298
                             }
299
-                            stuscore = ExamUtil.round(stuScoreDouble,1);
299
+                            stuscore = ExamUtil.round(stuScoreDouble, 1);
300 300
                         }
301
-                        if(stuscore.compareTo(answerVo.getScore()) == 1){
301
+                        if (stuscore.compareTo(answerVo.getScore()) == 1) {
302 302
                             stuscore = answerVo.getScore();
303 303
                         }
304 304
 
305 305
                         psq.setChecked(2);
306 306
                         psq.setChecktime(timestamp);
307
-                    }else{
308
-                        if(stuanswers.size() > 1){
307
+                    } else {
308
+                        if (stuanswers.size() > 1) {
309 309
                             coverted = 0;//上传的多张图片设为0未转换
310 310
                         }
311 311
                         psq.setChecked(0);
312 312
                     }
313
-                }else{
313
+                } else {
314 314
                     psq.setChecked(0);
315 315
                 }
316
-            }else{
316
+            } else {
317 317
                 psq.setStuscore(stuscore);
318 318
                 psq.setChecked(0);
319 319
             }
320 320
         }
321 321
         psq.setStuscore(stuscore);
322 322
         Integer costtime = answerVo.getCosttime();
323
-        if(costtime == null){
323
+        if (costtime == null) {
324 324
             costtime = 0;
325 325
         }
326
-        if(psq.getCosttime() == null){
326
+        if (psq.getCosttime() == null) {
327 327
             psq.setCosttime(costtime);
328
-        }else{
328
+        } else {
329 329
             psq.setCosttime(psq.getCosttime());
330 330
         }
331 331
 
@@ -340,9 +340,9 @@ public class EPaperStudentService {
340 340
      * @Date 2022/7/28 16:59
341 341
      **/
342 342
     @Transactional(rollbackFor = Exception.class)
343
-    public void saveCommitPaper(Integer epsid){
343
+    public void saveCommitPaper(Integer epsid) {
344 344
         EPaperStudent ps = ePaperStudentMapper.selectByPrimaryKey(epsid);
345
-        if(ps == null || ps.getSstate() == 2){
345
+        if (ps == null || ps.getSstate() == 2) {
346 346
             return;
347 347
         }
348 348
         EPaperStudent paperStudent = new EPaperStudent();
@@ -355,22 +355,22 @@ public class EPaperStudentService {
355 355
         //获取试卷中未批阅试题数量
356 356
         int noCheckNum = ePaperStudentQuestionMapper.getStuQuestionNoCheckNum(epsid);
357 357
         int checked = 0;
358
-        if(noCheckNum == 0){
358
+        if (noCheckNum == 0) {
359 359
             checked = 2;//试卷中所有试题都批完后标识试卷已批改
360 360
         }
361 361
         paperStudent.setChecked(checked);
362 362
         ePaperStudentMapper.updateStudentPaper(paperStudent);//修改试卷信息
363
-        chandleStudentQuestionNoconvertedPic(epsid,1);//处理试卷中多张图片未合并情况
363
+        chandleStudentQuestionNoconvertedPic(epsid, 1);//处理试卷中多张图片未合并情况
364 364
     }
365 365
 
366 366
     //处理试卷中未已提交需要合并的图片,type1代表线上2代表扫码答题卡图片
367
-    private void chandleStudentQuestionNoconvertedPic(Integer epsid,Integer type){
367
+    private void chandleStudentQuestionNoconvertedPic(Integer epsid, Integer type) {
368 368
         List<EPaperStudentQuestion> psqlist = ePaperStudentQuestionMapper.listStuQuesitonStuAnswerPic(epsid);
369
-        if(N_Utils.isListNotEmpty(psqlist)){
370
-            for(EPaperStudentQuestion sq : psqlist){
371
-                List<String> stuanswer = JSON.parseArray(sq.getStuanswer(),String.class);
372
-                if(N_Utils.isListNotEmpty(stuanswer) && stuanswer.size()>1){
373
-                    convertUtil.imgMerge(sq.getEpsqid(),stuanswer,type);
369
+        if (N_Utils.isListNotEmpty(psqlist)) {
370
+            for (EPaperStudentQuestion sq : psqlist) {
371
+                List<String> stuanswer = JSON.parseArray(sq.getStuanswer(), String.class);
372
+                if (N_Utils.isListNotEmpty(stuanswer) && stuanswer.size() > 1) {
373
+                    convertUtil.imgMerge(sq.getEpsqid(), stuanswer, type);
374 374
                 }
375 375
             }
376 376
         }
@@ -383,25 +383,25 @@ public class EPaperStudentService {
383 383
      * @Author wn
384 384
      * @Date 2022/7/28 19:18
385 385
      **/
386
-    public void saveCommitPaperForWeb(PaperStudentWebVo pswvo){
386
+    public void saveCommitPaperForWeb(PaperStudentWebVo pswvo) {
387 387
         List<EPaperStudentQuestion> sqlist = pswvo.getQuestions();//学生提交试卷中试题
388 388
         EPaperStudent ps = ePaperStudentMapper.selectByPrimaryKey(pswvo.getEpsid());
389 389
         //试卷不存在或者已提交
390
-        if(ps == null || ps.getSstate() == 2){
390
+        if (ps == null || ps.getSstate() == 2) {
391 391
             return;
392 392
         }
393 393
         //获取试卷中所有试题答案及分值
394 394
         List<PsqAnswerVo> anvolist = ePaperStudentQuestionMapper.listPaperQuestionsAnswer(pswvo.getEpsid());
395 395
         Integer checknum = 0;//记录试卷中试题批阅数量
396 396
         Double paperscore = 0D;//学生试卷得分
397
-        for(EPaperStudentQuestion q : sqlist){
397
+        for (EPaperStudentQuestion q : sqlist) {
398 398
 
399 399
             //获取该试题正确答案
400 400
             PsqAnswerVo anvo = anvolist.stream().filter(a -> a.getEpsqid().equals(q.getEpsqid())).findFirst().orElse(null);
401 401
 
402
-            setCommitQuestion(q,anvo);
403
-            if(q.getChecked() == 2){
404
-                checknum ++;
402
+            setCommitQuestion(q, anvo);
403
+            if (q.getChecked() == 2) {
404
+                checknum++;
405 405
             }
406 406
             paperscore = ExamUtil.add(paperscore, q.getStuscore());
407 407
         }
@@ -411,7 +411,7 @@ public class EPaperStudentService {
411 411
         paperStudent.setSstate(2);
412 412
         paperStudent.setStuscore(paperscore);
413 413
         int checked = 0;
414
-        if(checknum == sqlist.size()){
414
+        if (checknum == sqlist.size()) {
415 415
             checked = 2;
416 416
         }
417 417
         paperStudent.setChecked(checked);
@@ -420,7 +420,7 @@ public class EPaperStudentService {
420 420
         ePaperStudentMapper.updateStudentPaper(paperStudent);
421 421
 
422 422
         //获取试卷中需要合并图片的试题
423
-        chandleStudentQuestionNoconvertedPic(pswvo.getEpsid(),1);
423
+        chandleStudentQuestionNoconvertedPic(pswvo.getEpsid(), 1);
424 424
     }
425 425
 
426 426
     /**
@@ -431,7 +431,7 @@ public class EPaperStudentService {
431 431
      * @Date 2022/8/3 9:17
432 432
      **/
433 433
     @Transactional(rollbackFor = Exception.class)
434
-    public void saveCommitPaperForScantron(PaperStudentWebVo pswvo) throws Exception{
434
+    public void saveCommitPaperForScantron(PaperStudentWebVo pswvo) throws Exception {
435 435
 
436 436
         //扫描一次扫描数量+1
437 437
         eScanbatchMapper.updateScannum(pswvo.getBatchid());
@@ -473,7 +473,7 @@ public class EPaperStudentService {
473 473
     }
474 474
 
475 475
     //更新扫描出错信息
476
-    private void updateScanErrorInfo(Integer errortype,PaperStudentWebVo pswvo){
476
+    private void updateScanErrorInfo(Integer errortype, PaperStudentWebVo pswvo) {
477 477
         //识别出错
478 478
         EScanerror er = new EScanerror();
479 479
         er.setBatchid(pswvo.getBatchid());
@@ -507,103 +507,93 @@ public class EPaperStudentService {
507 507
      * @Author wn
508 508
      * @Date 2022/8/12 10:45
509 509
      **/
510
-    public Map getStudentPaperScore(Integer epsid){
510
+    public Map getStudentPaperScore(Integer epsid) {
511 511
         Map paper = ePaperStudentMapper.getStudentPaperScore(epsid);
512 512
         Integer ptype = Integer.parseInt(paper.get("ptype").toString());
513 513
         Integer epid = Integer.parseInt(paper.get("epid").toString());
514 514
         List<Map> qtypeques = null;
515
-        if(ptype == 1){
515
+        if (ptype == 1) {
516 516
             qtypeques = ePaperStudentQuestionMapper.listQStuQuestionScore(epsid);
517 517
             setQuestionsForPaper(qtypeques);
518
-        }else{
518
+        } else {
519 519
             qtypeques = ePaperStudentQuestionMapper.listFjStuQuestionScore(epsid);
520 520
             List<Map> files = ePaperFileMapper.listPaperFiles(epid);
521
-            paper.put("files",files);
521
+            paper.put("files", files);
522 522
         }
523
-        paper.put("qtypes",qtypeques);
523
+        paper.put("qtypes", qtypeques);
524 524
         return paper;
525 525
     }
526 526
 
527
-    private void setQuestionsForPaper(List<Map> qtypes){
528
-        for(Map mt : qtypes){
529
-            Integer ctype = Integer.parseInt(mt.get("ctype").toString());
530
-            List<Map> mqlist = new ArrayList<>();
531
-            if(ctype == 11 || ctype == 16 || ctype == 17){
532
-                //符合题、完形填空、任务型阅读
533
-                List<Map> questions = (List<Map>) mt.get("questions");
534
-                Map<String,List<Map>> quemap = questions.stream().collect(Collectors.groupingBy(o -> o.get("questionpid").toString()));
535
-
536
-                for(Map.Entry<String,List<Map>> entry : quemap.entrySet()){
537
-                    List<Map> sonqlst = entry.getValue();
538
-                    Double sontotalsocre = sonqlst.stream().mapToDouble(o -> Double.parseDouble(o.get("score").toString())).sum();
539
-                    Double stuscore = sonqlst.stream().mapToDouble(o -> Double.parseDouble(o.get("stuscore").toString())).sum();
540
-                    Map sque = sonqlst.get(0);
541
-                    Map mque = new HashMap();
542
-                    mque.put("questionid",sque.get("mquestionid").toString());
543
-                    mque.put("qlevel",2);
544
-                    mque.put("qstem",sque.get("mqstem").toString());
545
-                    mque.put("ctype",Integer.parseInt(sque.get("mctype").toString()));
546
-                    mque.put("qtypeid",sque.get("mqtypeid").toString());
547
-                    mque.put("qtypename",sque.get("mqtypename").toString());
548
-                    mque.put("qorder",sque.get("qorder").toString());
549
-                    mque.put("qn",sque.get("qn").toString());
550
-                    mque.put("snum",Integer.parseInt(sque.get("snum").toString()));
551
-                    Integer hashear = Integer.parseInt(sque.get("mhashear").toString());
552
-                    mque.put("hashear",hashear);
553
-                    if(ctype == 12 && hashear==1){
554
-                        mque.put("hearfile",sque.get("mhearfile").toString());
555
-                    }else{
556
-                        mque.put("hearfile","");
557
-                    }
558
-                    mque.put("score",sontotalsocre);
559
-                    mque.put("sonques",sonqlst);
560
-                    mque.put("stuscore",stuscore);
561
-                    mqlist.add(mque);
562
-                }
563
-            }else if(ctype == 12){
564
-                //听力题,包含单题和复合题
565
-                List<Map> questions = (List<Map>) mt.get("questions");
566
-                List<String> questionpids = new ArrayList<>();
567
-                for(Map q : questions){
568
-                    Integer qlevel = Integer.parseInt(q.get("qlevel").toString());
569
-                    if(qlevel == 1){
570
-                        mqlist.add(q);
571
-                    }else{
572
-                        String questionpid = q.get("questionpid").toString();
573
-                        if(!questionpids.contains(questionpid)){
574
-                            questionpids.add(questionpid);
575
-
576
-                            List<Map> sonques = questions.stream().filter(s -> qlevel.equals(Integer.parseInt(s.get("qlevel").toString())) && questionpid.equals(s.get("questionpid").toString())).collect(Collectors.toList());
577
-                            Double sontotalsocre = sonques.stream().mapToDouble(o -> Double.parseDouble(o.get("score").toString())).sum();
578
-                            Double stuscore = sonques.stream().mapToDouble(o -> Double.parseDouble(o.get("stuscore").toString())).sum();
579
-                            Map mque = new HashMap();
580
-                            mque.put("questionid",questionpid);
581
-                            mque.put("qlevel",2);
582
-                            mque.put("qstem",q.get("mqstem").toString());
583
-                            mque.put("ctype",Integer.parseInt(q.get("mctype").toString()));
584
-                            mque.put("qtypeid",q.get("mqtypeid").toString());
585
-                            mque.put("qtypename",q.get("mqtypename").toString());
586
-                            mque.put("qorder",q.get("qorder").toString());
587
-                            mque.put("qn",q.get("qn").toString());
588
-                            mque.put("snum",Integer.parseInt(q.get("snum").toString()));
589
-                            Integer hashear = Integer.parseInt(q.get("mhashear").toString());
590
-                            mque.put("hashear",hashear);
591
-                            if(ctype == 12 && hashear == 1){
592
-                                mque.put("hearfile",q.get("mhearfile").toString());
593
-                            }else{
594
-                                mque.put("hearfile","");
595
-                            }
596
-                            mque.put("score",sontotalsocre);
597
-                            mque.put("stuscore",stuscore);
598
-                            mque.put("sonques",sonques);
599
-                            mqlist.add(mque);
527
+    //这只试卷中母子题
528
+    private void setQuestionsForPaper(List<Map> qtypes) {
529
+        for (Map mt : qtypes) {
530
+            List<Map> questions = (List<Map>) mt.get("questions");
531
+            List<Map> mqlist = new ArrayList<>();//存放母子题结构试题
532
+            List<String> mtquestionids = new ArrayList<>();//存放母题的id
533
+            for (Map qmap : questions) {
534
+                Integer qlevel = Integer.parseInt(qmap.get("qlevel").toString());
535
+                if (qlevel == 1) {
536
+                    //单题
537
+                    qmap.remove("mqstem");
538
+                    qmap.remove("mqoption");
539
+                    qmap.remove("msum");
540
+                    qmap.remove("mqtypeid");
541
+                    qmap.remove("mqtypename");
542
+                    qmap.remove("mhashear");
543
+                    qmap.remove("mhearfile");
544
+                    qmap.remove("mquestionid");
545
+                    qmap.remove("mctype");
546
+                    qmap.remove("questionpid");
547
+
548
+                    mqlist.add(qmap);
549
+                } else {
550
+                    //子题
551
+                    String questionpid = qmap.get("questionpid").toString();
552
+                    if (!mtquestionids.contains(questionpid)) {
553
+                        mtquestionids.add(questionpid);
554
+                        List<Map> sonqueslist =
555
+                                questions.stream().filter(s -> qlevel.equals(Integer.parseInt(s.get("qlevel").toString())) && questionpid.equals(s.get("questionpid").toString())).collect(Collectors.toList());
556
+
557
+                        Double sontotalsocre = sonqueslist.stream().mapToDouble(o -> Double.parseDouble(o.get("score").toString())).sum();
558
+                        Double stuscore = sonqueslist.stream().mapToDouble(o -> Double.parseDouble(o.get("stuscore").toString())).sum();
559
+                        Map sque = sonqueslist.get(0);
560
+                        Map mque = new HashMap();
561
+                        mque.put("questionid", sque.get("mquestionid").toString());
562
+                        mque.put("qlevel", 2);
563
+                        mque.put("qstem", sque.get("mqstem").toString());
564
+                        mque.put("ctype", Integer.parseInt(sque.get("mctype").toString()));
565
+                        mque.put("qtypeid", sque.get("mqtypeid").toString());
566
+                        mque.put("qtypename", sque.get("mqtypename").toString());
567
+                        mque.put("qorder", sque.get("qorder").toString());
568
+                        mque.put("qn", sque.get("qn").toString());
569
+                        mque.put("snum", Integer.parseInt(sque.get("snum").toString()));
570
+                        Integer hashear = Integer.parseInt(sque.get("mhashear").toString());
571
+                        mque.put("hashear", hashear);
572
+                        if (hashear == 1) {
573
+                            mque.put("hearfile", sque.get("mhearfile").toString());
574
+                        } else {
575
+                            mque.put("hearfile", "");
576
+                        }
577
+                        mque.put("score", sontotalsocre);
578
+                        mque.put("stuscore", stuscore);
579
+
580
+                        for(Map sonquem : sonqueslist){
581
+                            sonquem.remove("mqstem");
582
+                            sonquem.remove("mqoption");
583
+                            sonquem.remove("msum");
584
+                            sonquem.remove("mqtypeid");
585
+                            sonquem.remove("mqtypename");
586
+                            sonquem.remove("mhashear");
587
+                            sonquem.remove("mhearfile");
588
+                            sonquem.remove("mquestionid");
589
+                            sonquem.remove("mctype");
590
+                            sonquem.remove("hashear");
591
+                            sonquem.remove("hearfile");
600 592
                         }
593
+                        mque.put("sonques", sonqueslist);
594
+                        mqlist.add(mque);
601 595
                     }
602 596
                 }
603
-
604
-            }else{
605
-                List<Map> questions = (List<Map>) mt.get("questions");
606
-                mqlist.addAll(questions);
607 597
             }
608 598
             mt.put("questions",mqlist);
609 599
         }
@@ -719,7 +709,7 @@ public class EPaperStudentService {
719 709
             }
720 710
             q.setEpsqid(anvo.getEpsqid());
721 711
             paperscore = ExamUtil.add(paperscore, q.getStuscore());
722
-            if(N_Utils.isObjectiveQuestion(q.getCtype()) && q.getAnswered()!=null && q.getAnswered()==1){
712
+            if (N_Utils.isObjectiveQuestion(q.getCtype()) && q.getAnswered() != null && q.getAnswered() == 1) {
723 713
                 rtnanswernum++;
724 714
             }
725 715
         }
@@ -782,7 +772,7 @@ public class EPaperStudentService {
782 772
     @Transactional(rollbackFor = Exception.class)
783 773
     public void qkConfirm(List<PaperStudentWebVo> list) throws Exception {
784 774
         List<EPaperStudent> pslist = new ArrayList<>();
785
-        for(PaperStudentWebVo objvo : list){
775
+        for (PaperStudentWebVo objvo : list) {
786 776
             EPaperStudent ps = new EPaperStudent();
787 777
             ps.setEpsid(objvo.getEpsid());
788 778
             ps.setSstate(objvo.getSstate());

+ 30
- 41
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportStudentService.java View File

@@ -1,6 +1,7 @@
1 1
 package com.xhkjedu.sexam.service.report;
2 2
 
3 3
 import com.alibaba.fastjson.JSON;
4
+import com.sun.org.apache.xml.internal.utils.QName;
4 5
 import com.xhkjedu.sexam.mapper.exam.EBaseMapper;
5 6
 import com.xhkjedu.sexam.mapper.exam.EClassMapper;
6 7
 import com.xhkjedu.sexam.mapper.exam.ESubjectMapper;
@@ -180,7 +181,7 @@ public class EReportStudentService {
180 181
         List<Map> list = null;
181 182
         if (ptype == 1) {
182 183
             list = eRstudentMapper.listStudentQuestionsTk(epid, studentid);
183
-            setPaperQuestionForTK(list);
184
+            list = setPaperQuestionForTK(list);
184 185
         } else {
185 186
             list = eRstudentMapper.listStudentQuestionsFj(epid, studentid);
186 187
             for (Map qmap : list) {
@@ -203,49 +204,21 @@ public class EReportStudentService {
203 204
             Integer qlevel = Integer.parseInt(q.get("qlevel").toString());
204 205
             if (qlevel == 1) {
205 206
                 //代表单题
206
-                Map map = new HashMap();
207
-                map.put("epsqid", Integer.parseInt(q.get("epsqid").toString()));
208
-                map.put("eptqid", Integer.parseInt(q.get("eptqid").toString()));
209
-                map.put("ctype", Integer.parseInt(q.get("ctype").toString()));
210
-                map.put("qn", q.get("qn").toString());
211
-                map.put("qorder", Integer.parseInt(q.get("qorder").toString()));
212 207
                 Double stuscore = Double.parseDouble(q.get("stuscore").toString());
213 208
                 Double pscore = Double.parseDouble(q.get("qscore").toString());
214
-                map.put("qscore", pscore);
215
-                map.put("stuscore", stuscore);
216
-                map.put("answered", Integer.parseInt(q.get("answered").toString()));
217
-                map.put("answertype", Integer.parseInt(q.get("answertype").toString()));
218
-                map.put("stuanswer", q.get("stuanswer").toString());
219
-                map.put("stuanswertxt", q.get("stuanswertxt").toString());
220
-                map.put("answer", q.get("answer").toString());
221
-                map.put("qstem", q.get("qstem").toString());
222
-                if (N_Utils.isNotEmpty(q.get("qoption"))) {
223
-                    map.put("qoption", q.get("qoption").toString());
224
-                } else {
225
-                    map.put("qoption", "");
226
-                }
227
-                if (N_Utils.isNotEmpty(q.get("qanalyze"))) {
228
-                    map.put("qanalyze", q.get("qanalyze").toString());
229
-                } else {
230
-                    map.put("qanalyze", "");
231
-                }
232
-
233
-                Integer hashear = Integer.parseInt(q.get("hashear").toString());
234
-                map.put("hashear", hashear);
235
-                if (hashear == 1) {
236
-                    map.put("hearfile", q.get("hearfile").toString());
237
-                }
209
+                q.put("srate", N_Utils.getDoubleDivideAndMulitiply(stuscore, pscore));//得分率
238 210
 
239
-                map.put("qlevel", qlevel);
240
-                map.put("classavgscore", Double.parseDouble(q.get("classavgscore").toString()));
241
-                map.put("gradeavgscore", Double.parseDouble(q.get("gradeavgscore").toString()));
242
-                map.put("srate", N_Utils.getDoubleDivideAndMulitiply(stuscore, pscore));//得分率
243
-
244
-                if (q.get("points") != null) {
245
-                    List<Map> points = (List<Map>) q.get("points");
246
-                    map.put("points", points);
247
-                }
248
-                rtnlist.add(map);
211
+                q.remove("mqstem");
212
+                q.remove("mqoption");
213
+                q.remove("msum");
214
+                q.remove("mqtypeid");
215
+                q.remove("mqtypename");
216
+                q.remove("mhashear");
217
+                q.remove("mhearfile");
218
+                q.remove("mquestionid");
219
+                q.remove("mctype");
220
+                q.remove("questionpid");
221
+                rtnlist.add(q);
249 222
             } else {
250 223
                 //母题
251 224
                 String questionpid = q.get("questionpid").toString();
@@ -288,7 +261,23 @@ public class EReportStudentService {
288 261
 
289 262
                     Double stuscore = sonqueslist.stream().mapToDouble(s -> Double.parseDouble(s.get("stuscore").toString())).sum();
290 263
                     Double pscore = sonqueslist.stream().mapToDouble(s -> Double.parseDouble(s.get("qscore").toString())).sum();
264
+                    mq.put("qscore",pscore);
265
+                    mq.put("stuscore",stuscore);
291 266
                     mq.put("srate", N_Utils.getDoubleDivideAndMulitiply(stuscore, pscore));
267
+                    for(Map sonmap : sonqueslist){
268
+                        sonmap.remove("mqstem");
269
+                        sonmap.remove("msum");
270
+                        sonmap.remove("mqoption");
271
+                        sonmap.remove("mqtypeid");
272
+                        sonmap.remove("mqtypename");
273
+                        sonmap.remove("mhashear");
274
+                        sonmap.remove("mhearfile");
275
+                        sonmap.remove("mquestionid");
276
+                        sonmap.remove("mctype");
277
+                        sonmap.remove("points");
278
+                        sonmap.remove("hashear");
279
+                        sonmap.remove("hearfile");
280
+                    }
292 281
                     mq.put("sonques", sonqueslist);
293 282
                     rtnlist.add(mq);
294 283
                 }

+ 1
- 1
sexam/src/main/resources/mapper/paperstudent/EPaperStudentQuestionMapper.xml View File

@@ -164,9 +164,9 @@
164 164
             <result column="qtypename" property="qtypename"></result>
165 165
             <result column="qctype" property="ctype"></result>
166 166
             <result column="hashear" property="hashear"></result>
167
-            <result column="qctype" property="ctype"></result>
168 167
             <result column="hearfile" property="hearfile"></result>
169 168
             <result column="qoption" property="qoption"></result>
169
+            <result column="qstem" property="qstem"></result>
170 170
             <result column="qlevel" property="qlevel"></result>
171 171
             <result column="sorder" property="sorder"></result>
172 172
             <result column="snum" property="snum"></result>

Loading…
Cancel
Save