Преглед изворни кода

题块批阅、进度总览完善

ywx
雍文秀 пре 2 недеља
родитељ
комит
0d6a7581c1

+ 21
- 11
smarking/src/main/java/com/xhkjedu/smarking/service/papercheck/MsPaperCheckTeacherTaskService.java Прегледај датотеку

@@ -406,14 +406,14 @@ public class MsPaperCheckTeacherTaskService {
406 406
                 checked = 3;
407 407
             }
408 408
             if (correcttype.equals(3)) {//按题块批阅
409
-                checkscore = questions.stream().map(MsPaperBlockQuestion::getMergescore).collect(Collectors.joining(";"));
409
+                checkscore = questions.stream().map(q -> q.getStuscore().toString()).collect(Collectors.joining(";"));
410 410
                 //题块批阅信息
411 411
                 MsPaperStudentBlock block = new MsPaperStudentBlock();
412 412
                 block.setMpsbid(mpsbid);
413 413
                 block.setChecked(checked);
414 414
                 block.setFirstcid(handleid);
415 415
                 block.setFirstcime(N_Utils.getSecondTimestamp());
416
-                String stuscores = questions.stream().map(MsPaperBlockQuestion::getMergestuscore).collect(Collectors.joining(";"));
416
+                String stuscores = questions.stream().map(q -> q.getStuscore().toString()).collect(Collectors.joining(";"));
417 417
                 block.setFirstccores(stuscores);
418 418
                 block.setFirstccore(arbitratescore);
419 419
                 block.setHasgood(hasgood);
@@ -438,12 +438,13 @@ public class MsPaperCheckTeacherTaskService {
438 438
                         studentQuestions.add(studentQuestion);
439 439
                     } else {
440 440
                         String[] mptqids = question.getMergeqid().split(",");
441
-                        String[] mergestuscore = question.getMergestuscore().split(",");
441
+                        String[] mergescores = question.getMergescore().split(",");
442
+                        double[] scores = setStuScore(mergescores, stuscore);//计算学生小题得分
442 443
                         for (int i = 0; i < mptqids.length; i++) {
443 444
                             MsPaperStudentQuestion studentQuestion = new MsPaperStudentQuestion();
444 445
                             studentQuestion.setMptqid(N_Utils.obj2Int(mptqids[i]));
445
-                            studentQuestion.setFirstccore(MarkingUtil.objToDouble(mergestuscore[i]));
446
-                            studentQuestion.setStuscore(MarkingUtil.objToDouble(mergestuscore[i]));
446
+                            studentQuestion.setFirstccore(scores[i]);
447
+                            studentQuestion.setStuscore(scores[i]);
447 448
                             studentQuestions.add(studentQuestion);
448 449
                         }
449 450
                     }
@@ -506,7 +507,7 @@ public class MsPaperCheckTeacherTaskService {
506 507
                 //题块批阅信息
507 508
                 MsPaperStudentBlock block = new MsPaperStudentBlock();
508 509
                 block.setMpsbid(mpsbid);
509
-                String stuscores = questions.stream().map(MsPaperBlockQuestion::getMergestuscore).collect(Collectors.joining(";"));
510
+                String stuscores = questions.stream().map(q -> q.getStuscore().toString()).collect(Collectors.joining(";"));
510 511
                 String[] cores = new String[0];
511 512
                 if (type.equals(1)) {
512 513
                     block.setFirstcid(handleid);
@@ -553,11 +554,7 @@ public class MsPaperCheckTeacherTaskService {
553 554
                     } else {
554 555
                         String[] mptqids = question.getMergeqid().split(",");
555 556
                         String[] mergescores = question.getMergescore().split(",");
556
-                        String[] mergestuscore = question.getMergestuscore().split(",");
557
-                        double[] scores = new double[mergestuscore.length];
558
-                        for (int i = 0; i < mergestuscore.length; i++) {
559
-                            scores[i]=MarkingUtil.objToDouble(mergestuscore[i]);
560
-                        }
557
+                        double[] scores = setStuScore(mergescores, stuscore);//计算学生小题得分
561 558
                         String[] cores2 = new String[0];
562 559
                         if (corrected) cores2 = cores[j].split(",");
563 560
                         for (int i = 0; i < mptqids.length; i++) {
@@ -639,6 +636,19 @@ public class MsPaperCheckTeacherTaskService {
639 636
         if (checked == 3) msPaperStudentMapper.updateStudentPaperScoreByMpsId(mpsid);//更新学生总分
640 637
     }
641 638
 
639
+    //计算学生小题得分
640
+    private double[] setStuScore(String[] mergescores, Double stuscore) {
641
+        double totalScore = 0;
642
+        for (String mergescore : mergescores) {
643
+            totalScore = MarkingUtil.add(mergescore, totalScore);
644
+        }
645
+        double[] scores = new double[mergescores.length];
646
+        for (int i = 0; i < mergescores.length; i++) {
647
+            scores[i] = MarkingUtil.mul(stuscore, MarkingUtil.div(mergescores[i], totalScore));
648
+        }
649
+        return scores;
650
+    }
651
+
642 652
     //最终得分计算
643 653
     private Double getUserScore(Integer finalscore, double addScore, Double roundvalue) {
644 654
         double score;

+ 2
- 2
smarking/src/main/resources/mapper/exam/MsSubjectMapper.xml Прегледај датотеку

@@ -12,8 +12,8 @@
12 12
     <!--考试进度总览-->
13 13
     <select id="examOverview" resultType="java.util.Map">
14 14
         select s.msid,s.subjectid,s.subjectname,s.sdate,s.begintime,s.endtime,s.msstate,s.pstate,s.ptstate,
15
-        s.pbstate,s.checkset,s.checkstate,s.invigilatestate,p.answered,p.ptype,p.cutstate,s.teacherid,
16
-        u.username as teachername,p.mpid,p.yjstate,p.cutstate,e.exammode,e.examstate,e.hashb,e.gradeid,s.leaderid,u2.username as leadername
15
+        s.pbstate,s.checkset,s.checkstate,s.invigilatestate,p.answered,p.ptype,s.teacherid,
16
+        u.username as teachername,p.mpid,p.yjstate,e.exammode,e.examstate,e.hashb,e.gradeid,s.leaderid,u2.username as leadername
17 17
         ,if(ps.batchid is not null,ps.mpsid,null) scannum,count(ps.mpsid) stunum
18 18
         from ms_subject s left join t_user u on s.teacherid=u.userid
19 19
         left join t_user u2 on s.leaderid=u2.userid

Loading…
Откажи
Сачувај