Browse Source

题块批阅、进度总览完善

ywx
雍文秀 1 month ago
parent
commit
0d6a7581c1

+ 21
- 11
smarking/src/main/java/com/xhkjedu/smarking/service/papercheck/MsPaperCheckTeacherTaskService.java View File

406
                 checked = 3;
406
                 checked = 3;
407
             }
407
             }
408
             if (correcttype.equals(3)) {//按题块批阅
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
                 MsPaperStudentBlock block = new MsPaperStudentBlock();
411
                 MsPaperStudentBlock block = new MsPaperStudentBlock();
412
                 block.setMpsbid(mpsbid);
412
                 block.setMpsbid(mpsbid);
413
                 block.setChecked(checked);
413
                 block.setChecked(checked);
414
                 block.setFirstcid(handleid);
414
                 block.setFirstcid(handleid);
415
                 block.setFirstcime(N_Utils.getSecondTimestamp());
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
                 block.setFirstccores(stuscores);
417
                 block.setFirstccores(stuscores);
418
                 block.setFirstccore(arbitratescore);
418
                 block.setFirstccore(arbitratescore);
419
                 block.setHasgood(hasgood);
419
                 block.setHasgood(hasgood);
438
                         studentQuestions.add(studentQuestion);
438
                         studentQuestions.add(studentQuestion);
439
                     } else {
439
                     } else {
440
                         String[] mptqids = question.getMergeqid().split(",");
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
                         for (int i = 0; i < mptqids.length; i++) {
443
                         for (int i = 0; i < mptqids.length; i++) {
443
                             MsPaperStudentQuestion studentQuestion = new MsPaperStudentQuestion();
444
                             MsPaperStudentQuestion studentQuestion = new MsPaperStudentQuestion();
444
                             studentQuestion.setMptqid(N_Utils.obj2Int(mptqids[i]));
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
                             studentQuestions.add(studentQuestion);
448
                             studentQuestions.add(studentQuestion);
448
                         }
449
                         }
449
                     }
450
                     }
506
                 //题块批阅信息
507
                 //题块批阅信息
507
                 MsPaperStudentBlock block = new MsPaperStudentBlock();
508
                 MsPaperStudentBlock block = new MsPaperStudentBlock();
508
                 block.setMpsbid(mpsbid);
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
                 String[] cores = new String[0];
511
                 String[] cores = new String[0];
511
                 if (type.equals(1)) {
512
                 if (type.equals(1)) {
512
                     block.setFirstcid(handleid);
513
                     block.setFirstcid(handleid);
553
                     } else {
554
                     } else {
554
                         String[] mptqids = question.getMergeqid().split(",");
555
                         String[] mptqids = question.getMergeqid().split(",");
555
                         String[] mergescores = question.getMergescore().split(",");
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
                         String[] cores2 = new String[0];
558
                         String[] cores2 = new String[0];
562
                         if (corrected) cores2 = cores[j].split(",");
559
                         if (corrected) cores2 = cores[j].split(",");
563
                         for (int i = 0; i < mptqids.length; i++) {
560
                         for (int i = 0; i < mptqids.length; i++) {
639
         if (checked == 3) msPaperStudentMapper.updateStudentPaperScoreByMpsId(mpsid);//更新学生总分
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
     private Double getUserScore(Integer finalscore, double addScore, Double roundvalue) {
653
     private Double getUserScore(Integer finalscore, double addScore, Double roundvalue) {
644
         double score;
654
         double score;

+ 2
- 2
smarking/src/main/resources/mapper/exam/MsSubjectMapper.xml View File

12
     <!--考试进度总览-->
12
     <!--考试进度总览-->
13
     <select id="examOverview" resultType="java.util.Map">
13
     <select id="examOverview" resultType="java.util.Map">
14
         select s.msid,s.subjectid,s.subjectname,s.sdate,s.begintime,s.endtime,s.msstate,s.pstate,s.ptstate,
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
         ,if(ps.batchid is not null,ps.mpsid,null) scannum,count(ps.mpsid) stunum
17
         ,if(ps.batchid is not null,ps.mpsid,null) scannum,count(ps.mpsid) stunum
18
         from ms_subject s left join t_user u on s.teacherid=u.userid
18
         from ms_subject s left join t_user u on s.teacherid=u.userid
19
         left join t_user u2 on s.leaderid=u2.userid
19
         left join t_user u2 on s.leaderid=u2.userid

Loading…
Cancel
Save