Browse Source

批阅、仲裁

ywx
雍文秀 1 month ago
parent
commit
146000a7b9

+ 32
- 0
smarking/src/main/java/com/xhkjedu/smarking/controller/papercheck/MsPaperCheckTeacherArbitrateController.java View File

@@ -204,4 +204,36 @@ public class MsPaperCheckTeacherArbitrateController {
204 204
         PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
205 205
         return new ResultVo(0, "查询成功", pageResult);
206 206
     }
207
+
208
+    /**
209
+     * @Description 仲裁历史详情
210
+     * @Date 2024/11/20 9:14
211
+     * @Author YWX
212
+     * @Param [param]
213
+     * @Return com.xhkjedu.vo.ResultVo
214
+     **/
215
+    @PostMapping("/detail_history")
216
+    public ResultVo detailHistory(@RequestBody MsCheckParam param) {
217
+        N_Utils.validation(new Object[]{
218
+                param.getMpctaid(), "任务ID", 1
219
+                , param.getMpid(), "批阅设置", 1
220
+        });
221
+        return new ResultVo(0, "查询成功", msPaperCheckTeacherArbitrateService.detailHistory(param));
222
+    }
223
+
224
+    /**
225
+     * @Description 初评分
226
+     * @Date 2024/11/20 9:31
227
+     * @Author YWX
228
+     * @Param [param]
229
+     * @Return com.xhkjedu.vo.ResultVo
230
+     **/
231
+    @PostMapping("/get_score")
232
+    public ResultVo getScore(@RequestBody MsCheckParam param) {
233
+        N_Utils.validation(new Object[]{
234
+                param.getMpsbid(), "学生题块ID", 1
235
+                , param.getCorrecttype(), "批阅设置", 1
236
+        });
237
+        return new ResultVo(0, "查询成功", msPaperCheckTeacherArbitrateService.getScore(param));
238
+    }
207 239
 }

+ 4
- 4
smarking/src/main/java/com/xhkjedu/smarking/controller/papercheck/MsPaperCheckTeacherTaskController.java View File

@@ -297,13 +297,13 @@ public class MsPaperCheckTeacherTaskController {
297 297
      * @Param [param]
298 298
      * @Return com.xhkjedu.vo.ResultVo
299 299
      **/
300
-    @PostMapping("/detail_correct")
301
-    public ResultVo detailCorrect(@RequestBody MsCheckParam param) {
300
+    @PostMapping("/detail_history")
301
+    public ResultVo detailHistory(@RequestBody MsCheckParam param) {
302 302
         N_Utils.validation(new Object[]{
303 303
                 param.getMpcttid(), "任务ID", 1
304
-                , param.getMpid(), "试卷ID", 1
304
+                , param.getCorrecttype(), "试卷ID", 1
305 305
         });
306
-        return new ResultVo(0, "查询成功", msPaperCheckTeacherTaskService.detailCorrect(param));
306
+        return new ResultVo(0, "查询成功", msPaperCheckTeacherTaskService.detailHistory(param));
307 307
     }
308 308
 
309 309
     /**

+ 6
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/papercheck/MsPaperCheckTeacherArbitrateMapper.java View File

@@ -42,4 +42,10 @@ public interface MsPaperCheckTeacherArbitrateMapper extends TkMapper<MsPaperChec
42 42
 
43 43
     //仲裁历史
44 44
     List<Map> listArbitrateHistory(@Param("param") MsCheckParam param);
45
+
46
+    //仲裁历史详情
47
+    Map detailHistory(@Param("param") MsCheckParam param);
48
+
49
+    //初评分
50
+    List<Map> getScore(@Param("param") MsCheckParam param);
45 51
 }

+ 4
- 1
smarking/src/main/java/com/xhkjedu/smarking/mapper/papercheck/MsPaperCheckTeacherTaskMapper.java View File

@@ -25,6 +25,9 @@ public interface MsPaperCheckTeacherTaskMapper extends TkMapper<MsPaperCheckTeac
25 25
     //批量保存或更新
26 26
     void batchSave(@Param("tasks") List<MsPaperCheckTeacherTask> tasks);
27 27
 
28
+    //保存或更新单个任务
29
+    void save(@Param("s") MsPaperCheckTeacherTask task);
30
+
28 31
     //阅卷进度-按题块
29 32
     List<Map> listByBlock(@Param("mpid") Integer mpid);
30 33
 
@@ -102,7 +105,7 @@ public interface MsPaperCheckTeacherTaskMapper extends TkMapper<MsPaperCheckTeac
102 105
     List<Map> listCorrectHistory(@Param("param") MsCheckParam param);
103 106
 
104 107
     //教师阅卷-历史详情
105
-    Map detailCorrect(@Param("param") MsCheckParam param);
108
+    Map detailHistory(@Param("param") MsCheckParam param);
106 109
 
107 110
     //教师阅卷-平均分
108 111
     Map avgScore(@Param("param") MsCheckParam param);

+ 37
- 0
smarking/src/main/java/com/xhkjedu/smarking/service/papercheck/MsPaperCheckTeacherArbitrateService.java View File

@@ -311,4 +311,41 @@ public class MsPaperCheckTeacherArbitrateService {
311 311
     public List<Map> listArbitrateHistory(MsCheckParam param) {
312 312
         return msPaperCheckTeacherArbitrateMapper.listArbitrateHistory(param);
313 313
     }
314
+
315
+    /**
316
+     * @Description 仲裁历史详情
317
+     * @Date 2024/11/20 9:13
318
+     * @Author YWX
319
+     * @Param [param]
320
+     * @Return java.util.Map
321
+     **/
322
+    public Map detailHistory(MsCheckParam param) {
323
+        return msPaperCheckTeacherArbitrateMapper.detailHistory(param);
324
+    }
325
+
326
+    /**
327
+     * @Description 初评分
328
+     * @Date 2024/11/20 9:31
329
+     * @Author YWX
330
+     * @Param [param]
331
+     * @Return java.util.List<java.util.Map>
332
+     **/
333
+    public List<Map> getScore(MsCheckParam param) {
334
+        List<Map> score = msPaperCheckTeacherArbitrateMapper.getScore(param);
335
+        for (Map map : score) {
336
+            double diffscore1 = 0;
337
+            double diffscore2 = 0;
338
+            if (map.get("scoreway").equals(2)) {
339
+                Object qscore = map.get("qscore");
340
+                Object diffscore = map.get("diffscore");
341
+                double scoreDiff1 = MarkingUtil.scoreDiff(map.get("firstccore"), qscore);
342
+                double scoreDiff2 = MarkingUtil.scoreDiff(map.get("secondcscore"), qscore);
343
+                diffscore1 = MarkingUtil.sub(diffscore, scoreDiff1);
344
+                diffscore2 = MarkingUtil.sub(diffscore, scoreDiff2);
345
+            }
346
+            map.put("diffscore1", diffscore1);
347
+            map.put("diffscore2", diffscore2);
348
+        }
349
+        return score;
350
+    }
314 351
 }

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

@@ -228,6 +228,7 @@ public class MsPaperCheckTeacherTaskService {
228 228
         Integer totalNum = 0;
229 229
         Integer checkedNum = 0;
230 230
         if (sq != null) {
231
+            sq.setMpid(param.getMpid());
231 232
             MsPaperCheckTeacher teacher = msPaperCheckTeacherTaskMapper.getCheckNum(paperCheck);
232 233
             totalNum = teacher.getTasknum();
233 234
             checkedNum = teacher.getCheckednum();
@@ -259,7 +260,7 @@ public class MsPaperCheckTeacherTaskService {
259 260
                 task.setCheckstate(2);
260 261
                 task.setChecktype(checktype);
261 262
                 task.setCreatetime(N_Utils.getSecondTimestamp());
262
-                msPaperCheckTeacherTaskMapper.insertSelective(task);
263
+                msPaperCheckTeacherTaskMapper.save(task);
263 264
             }
264 265
             if (correcttype.equals(3)) {//按题块批阅
265 266
                 MsPaperStudentBlock block = new MsPaperStudentBlock();
@@ -274,7 +275,7 @@ public class MsPaperCheckTeacherTaskService {
274 275
             } else {//按试题/班级批阅
275 276
                 MsPaperStudentQuestion question = new MsPaperStudentQuestion();
276 277
                 question.setMpsqid(sq.getMpsbid());
277
-                question.setChecked(1);
278
+                question.setChecked(2);
278 279
                 if (checktype.equals(1)) {
279 280
                     question.setFirstcid(handleid);
280 281
                 } else {
@@ -677,10 +678,8 @@ public class MsPaperCheckTeacherTaskService {
677 678
      * @Param [param]
678 679
      * @Return java.util.Map
679 680
      **/
680
-    public Map detailCorrect(MsCheckParam param) {
681
-        Integer correcttype = msPaperMapper.getCorrectTypeByMpId(param.getMpid());
682
-        param.setCorrecttype(correcttype);
683
-        return msPaperCheckTeacherTaskMapper.detailCorrect(param);
681
+    public Map detailHistory(MsCheckParam param) {
682
+        return msPaperCheckTeacherTaskMapper.detailHistory(param);
684 683
     }
685 684
 
686 685
     /**

+ 2
- 0
smarking/src/main/java/com/xhkjedu/smarking/vo/papercheck/MsCheckParam.java View File

@@ -40,4 +40,6 @@ public class MsCheckParam extends BaseBean {
40 40
     private Integer mpcttid;
41 41
     //科目id
42 42
     private String subjectid;
43
+    //阅卷仲裁教师任务ID
44
+    private Integer mpctaid;
43 45
 }

+ 1
- 1
smarking/src/main/java/com/xhkjedu/smarking/vo/papercheck/MsPaperCheckVo.java View File

@@ -30,7 +30,7 @@ public class MsPaperCheckVo {
30 30
     private String stuanswer;
31 31
     //试题分值
32 32
     private Double qscore;
33
-    //是否批改0未批改1批改中2已批改
33
+    //是否批阅0默认1待批阅2批阅中3已批阅
34 34
     private Integer checked;
35 35
     //单评批改人
36 36
     private Integer firstcid;

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

@@ -66,6 +66,7 @@
66 66
     <!--根据题块id获取阅卷信息-->
67 67
     <select id="findByMBlockId" resultType="com.xhkjedu.smarking.model.papercheck.MsPaperCheck">
68 68
         select mpcid,mpid,mblockid,checktype,arbitrateid,diffscore,hidefirstscore,scoreway,finalscore,roundvalue,dispenseway
69
+        ,checkstate,correcttype
69 70
         from ms_paper_check where mpid = #{mpid} and mblockid = #{mblockid}
70 71
     </select>
71 72
     <!--获取学生作答及批阅信息(按题块)-->

+ 26
- 0
smarking/src/main/resources/mapper/papercheck/MsPaperCheckTeacherArbitrateMapper.xml View File

@@ -161,4 +161,30 @@
161 161
         </if>
162 162
         order by pcta.mpsbid desc
163 163
     </select>
164
+    <!--仲裁历史详情-->
165
+    <select id="detailHistory" resultType="java.util.Map">
166
+        select psq.stuanswer,mpcta.checkscore,mpcta.hasproblem,mpcta.problemtype,mpcta.problemcomm
167
+        ,mpcta.mpid,mpcta.mblockid,mpcta.mpsbid,mpcta.mptqid,mpcta.taskorder
168
+        from ms_paper_check_teacher_arbitrate mpcta
169
+        <if test="param.correcttype==3">
170
+            inner join ms_paper_student_block psq on mpcta.mpsbid=psq.mpsbid
171
+        </if>
172
+        <if test="param.correcttype==2">
173
+            inner join ms_paper_student_question psq on mpcta.mpsbid=psq.mpsqid
174
+        </if>
175
+        where mpcta.mpctaid=#{param.mpctaid}
176
+    </select>
177
+    <!--初评分-->
178
+    <select id="getScore" resultType="java.util.Map">
179
+        select psq.firstccore,psq.secondcscore,psq.qscore,psq.qorder,psq.qn
180
+        ,pc.diffscore,pc.scoreway
181
+        from ms_paper_student_question psq inner join ms_paper_check pc on psq.mpid=pc.mpid
182
+        <if test="param.correcttype==3">
183
+            where psq.mpsbid=#{param.mpsbid} and psq.mblockid=pc.mblockid
184
+        </if>
185
+        <if test="param.correcttype==2">
186
+            where psq.mpsqid=#{param.mpsbid} and psq.mptqid=pc.mblockid
187
+        </if>
188
+        order by psq.mpsqid
189
+    </select>
164 190
 </mapper>

+ 68
- 43
smarking/src/main/resources/mapper/papercheck/MsPaperCheckTeacherTaskMapper.xml View File

@@ -9,6 +9,12 @@
9 9
             on duplicate key update taskorder=#{s.taskorder},checktype=#{s.checktype}
10 10
         </foreach>
11 11
     </insert>
12
+    <!--保存或更新单个任务-->
13
+    <insert id="save">
14
+        insert into ms_paper_check_teacher_task (mpid, mblockid, teacherid, taskorder, mpsbid, checktype, createtime)
15
+        values (#{s.mpid},#{s.mblockid},#{s.teacherid},#{s.taskorder},#{s.mpsbid},#{s.checktype},#{s.createtime})
16
+        on duplicate key update taskorder=#{s.taskorder},checktype=#{s.checktype}
17
+    </insert>
12 18
     <!--批量更新任务信息-->
13 19
     <update id="batchUpdate">
14 20
         update ms_paper_check_teacher_task
@@ -69,6 +75,7 @@
69 75
         <result property="blockorder" column="blockorder"/>
70 76
         <result property="bqnum" column="bqnum"/>
71 77
         <result property="checktype" column="checktype"/>
78
+        <result property="checkstate" column="checkstate"/>
72 79
         <result property="totalNum" column="totalNum"/>
73 80
         <result property="checkedNum" column="checkedNum"/>
74 81
         <result property="uncheckedNum" column="uncheckedNum"/>
@@ -81,13 +88,14 @@
81 88
         where u.userid = mct.teacherid and mct.mblockid = #{mblockid}
82 89
     </select>
83 90
     <select id="listByBlock" resultMap="blockResultMap">
84
-        select pc.mblockid,pb.blockname,pb.bqscore,pb.blockorder,pb.bqnum
85
-        ,pc.checktype,count(pctt.mpcttid) as totalNum,count(if(pctt.checkstate=3,1,null)) as checkedNum
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
86 93
         ,count(if(pctt.checkstate!=3,1,null))as uncheckedNum
94
+        ,(select group_concat(pbbq.bqn separator '、') from ms_paper_block_question pbbq where pbbq.mblockid = pb.mblockid) as bqn
87 95
         from ms_paper_check pc left join ms_paper_check_teacher_task pctt on pc.mpid = pctt.mpid
88
-        left join ms_paper_block pb on pc.mblockid = pb.mblockid
89
-        where pc.mpid=#{mpid}
90
-        group by pc.mblockid
96
+        right join ms_paper_block pb on pc.mblockid = pb.mblockid
97
+        where pb.mpid=#{mpid} and pb.blocktype= 2
98
+        group by pb.mblockid
91 99
         order by pb.blockorder
92 100
     </select>
93 101
     <!--阅卷进度-按题块-查看详情-->
@@ -194,7 +202,7 @@
194 202
         from ms_subject s inner join ms_exam e on s.examid = e.examid
195 203
         inner join ms_paper_check pc on pc.msid = s.msid
196 204
         inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid=pc.mpid
197
-        inner join ms_paper_student_block psb on psb.mblockid = pc.mblockid and psb.mpid = pc.mpid
205
+        inner join ms_paper_student_block psb on psb.mblockid = pc.mblockid and psb.mpid = pc.mpid and psb.checked!=0
198 206
         where e.schoolid=#{param.schoolid} and s.checkstate=1 and e.deleted=1 and pc.dispenseway=2 and pc.correcttype=3
199 207
         group by s.msid
200 208
         <if test="param.checktype==0">having 100>checkrate</if>
@@ -208,7 +216,7 @@
208 216
         from ms_subject s inner join ms_exam e on s.examid = e.examid
209 217
         inner join ms_paper_check pc on pc.msid = s.msid
210 218
         inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid=pc.mpid
211
-        inner join ms_paper_student_question psb on psb.mptqid = pc.mblockid and psb.mpid = pc.mpid
219
+        inner join ms_paper_student_question psb on psb.mptqid = pc.mblockid and psb.mpid = pc.mpid and psb.checked!=0
212 220
         where e.schoolid=#{param.schoolid} and s.checkstate=1 and e.deleted=1 and pc.dispenseway=2 and pc.correcttype=2
213 221
         group by s.msid
214 222
         <if test="param.checktype==0">having 100>checkrate</if>
@@ -223,7 +231,7 @@
223 231
         inner join ms_paper_check pc on pc.msid = s.msid
224 232
         inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid=pc.mpid
225 233
         inner join ms_class_student cs on cs.examid = e.examid and cs.subjectid = s.subjectid and cs.classid = pct.mblockid
226
-        inner join ms_paper_student_question psb on psb.studentid = cs.studentid and psb.mpid = pc.mpid
234
+        inner join ms_paper_student_question psb on psb.studentid = cs.studentid and psb.mpid = pc.mpid and psb.checked!=0
227 235
         where e.schoolid=#{param.schoolid} and s.checkstate=1 and e.deleted=1 and pc.dispenseway=2 and pc.correcttype=1
228 236
         group by s.msid
229 237
         <if test="param.checktype==0">having 100>checkrate</if>
@@ -252,7 +260,7 @@
252 260
             ,count(distinct if(psb.firstcime is null,psb.mpsbid,null))+count(distinct if(pc.checktype=2 and psb.secondctime is null,psb.mpsbid,null)) as totalUncheckedNum
253 261
             ,count(distinct if((psb.firstcime is not null and psb.firstcid=#{param.handleid}) or (psb.secondctime is not null and psb.secondcid=#{param.handleid}),psb.mpsbid,null)) as myCheckedNum
254 262
             ,count(distinct if(((psb.firstcime is null and psb.firstcid=#{param.handleid})
255
-            or (psb.secondctime is null and psb.secondcid=#{param.handleid}) or pc.dispenseway=2) and psb.checked!=2
263
+            or (psb.secondctime is null and psb.secondcid=#{param.handleid}) or pc.dispenseway=2) and psb.checked in(1,2)
256 264
             ,psb.mpsbid,null)) as myUncheckedNum
257 265
             from ms_paper_check pc left join ms_paper_student_block psb on psb.mblockid = pc.mblockid and psb.mpid = pc.mpid
258 266
             and (psb.firstcid = #{param.handleid} or psb.secondcid = #{param.handleid} or pc.dispenseway=2)
@@ -266,11 +274,11 @@
266 274
             select pb.qorder,pb.qn
267 275
             ,pc.mblockid,pc.checktype,pc.dispenseway,pc.numtype
268 276
             ,count(distinct psb.mpsqid)*pc.checktype as totalNum
269
-            ,count(distinct if(psb.firstcime is not null,psb.mpsqid,null))+count(distinct if(psb.secondctime is not null,psb.mpsqid,null)) as totalCheckedNum
277
+            ,count(distinct if(psb.firstcime>0,psb.mpsqid,null))+count(distinct if(psb.secondctime>0,psb.mpsqid,null)) as totalCheckedNum
270 278
             ,count(distinct if(psb.firstcime is null,psb.mpsqid,null))+count(distinct if(pc.checktype=2 and psb.secondctime is null,psb.mpsqid,null)) as totalUncheckedNum
271
-            ,count(distinct if((psb.firstcime is not null and psb.firstcid=#{param.handleid}) or (psb.secondctime is not null and psb.secondcid=#{param.handleid}),psb.mpsqid,null)) as myCheckedNum
279
+            ,count(distinct if((psb.firstcime>0 and psb.firstcid=#{param.handleid}) or (psb.secondctime>0 and psb.secondcid=#{param.handleid}),psb.mpsqid,null)) as myCheckedNum
272 280
             ,count(distinct if(((psb.firstcime is null and psb.firstcid=#{param.handleid})
273
-            or (psb.secondctime is null and psb.secondcid=#{param.handleid}) or pc.dispenseway=2) and psb.checked!=2
281
+            or (psb.secondctime is null and psb.secondcid=#{param.handleid}) or pc.dispenseway=2) and psb.checked in(1,2)
274 282
             ,psb.mpsqid,null)) as myUncheckedNum
275 283
             from ms_paper_check pc left join ms_paper_student_question psb on psb.mptqid = pc.mblockid and psb.mpid = pc.mpid
276 284
             and (psb.firstcid = #{param.handleid} or psb.secondcid = #{param.handleid} or pc.dispenseway=2) and psb.answered=1
@@ -288,7 +296,7 @@
288 296
             ,count(distinct if(psb.firstcime is null,psb.mpsqid,null))+count(distinct if(pc.checktype=2 and psb.secondctime is null,psb.mpsqid,null)) as totalUncheckedNum
289 297
             ,count(distinct if((psb.firstcime is not null and psb.firstcid=#{param.handleid}) or (psb.secondctime is not null and psb.secondcid=#{param.handleid}),psb.mpsqid,null)) as myCheckedNum
290 298
             ,count(distinct if(((psb.firstcime is null and psb.firstcid=#{param.handleid})
291
-            or (psb.secondctime is null and psb.secondcid=#{param.handleid}) or pc.dispenseway=2) and psb.checked!=2
299
+            or (psb.secondctime is null and psb.secondcid=#{param.handleid}) or pc.dispenseway=2) and psb.checked in(1,2)
292 300
             ,psb.mpsqid,null)) as myUncheckedNum
293 301
             from ms_paper_check pc inner join ms_class c on pc.mblockid = c.classid
294 302
             inner join ms_class_student cs on c.examid=cs.examid and c.subjectid=cs.subjectid and pc.mblockid=cs.classid
@@ -354,7 +362,7 @@
354 362
         ,pc.checkstate,pc.correcttype,pc.mpid
355 363
         from ms_paper_check pc inner join ms_paper_student_block psb on psb.mblockid = pc.mblockid and psb.mpid = pc.mpid
356 364
         inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
357
-        where pc.checkstate=1 and psb.checked!=2 and pc.mpid=#{param.mpid}
365
+        where pc.checkstate=1 and psb.checked in(1,2) and pc.mpid=#{param.mpid}
358 366
         group by pc.mblockid
359 367
         order by pc.mpcid
360 368
     </select>
@@ -376,13 +384,15 @@
376 384
             ,psb.firstccore,psb.secondcscore,psb.firstccores,psb.secondcscores
377 385
             from ms_paper_student_block psb
378 386
             where psb.mpid=#{param.mpid} and psb.mblockid = #{param.mblockid}
379
-            and (psb.checked=1 or (psb.checked=2 and (psb.firstcid=#{param.teacherid}
387
+            and (psb.checked=1 or (psb.checked=2 and ((psb.firstcid=#{param.teacherid} and psb.firstcime is null)
380 388
             <if test="param.checktype==2">
381
-                or psb.secondcid=#{param.teacherid}
389
+                or (psb.secondcid=#{param.teacherid} and psb.secondctime is null)
390
+                or (psb.firstcid!=#{param.teacherid} and psb.secondcid is null)
391
+                or (psb.secondcid!=#{param.teacherid} and psb.firstcid is null)
382 392
             </if>
383 393
             )))
384 394
             and psb.hasproblem=0
385
-            order by field(psb.checked,1,0,2)
395
+            order by field(psb.checked,2,1,3)
386 396
             limit 1
387 397
         </if>
388 398
     </select>
@@ -394,13 +404,14 @@
394 404
         <result property="mblockid" column="mblockid"/>
395 405
         <result property="mpid" column="mpid"/>
396 406
         <result property="checktype" column="checktype"/>
407
+        <result property="checkstate" column="checkstate"/>
397 408
         <result property="totalNum" column="totalNum"/>
398 409
         <result property="checkedNum" column="checkedNum"/>
399 410
         <result property="uncheckedNum" column="uncheckedNum"/>
400 411
         <collection property="teachers" select="listCheckTeacher" column="mblockid"/>
401 412
     </resultMap>
402 413
     <select id="listByQuestion" resultMap="questionResultMap">
403
-        select q.qorder,q.qn,q.qscore,q.mptqid as mblockid,q.mpid,pc.checktype
414
+        select q.qorder,q.qn,q.qscore,q.mptqid as mblockid,q.mpid,pc.checktype,pc.checkstate
404 415
         ,count(distinct psq.mpsqid) as totalNum
405 416
         ,count(if(psq.firstcime is not null or psq.secondctime is not null,psq.mpsqid,null)) as checkedNum
406 417
         ,count(if(psq.firstcime is null or (pc.checktype=2 and psq.secondctime is null),psq.mpsqid,null)) as uncheckedNum
@@ -445,13 +456,14 @@
445 456
         <result property="mblockid" column="mblockid"/>
446 457
         <result property="mpid" column="mpid"/>
447 458
         <result property="checktype" column="checktype"/>
459
+        <result property="checkstate" column="checkstate"/>
448 460
         <result property="totalNum" column="totalNum"/>
449 461
         <result property="checkedNum" column="checkedNum"/>
450 462
         <result property="uncheckedNum" column="uncheckedNum"/>
451 463
         <collection property="teachers" select="listCheckTeacher" column="mblockid"/>
452 464
     </resultMap>
453 465
     <select id="listByClass" resultMap="classResultMap">
454
-        select c.classname,c.classid as mblockid,pc.mpid,pc.checktype
466
+        select c.classname,c.classid as mblockid,pc.mpid,pc.checktype,pc.checkstate
455 467
         ,count(distinct psq.mpsqid) as totalNum
456 468
         ,count(if(psq.firstcime is not null or psq.secondctime is not null,psq.mpsqid,null)) as checkedNum
457 469
         ,count(if(psq.firstcime is null or (pc.checktype=2 and psq.secondctime is null),psq.mpsqid,null)) as uncheckedNum
@@ -481,7 +493,7 @@
481 493
         ,pc.checkstate,pc.correcttype,pc.mpid
482 494
         from ms_paper_check pc inner join ms_paper_student_question psb on psb.mptqid = pc.mblockid and psb.mpid = pc.mpid
483 495
         inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
484
-        where pc.checkstate=1 and psb.checked!=2 and pc.mpid=#{param.mpid}
496
+        where pc.checkstate=1 and psb.checked in(1,2) and pc.mpid=#{param.mpid}
485 497
         group by pc.mblockid
486 498
         order by pc.mpcid
487 499
     </select>
@@ -503,13 +515,15 @@
503 515
             ,psb.firstccore,psb.secondcscore
504 516
             from ms_paper_student_question psb
505 517
             where psb.mpid=#{param.mpid} and psb.mptqid = #{param.mblockid}
506
-            and (psb.checked=1 or (psb.checked=2 and (psb.firstcid=#{param.teacherid}
518
+            and (psb.checked=1 or (psb.checked=2 and ((psb.firstcid=#{param.teacherid} and psb.firstcime is null)
507 519
             <if test="param.checktype==2">
508
-                or psb.secondcid=#{param.teacherid}
520
+                or (psb.secondcid=#{param.teacherid} and psb.secondctime is null)
521
+                or (psb.firstcid!=#{param.teacherid} and psb.secondcid is null)
522
+                or (psb.secondcid!=#{param.teacherid} and psb.firstcid is null)
509 523
             </if>
510 524
             )))
511 525
             and psb.hasproblem=0
512
-            order by field(psb.checked,1,0,2)
526
+            order by field(psb.checked,2,1,3)
513 527
             limit 1
514 528
         </if>
515 529
     </select>
@@ -519,7 +533,7 @@
519 533
         ,pc.checkstate,pc.correcttype,pc.mpid
520 534
         from ms_paper_check pc inner join ms_paper_student_question psb on psb.mpid = pc.mpid
521 535
         inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
522
-        where pc.checkstate=1 and psb.checked!=2 and pc.mpid=#{param.mpid}
536
+        where pc.checkstate=1 and psb.checked in(1,2) and pc.mpid=#{param.mpid}
523 537
         group by pc.mblockid
524 538
         order by pc.mpcid
525 539
     </select>
@@ -541,13 +555,15 @@
541 555
             ,psb.firstccore,psb.secondcscore
542 556
             from ms_paper_student_question psb inner join ms_class c on psb.mpid=c.mpid
543 557
             where psb.mpid=#{param.mpid} and c.classid = #{param.mblockid}
544
-            and (psb.checked=1 or (psb.checked=2 and (psb.firstcid=#{param.teacherid}
558
+            and (psb.checked=1 or (psb.checked=2 and ((psb.firstcid=#{param.teacherid} and psb.firstcime is null)
545 559
             <if test="param.checktype==2">
546
-                or psb.secondcid=#{param.teacherid}
560
+                or (psb.secondcid=#{param.teacherid} and psb.secondctime is null)
561
+                or (psb.firstcid!=#{param.teacherid} and psb.secondcid is null)
562
+                or (psb.secondcid!=#{param.teacherid} and psb.firstcid is null)
547 563
             </if>
548 564
             )))
549 565
             and psb.hasproblem=0
550
-            order by field(psb.checked,1,0,2),psb.mptqid
566
+            order by field(psb.checked,2,1,3),psb.mptqid
551 567
             limit 1
552 568
         </if>
553 569
     </select>
@@ -619,7 +635,7 @@
619 635
         order by pctt.taskorder desc
620 636
     </select>
621 637
     <!--教师阅卷-历史详情-->
622
-    <select id="detailCorrect" resultType="java.util.Map">
638
+    <select id="detailHistory" resultType="java.util.Map">
623 639
         select psq.stuanswer,pctt.checkscore,pctt.hasproblem,pctt.problemtype,pctt.problemcomm
624 640
         ,pctt.mpid,pctt.mblockid,pctt.mpsbid,pctt.mptqid,pctt.taskorder
625 641
         from ms_paper_check_teacher_task pctt
@@ -629,6 +645,7 @@
629 645
         <if test="param.correcttype!=3">
630 646
             inner join ms_paper_student_question psq on pctt.mpsbid=psq.mpsqid
631 647
         </if>
648
+        where pctt.mpcttid=#{param.mpcttid}
632 649
     </select>
633 650
     <!--教师阅卷-平均分-->
634 651
     <select id="avgScore" resultType="java.util.Map">
@@ -643,27 +660,35 @@
643 660
     </select>
644 661
     <!--教师阅卷-待批阅数量-->
645 662
     <select id="getPendingCorrectNum" resultType="java.lang.Integer">
646
-        select count(if(pc.correcttype=3,if(pc.dispenseway=2
647
-        ,(select psb.mpsbid from ms_paper_student_block psb
648
-        where psb.mpid=pct.mpid and psb.mblockid=pct.mblockid and psb.checked!=2 and psb.hasproblem=0 and psb.firstcid!=pct.teacherid and psb.secondcid!=pct.teacherid)
649
-        ,(select pctt.mpcttid from ms_paper_check_teacher_task pctt where pctt.mpid = pc.mpid and pctt.teacherid = #{param.handleid} and pctt.checkstate!=3)
663
+        select sum(a.num) from(select if(pc.correcttype=3,if(pc.dispenseway=2
664
+        ,(select count(psb.mpsbid) from ms_paper_student_block psb
665
+        where psb.mpid=pct.mpid and psb.mblockid=pct.mblockid and psb.hasproblem=0
666
+        and (psb.checked=1 or (psb.checked=2 and ((psb.firstcid=pct.teacherid and psb.firstcime is null)
667
+            or (psb.secondcid=pct.teacherid and psb.secondctime is null)))))
668
+        ,(select count(pctt.mpcttid) from ms_paper_check_teacher_task pctt where pctt.mpid = pc.mpid and pctt.teacherid = #{param.handleid} and pctt.checkstate!=3)
650 669
         ),if(pc.dispenseway=2
651
-        ,(select psb.mpsqid from ms_paper_student_question psb
652
-        where psb.mpid=pct.mpid and psb.mblockid=pct.mblockid and psb.checked!=2 and psb.hasproblem=0 and psb.firstcid!=pct.teacherid and psb.secondcid!=pct.teacherid)
653
-        ,(select pctt.mpcttid from ms_paper_check_teacher_task pctt where  pctt.mpid = pc.mpid and pctt.teacherid = #{param.handleid} and pctt.checkstate!=3)
654
-        ))) as num
670
+        ,if(pc.correcttype=2,(select count(psb.mpsqid) from ms_paper_student_question psb
671
+        where psb.mpid=pct.mpid and psb.mptqid=pct.mblockid and psb.hasproblem=0
672
+        and (psb.checked=1 or (psb.checked=2 and ((psb.firstcid=pct.teacherid and psb.firstcime is null)
673
+        or (psb.secondcid=pct.teacherid and psb.secondctime is null)))))
674
+        ,(select count(psb.mpsqid) from ms_paper_student_question psb
675
+        inner join ms_class c on c.examid=psb.examid and c.subjectid=psb.subjectid and c.classid=pct.mblockid
676
+        inner join ms_class_student cs on c.examid=cs.examid and c.subjectid=cs.subjectid and pc.mblockid=cs.classid
677
+        where psb.mpid=pct.mpid and psb.mptqid=pct.mblockid and psb.hasproblem=0 and psb.studentid=cs.studentid
678
+        and (psb.checked=1 or (psb.checked=2 and ((psb.firstcid=pct.teacherid and psb.firstcime is null)
679
+        or (psb.secondcid=pct.teacherid and psb.secondctime is null))))))
680
+        ,(select count(pctt.mpcttid) from ms_paper_check_teacher_task pctt where  pctt.mpid = pc.mpid and pctt.teacherid = #{param.handleid} and pctt.checkstate!=3)
681
+        )) as num
655 682
         from ms_paper_check pc inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid
656
-        where pc.checkstate=1 and pct.teacherid = #{param.handleid}
683
+        where pc.checkstate=1 and pct.teacherid = #{param.handleid}) as a
657 684
     </select>
658 685
     <!--教师阅卷-待仲裁数量-->
659 686
     <select id="getPendingArbitrateNum" resultType="java.lang.Integer">
660
-        select count(case when pc.correcttype=3 then(select psb.mpsbid from ms_paper_student_block psb
687
+        select sum(a.num) from(select if(pc.correcttype=3,(select count(psb.mpsbid) from ms_paper_student_block psb
661 688
         where psb.mpid=pc.mpid and psb.mblockid=pc.mblockid and psb.arbitratestate=1)
662
-        when pc.correcttype=2 then (select psb.mpsqid from ms_paper_student_question psb
663
-        where psb.mpid=pc.mpid and psb.mptqid=pc.mblockid and psb.arbitratestate=1)
664
-        else (select psb.mpsqid from ms_paper_student_question psb inner join ms_class_student c on psb.examid=c.examid and psb.subjectid=c.subjectid and psb.studentid=c.studentid
665
-        where psb.mpid=pc.mpid and c.classid=pc.mblockid and psb.arbitratestate=1) end) as num
689
+        ,(select count(psb.mpsqid) from ms_paper_student_question psb
690
+        where psb.mpid=pc.mpid and psb.mptqid=pc.mblockid and psb.arbitratestate=1)) as num
666 691
         from ms_paper_check pc
667
-        where pc.checkstate=1 and pc.arbitrateid = #{param.handleid}
692
+        where pc.checkstate=1 and pc.arbitrateid = #{param.handleid}) as a
668 693
     </select>
669 694
 </mapper>

Loading…
Cancel
Save