Browse Source

批阅完善

wn
雍文秀 3 weeks ago
parent
commit
5df5af8dc8

+ 1
- 0
smarking/src/main/java/com/xhkjedu/smarking/service/exam/MsSubjectService.java View File

@@ -147,6 +147,7 @@ public class MsSubjectService {
147 147
         Map set = msSubjectMapper.getSet(examid, subjectid, exammode, monitored);
148 148
         set.put("exammode", exammode);
149 149
         set.put("monitored", monitored);
150
+        set.put("examstate", map.get("examstate"));
150 151
         return set;
151 152
     }
152 153
 }

+ 3
- 5
smarking/src/main/java/com/xhkjedu/smarking/service/papercheck/MsPaperCheckTeacherTaskService.java View File

@@ -70,14 +70,13 @@ public class MsPaperCheckTeacherTaskService {
70 70
             throw new ServiceException("该题块不存在");
71 71
         }
72 72
         Integer dispenseway = check.getDispenseway();
73
-        List<Map> list = msPaperCheckTeacherTaskMapper.detailByBlock(mpid, mblockid, dispenseway, check.getChecktype());
74
-        return setListNum(dispenseway, list);
73
+        return msPaperCheckTeacherTaskMapper.detailByBlock(mpid, mblockid, dispenseway, check.getChecktype());
75 74
     }
76 75
 
77 76
     //计算题块/试题的总数和未批阅的数量
78 77
     private List<Map> setListNum(Integer dispenseway, List<Map> list) {
79 78
         if (dispenseway.equals(2)) {
80
-            int totalNum = list.stream().mapToInt(m -> N_Utils.obj2Int(m.get("totalNum"))).sum();
79
+            int totalNum = N_Utils.obj2Int(list.get(0).get("totalNum"));
81 80
             int totalCheckedNum = list.stream().mapToInt(m -> N_Utils.obj2Int(m.get("checkedNum"))).sum();
82 81
             int uncheckedNum = totalNum - totalCheckedNum;
83 82
             for (Map m : list) {
@@ -324,8 +323,7 @@ public class MsPaperCheckTeacherTaskService {
324 323
             throw new ServiceException("该试题不存在");
325 324
         }
326 325
         Integer dispenseway = check.getDispenseway();
327
-        List<Map> list = msPaperCheckTeacherTaskMapper.detailByQuestion(mpid, mblockid, dispenseway, check.getChecktype());
328
-        return setListNum(dispenseway, list);
326
+        return msPaperCheckTeacherTaskMapper.detailByQuestion(mpid, mblockid, dispenseway, check.getChecktype());
329 327
     }
330 328
 
331 329
     /**

+ 1
- 1
smarking/src/main/resources/mapper/papercheck/MsPaperCheckMapper.xml View File

@@ -134,7 +134,7 @@
134 134
         ,if(pc.checktype=2,(select u.username from t_user u where u.userid=pc.arbitrateid),'') as arbitratename
135 135
         from ms_paper_qtype_question q left join ms_paper_check pc on q.mpid=pc.mpid
136 136
         inner join ms_paper p on q.mpid=p.mpid
137
-        where q.mpid=#{mpid} and q.ctype in(3,13,14,15)
137
+        where q.mpid=#{mpid} and q.qtype=2
138 138
     </select>
139 139
     <!--获取需要批阅的数量-->
140 140
     <select id="getNeedCheckNum" resultType="java.lang.Integer">

+ 56
- 53
smarking/src/main/resources/mapper/papercheck/MsPaperCheckTeacherTaskMapper.xml View File

@@ -89,11 +89,11 @@
89 89
     </select>
90 90
     <select id="listByBlock" resultMap="blockResultMap">
91 91
         select pb.mblockid,pb.blockname,pb.bqscore,pb.blockorder,pb.bqnum
92
-        ,pc.checktype,pc.checkstate,count(pctt.mpcttid) as totalNum,count(if(pctt.checkstate=3,1,null)) as checkedNum
93
-        ,count(if(pctt.checkstate!=3,1,null))as uncheckedNum
92
+        ,pc.checktype,pc.checkstate,count(distinct psb.mpsbid) as totalNum,count(distinct if(psb.checked=3,psb.mpsbid,null)) as checkedNum
93
+        ,count(distinct if(psb.checked!=3,psb.mpsbid,null))as uncheckedNum
94 94
         ,(select group_concat(pbbq.bqn separator '、') from ms_paper_block_question pbbq where pbbq.mblockid = pb.mblockid) as bqn
95
-        from ms_paper_check pc left join ms_paper_check_teacher_task pctt on pc.mpid = pctt.mpid
96
-        right join ms_paper_block pb on pc.mblockid = pb.mblockid
95
+        from ms_paper_check pc right join ms_paper_block pb on pc.mpid=pb.mpid and pc.mblockid = pb.mblockid
96
+        left join ms_paper_student_block psb on psb.mpid=pc.mpid and psb.mblockid=pc.mblockid
97 97
         where pb.mpid=#{mpid} and pb.blocktype= 2
98 98
         group by pb.mblockid
99 99
         order by pb.blockorder
@@ -109,24 +109,25 @@
109 109
             group by pctt.teacherid
110 110
         </if>
111 111
         <if test="dispenseway!=null and dispenseway==2">
112
-            select pct.teacherid,u.username as teachername
113
-            ,sum(ifnull(t.totalNum,0)) as totalNum,sum(ifnull(t.checkedNum,0)) as checkedNum,sum(ifnull(t.uncheckedNum,0)) as uncheckedNum
114
-            from(select psb.firstcid as teacherid,count(*) as totalNum,count(if(psb.firstcime is not null,1,null)) as checkedNum
115
-            ,count(if(psb.firstcime is null,1,null)) as uncheckedNum
116
-            from ms_paper_student_block psb
117
-            where psb.mpid=#{mpid} and psb.mblockid=#{mblockid} and psb.firstcid is not null
118
-            group by psb.firstcid
119
-            <if test="checktype!=null and checktype==2">
120
-                union
121
-                select psb.secondcid as teacherid,count(*) as totalNum,count(if(psb.secondctime is not null,1,null)) as checkedNum
122
-                ,count(if(psb.secondctime is null,1,null)) as uncheckedNum
123
-                from ms_paper_student_block psb
124
-                where psb.mpid=#{mpid} and psb.mblockid=#{mblockid} and psb.secondcid is not null
125
-                group by psb.secondcid
126
-            </if>)t
127
-            right join ms_paper_check_teacher pct on t.teacherid = pct.teacherid and pct.mblockid = #{mblockid} and pct.mpid = #{mpid}
128
-            left join t_user u on pct.teacherid=u.userid
112
+            select t.*,u.username as teachername
113
+            from(select pct.teacherid,count(distinct psb.mpsbid) as totalNum
114
+            ,count(distinct if(((psb.firstcid=pct.teacherid and psb.firstcime is not null)
115
+            <if test="checktype==2">
116
+                or (psb.secondcid=pct.teacherid and psb.secondctime is not null)
117
+            </if>
118
+            )
119
+            ,psb.mpsbid,null)) as checkedNum
120
+            ,count(distinct if(psb.checked=1 or (psb.checked=2 and ((psb.firstcid=pct.teacherid and psb.firstcime is null)
121
+            <if test="checktype==2">
122
+                or (psb.secondcid=pct.teacherid and psb.secondctime is null)
123
+                or (psb.firstcid!=pct.teacherid and psb.secondcid is null)
124
+                or (psb.secondcid!=pct.teacherid and psb.firstcid is null)
125
+            </if>
126
+            )),psb.mpsbid,null)) as uncheckedNum
127
+            from ms_paper_check_teacher pct left join ms_paper_student_block psb on pct.mpid = psb.mpid and pct.mblockid = psb.mblockid
128
+            where pct.mpid=#{mpid} and pct.mblockid=#{mblockid}
129 129
             group by pct.teacherid
130
+            )t left join t_user u on t.teacherid=u.userid
130 131
         </if>
131 132
     </select>
132 133
     <!--阅卷进度-按教师-->
@@ -337,7 +338,7 @@
337 338
         <if test="param.correcttype==1">
338 339
             select pb.mptqid as mblockid,pb.qorder,pb.qn,pb.qscore
339 340
             from ms_paper_qtype_question pb
340
-            where pb.mpid=#{param.mpid} and pb.ctype in(3,13,14,15)
341
+            where pb.mpid=#{param.mpid} and pb.qtype=2
341 342
             group by pb.mptqid
342 343
             order by pb.qorder,pb.qn
343 344
         </if>
@@ -415,11 +416,11 @@
415 416
     <select id="listByQuestion" resultMap="questionResultMap">
416 417
         select q.qorder,q.qn,q.qscore,q.mptqid as mblockid,q.mpid,pc.checktype,pc.checkstate
417 418
         ,count(distinct psq.mpsqid) as totalNum
418
-        ,count(if(psq.firstcime is not null or psq.secondctime is not null,psq.mpsqid,null)) as checkedNum
419
-        ,count(if(psq.firstcime is null or (pc.checktype=2 and psq.secondctime is null),psq.mpsqid,null)) as uncheckedNum
420
-        from ms_paper_qtype_question q left join ms_paper_check pc on q.mpid=pc.mpid
419
+        ,count(distinct if(psq.checked=3,psq.mpsqid,null)) as checkedNum
420
+        ,count(distinct if(psq.checked!=3,psq.mpsqid,null)) as uncheckedNum
421
+        from ms_paper_qtype_question q left join ms_paper_check pc on q.mpid=pc.mpid and pc.mblockid=q.mptqid
421 422
         left join ms_paper_student_question psq on q.mptqid=psq.mptqid and psq.answered=1
422
-        where q.mpid=#{mpid} and q.ctype in(3,13,14,15)
423
+        where q.mpid=#{mpid} and q.qtype=2
423 424
         group by q.mptqid
424 425
         order by q.qorder,q.qn
425 426
     </select>
@@ -434,22 +435,25 @@
434 435
             group by pctt.teacherid
435 436
         </if>
436 437
         <if test="dispenseway!=null and dispenseway==2">
437
-            select t.teacherid,u.username as teachername
438
-            ,sum(t.totalNum) as totalNum,sum(t.checkedNum) as checkedNum,sum(t.uncheckedNum) as uncheckedNum
439
-            from(select psb.firstcid as teacherid,count(*) as totalNum,count(if(psb.firstcime is not null,1,null)) as checkedNum
440
-            ,count(if(psb.firstcime is null,1,null)) as uncheckedNum
441
-            from ms_paper_student_question psb
442
-            where psb.mpid=#{mpid} and psb.mptqid=#{mblockid}
443
-            group by psb.firstcid
444
-            <if test="checktype!=null and checktype==2">
445
-                union
446
-                select psb.secondcid as teacherid,count(*) as totalNum,count(if(psb.secondctime is not null,1,null)) as checkedNum
447
-                ,count(if(psb.secondctime is null,1,null)) as uncheckedNum
448
-                from ms_paper_student_question psb
449
-                where psb.mpid=#{mpid} and psb.mptqid=#{mblockid}
450
-                group by psb.secondcid
451
-            </if>)t left join t_user u on t.teacherid=u.userid
452
-            group by t.teacherid
438
+            select t.*,u.username as teachername
439
+            from(select pct.teacherid,count(distinct psb.mpsqid) as totalNum
440
+            ,count(distinct if(((psb.firstcid=pct.teacherid and psb.firstcime is not null)
441
+            <if test="checktype==2">
442
+                or (psb.secondcid=pct.teacherid and psb.secondctime is not null)
443
+            </if>
444
+            )
445
+            ,psb.mpsqid,null)) as checkedNum
446
+            ,count(distinct if(psb.checked=1 or (psb.checked=2 and ((psb.firstcid=pct.teacherid and psb.firstcime is null)
447
+            <if test="checktype==2">
448
+                or (psb.secondcid=pct.teacherid and psb.secondctime is null)
449
+                or (psb.firstcid!=pct.teacherid and psb.secondcid is null)
450
+                or (psb.secondcid!=pct.teacherid and psb.firstcid is null)
451
+            </if>
452
+            )),psb.mpsqid,null)) as uncheckedNum
453
+            from ms_paper_check_teacher pct left join ms_paper_student_question psb on pct.mpid=psb.mpid and pct.mblockid=psb.mptqid and psb.answered=1
454
+            where pct.mpid=#{mpid} and pct.mblockid=#{mblockid}
455
+            group by pct.teacherid
456
+            )t left join t_user u on t.teacherid=u.userid
453 457
         </if>
454 458
     </select>
455 459
     <!--阅卷进度-按班级-->
@@ -467,10 +471,10 @@
467 471
     <select id="listByClass" resultMap="classResultMap">
468 472
         select c.classname,c.classid as mblockid,pc.mpid,pc.checktype,pc.checkstate
469 473
         ,count(distinct psq.mpsqid) as totalNum
470
-        ,count(if(psq.firstcime is not null or psq.secondctime is not null,psq.mpsqid,null)) as checkedNum
471
-        ,count(if(psq.firstcime is null or (pc.checktype=2 and psq.secondctime is null),psq.mpsqid,null)) as uncheckedNum
474
+        ,count(distinct if(psq.checked=3,psq.mpsqid,null)) as checkedNum
475
+        ,count(distinct if(psq.checked!=3,psq.mpsqid,null)) as uncheckedNum
472 476
         from ms_class c inner join ms_paper_check pc on pc.mblockid=c.classid
473
-        left join ms_class_student cs on c.examid=cs.examid and c.subjectid=cs.subjectid and pc.mblockid=cs.classid
477
+        inner join ms_class_student cs on c.examid=cs.examid and c.subjectid=cs.subjectid and pc.mblockid=cs.classid
474 478
         left join ms_paper_student_question psq on pc.mpid=psq.mpid and psq.studentid=cs.studentid and psq.answered=1 and psq.ctype in(3,13,14,15)
475 479
         where pc.mpid=#{mpid} and c.subjectid=#{subjectid}
476 480
         group by c.classid
@@ -478,16 +482,15 @@
478 482
     </select>
479 483
     <!--阅卷进度-按班级-查看详情-->
480 484
     <select id="detailByClass" resultType="java.util.Map">
481
-        select t.teacherid,u.username as teachername
482
-        ,sum(t.totalNum) as totalNum,sum(t.checkedNum) as checkedNum
483
-        from(select pct.teacherid,count(psb.mpsqid) as totalNum,count(if(psb.firstcime is not null,1,null)) as checkedNum
484
-        from ms_paper_check_teacher pct left join ms_paper_student_question psb on psb.mpid=pct.mpid and psb.ctype in(3,13,14,15) and psb.firstcid=pct.teacherid
485
-        left join ms_class_student cs on psb.examid=cs.examid and psb.subjectid=cs.subjectid and psb.studentid=cs.studentid
485
+        select t.*,u.username as teachername
486
+        from(select pct.teacherid,count(distinct if(psb.answered=1,psb.mpsqid,null)) as totalNum
487
+        ,count(distinct if(psb.checked=3 and psb.firstcid=pct.teacherid,psb.mpsqid,null)) as checkedNum
488
+        from ms_paper_check_teacher pct left join ms_paper_student_question psb on psb.mpid=pct.mpid and psb.ctype in(3,13,14,15)
489
+        inner join ms_class_student cs on psb.examid=cs.examid and psb.subjectid=cs.subjectid and psb.studentid=cs.studentid
486 490
         and cs.classid=pct.mblockid
487 491
         where pct.mpid=#{mpid} and pct.mblockid=#{mblockid}
488 492
         group by pct.teacherid
489 493
         )t left join t_user u on t.teacherid=u.userid
490
-        group by t.teacherid
491 494
     </select>
492 495
     <!--教师阅卷-待批试题列表-->
493 496
     <select id="listQuestionCheck" resultType="com.xhkjedu.smarking.model.papercheck.MsPaperCheck">
@@ -703,14 +706,14 @@
703 706
     </select>
704 707
     <!--获取批阅结果-->
705 708
     <select id="getCheckResult" resultType="com.xhkjedu.smarking.vo.papercheck.MsCheckVo">
706
-        select psq.firstcid,psq.firstcime,psq.firstccore,psq.firstccores,psq.secondcid,psq.secondctime,psq.secondcscore,psq.secondcscores
709
+        select psq.firstcid,psq.firstcime,psq.firstccore,psq.secondcid,psq.secondctime,psq.secondcscore
707 710
         ,psq.mpsid
708 711
         <if test="param.correcttype==3">
709 712
             from ms_paper_student_block psq
710 713
             where psq.mpsbid=#{param.mpsbid}
711 714
         </if>
712 715
         <if test="param.correcttype!=3">
713
-            from ms_paper_student_block psq
716
+            from ms_paper_student_question psq
714 717
             where psq.mpsqid=#{param.mpsbid}
715 718
         </if>
716 719
     </select>

Loading…
Cancel
Save