Browse Source

教师阅卷

wn
雍文秀 1 month ago
parent
commit
22b27301e1

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

@@ -146,4 +146,20 @@ public class MsPaperCheckTeacherTaskController {
146 146
         List<Map> list = msPaperCheckTeacherTaskService.listByQuestion(mpid);
147 147
         return new ResultVo(0, "查询成功", list);
148 148
     }
149
+
150
+    /**
151
+     * @Description 阅卷进度-按试题-查看详情
152
+     * @Date 2024/11/11 9:24
153
+     * @Author YWX
154
+     * @Param [param]
155
+     * @Return com.xhkjedu.vo.ResultVo
156
+     **/
157
+    @PostMapping("/detail_by_question")
158
+    public ResultVo detailByQuestion(@RequestBody MsCheckParam param) {
159
+        Integer mpid = param.getMpid();
160
+        Integer mblockid = param.getMblockid();
161
+        N_Utils.validation(new Object[]{mpid, "试卷ID", 1, mblockid, "试题ID", 1});
162
+        List<Map> list = msPaperCheckTeacherTaskService.detailByQuestion(mpid, mblockid);
163
+        return new ResultVo(0, "查询成功", list);
164
+    }
149 165
 }

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/paper/MsPaperMapper.java View File

@@ -61,4 +61,7 @@ public interface MsPaperMapper extends TkMapper<MsPaper> {
61 61
 
62 62
     //获取试卷对应科目状态
63 63
     PExamSubjectVo getSubjectStateByMpid(@Param("mpid") Integer mpid);
64
+
65
+    //获取试卷批阅设置
66
+    Integer getCorrectTypeByMpId(@Param("mpid") Integer mpid);
64 67
 }

+ 29
- 9
smarking/src/main/java/com/xhkjedu/smarking/mapper/papercheck/MsPaperCheckTeacherTaskMapper.java View File

@@ -1,8 +1,7 @@
1 1
 package com.xhkjedu.smarking.mapper.papercheck;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.smarking.model.papercheck.MsPaperCheck;
5
-import com.xhkjedu.smarking.model.papercheck.MsPaperCheckTeacherTask;
4
+import com.xhkjedu.smarking.model.papercheck.*;
6 5
 import com.xhkjedu.smarking.vo.papercheck.MsCheckParam;
7 6
 import com.xhkjedu.smarking.vo.papercheck.MsPaperCheckVo;
8 7
 import org.apache.ibatis.annotations.Param;
@@ -34,7 +33,7 @@ public interface MsPaperCheckTeacherTaskMapper extends TkMapper<MsPaperCheckTeac
34 33
             , @Param("dispenseway") Integer dispenseway,@Param("checktype") Integer checktype);
35 34
 
36 35
     //阅卷进度-按教师
37
-    List<Map> listByTeacher(@Param("mpid") Integer mpid);
36
+    List<Map> listByTeacher(@Param("mpid") Integer mpid, @Param("correcttype") Integer correcttype);
38 37
 
39 38
     //教师阅卷-待阅卷列表
40 39
     List<Map> listPending(@Param("param") MsCheckParam param);
@@ -45,17 +44,38 @@ public interface MsPaperCheckTeacherTaskMapper extends TkMapper<MsPaperCheckTeac
45 44
     //教师阅卷-题块列表
46 45
     List<Map> listTeacherBlock(@Param("param") MsCheckParam param);
47 46
 
48
-    //获取题块阅卷信息
49
-    List<MsPaperCheck> listPaperCheck(@Param("param") MsCheckParam param);
47
+    //教师阅卷-待批题块列表
48
+    List<MsPaperCheck> listBlockCheck(@Param("param") MsCheckParam param);
50 49
 
51
-    //获取待批试题(平均、定量分配)
52
-    MsPaperCheckVo getCorrectBlock(@Param("param") MsCheckParam param);
53
-    //获取待批试题(效率优先)
54
-    MsPaperCheckVo getCorrectBlock2(@Param("param") MsCheckParam param);
50
+    //教师阅卷-按题块-获取待批试题
51
+    MsPaperCheckVo getCorrectBlock(@Param("param") MsPaperCheck param);
55 52
 
56 53
     //删除教师阅卷任务
57 54
     void deleteByMpsbids(@Param("mpsbids") String mpsbids);
58 55
 
59 56
     //阅卷进度-按试题
60 57
     List<Map> listByQuestion(@Param("mpid") Integer mpid,@Param("correcttype") Integer correcttype);
58
+
59
+    //阅卷进度-按试题-查看详情
60
+    List<Map> detailByQuestion(@Param("mpid") Integer mpid,@Param("mblockid") Integer mblockid
61
+            ,@Param("dispenseway") Integer dispenseway,@Param("checktype") Integer checktype);
62
+
63
+    //教师阅卷-待批试题列表
64
+    List<MsPaperCheck> listQuestionCheck(@Param("param") MsCheckParam param);
65
+
66
+    //教师阅卷-按试题-获取待批试题
67
+    MsPaperCheckVo getCorrectQuestion(@Param("param") MsPaperCheck param);
68
+
69
+    //教师阅卷-待批班级列表
70
+    List<MsPaperCheck> listClassCheck(@Param("param") MsCheckParam param);
71
+
72
+    //教师阅卷-按班级-获取待批试题
73
+    MsPaperCheckVo getCorrectClassQuestion(@Param("param") MsPaperCheck check);
74
+
75
+    //更新教师阅卷任务状态
76
+    void updateCheckStatus(@Param("mpid") Integer mpid, @Param("mpsbid") Integer mpsbid
77
+            , @Param("teacherid") Integer teacherid, @Param("checkstate") int checkstate);
78
+
79
+    //获取教师批阅数量
80
+    MsPaperCheckTeacher getCheckNum(@Param("param") MsPaperCheck paperCheck);
61 81
 }

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/papercheck/MsPaperCheck.java View File

@@ -57,5 +57,8 @@ public class MsPaperCheck extends BaseBean {
57 57
     @Transient
58 58
     //题块/试题/班级IDS
59 59
     private List<Integer> mblockids;
60
+    @Transient
61
+    //考试试题表id
62
+    private Integer mptqid;
60 63
 
61 64
 }

+ 127
- 22
smarking/src/main/java/com/xhkjedu/smarking/service/papercheck/MsPaperCheckTeacherTaskService.java View File

@@ -4,9 +4,13 @@ import com.xhkjedu.exception.ServiceException;
4 4
 import com.xhkjedu.smarking.mapper.paper.MsPaperMapper;
5 5
 import com.xhkjedu.smarking.mapper.papercheck.MsPaperCheckMapper;
6 6
 import com.xhkjedu.smarking.mapper.papercheck.MsPaperCheckTeacherTaskMapper;
7
+import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentBlockMapper;
8
+import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentQuestionMapper;
7 9
 import com.xhkjedu.smarking.mapper.system.UserMapper;
8
-import com.xhkjedu.smarking.model.paper.MsPaper;
9 10
 import com.xhkjedu.smarking.model.papercheck.MsPaperCheck;
11
+import com.xhkjedu.smarking.model.papercheck.MsPaperCheckTeacher;
12
+import com.xhkjedu.smarking.model.stupaper.MsPaperStudentBlock;
13
+import com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion;
10 14
 import com.xhkjedu.smarking.vo.papercheck.MsCheckParam;
11 15
 import com.xhkjedu.smarking.vo.papercheck.MsPaperCheckVo;
12 16
 import com.xhkjedu.utils.N_Utils;
@@ -32,6 +36,11 @@ public class MsPaperCheckTeacherTaskService {
32 36
     private MsPaperCheckMapper msPaperCheckMapper;
33 37
     @Resource
34 38
     private MsPaperMapper msPaperMapper;
39
+    @Resource
40
+    private MsPaperStudentBlockMapper msPaperStudentBlockMapper;
41
+    @Resource
42
+    private MsPaperStudentQuestionMapper msPaperStudentQuestionMapper;
43
+
35 44
 
36 45
     /**
37 46
      * @Description 阅卷进度-按题块
@@ -58,6 +67,11 @@ public class MsPaperCheckTeacherTaskService {
58 67
         }
59 68
         Integer dispenseway = check.getDispenseway();
60 69
         List<Map> list = msPaperCheckTeacherTaskMapper.detailByBlock(mpid, mblockid, dispenseway, check.getChecktype());
70
+        return setListNum(dispenseway, list);
71
+    }
72
+
73
+    //计算题块/试题的总数和未批阅的数量
74
+    private List<Map> setListNum(Integer dispenseway, List<Map> list) {
61 75
         if (dispenseway.equals(2)) {
62 76
             int totalNum = list.stream().mapToInt(m -> N_Utils.obj2Int(m.get("totalNum"))).sum();
63 77
             int totalCheckedNum = list.stream().mapToInt(m -> N_Utils.obj2Int(m.get("checkedNum"))).sum();
@@ -78,7 +92,11 @@ public class MsPaperCheckTeacherTaskService {
78 92
      * @Return java.util.List<java.util.Map>
79 93
      **/
80 94
     public List<Map> listByTeacher(Integer mpid) {
81
-        return msPaperCheckTeacherTaskMapper.listByTeacher(mpid);
95
+        Integer correcttype = msPaperMapper.getCorrectTypeByMpId(mpid);
96
+        if (!N_Utils.isTrueInteger(correcttype)) {
97
+            throw new ServiceException("该试卷未设置批阅方式");
98
+        }
99
+        return msPaperCheckTeacherTaskMapper.listByTeacher(mpid, correcttype);
82 100
     }
83 101
 
84 102
     /**
@@ -131,27 +149,101 @@ public class MsPaperCheckTeacherTaskService {
131 149
      * @Return java.util.Map
132 150
      **/
133 151
     public ResultVo getCorrectBlock(MsCheckParam param) {
134
-        setParam(param);
135
-
136
-        List<MsPaperCheck> checks = msPaperCheckTeacherTaskMapper.listPaperCheck(param);
137
-        if (N_Utils.isListEmpty(checks)) throw new ServiceException("暂无要批阅的题块");
152
+        Integer correcttype = msPaperMapper.getCorrectTypeByMpId(param.getMpid());
153
+        if (!N_Utils.isTrueInteger(correcttype)) {
154
+            throw new ServiceException("该试卷未设置批阅方式");
155
+        }
138 156
         MsPaperCheckVo sq = null;
139
-        for (MsPaperCheck check : checks) {
140
-            Integer checktype = check.getChecktype();
141
-            param.setChecktype(checktype);
142
-            Integer dispenseway = check.getDispenseway();
143
-            if (dispenseway.equals(2)) {//效率优先
144
-                param.setChecktype(check.getChecktype());
145
-                sq = msPaperCheckTeacherTaskMapper.getCorrectBlock2(param);
146
-            } else {
147
-                sq = msPaperCheckTeacherTaskMapper.getCorrectBlock(param);
157
+        Integer dispenseway = null;
158
+        Integer type = null;//评卷方式1单评2双评
159
+        Integer handleid = param.getHandleid();
160
+        MsPaperCheck paperCheck = null;
161
+        if (correcttype.equals(3)) {//按题块批阅
162
+            List<MsPaperCheck> checks = msPaperCheckTeacherTaskMapper.listBlockCheck(param);
163
+            if (N_Utils.isListEmpty(checks)) throw new ServiceException("暂无要批阅的题块");
164
+            for (MsPaperCheck check : checks) {
165
+                check.setTeacherid(handleid);
166
+                sq = msPaperCheckTeacherTaskMapper.getCorrectBlock(check);
167
+                if (sq != null) {
168
+                    paperCheck = check;
169
+                    break;
170
+                }
171
+            }
172
+        } else if (correcttype.equals(2)) {//按试题批阅
173
+            List<MsPaperCheck> checks = msPaperCheckTeacherTaskMapper.listQuestionCheck(param);
174
+            if (N_Utils.isListEmpty(checks)) throw new ServiceException("暂无要批阅的试题");
175
+            for (MsPaperCheck check : checks) {
176
+                check.setTeacherid(handleid);
177
+                sq = msPaperCheckTeacherTaskMapper.getCorrectQuestion(check);
178
+                if (sq != null) {
179
+                    paperCheck = check;
180
+                    break;
181
+                }
148 182
             }
149
-            if (sq != null) {
150
-                break;
183
+        } else {//按班级批阅
184
+            List<MsPaperCheck> checks = msPaperCheckTeacherTaskMapper.listClassCheck(param);
185
+            if (N_Utils.isListEmpty(checks)) throw new ServiceException("暂无要批阅的班级");
186
+            for (MsPaperCheck check : checks) {
187
+                check.setTeacherid(handleid);
188
+                sq = msPaperCheckTeacherTaskMapper.getCorrectClassQuestion(check);
189
+                if (sq != null) {
190
+                    paperCheck = check;
191
+                    break;
192
+                }
193
+            }
194
+        }
195
+
196
+        if (paperCheck != null) {
197
+            dispenseway = paperCheck.getDispenseway();
198
+            type = paperCheck.getChecktype();
199
+        }
200
+        Integer totalNum = 0;
201
+        Integer checkedNum = 0;
202
+        if (sq != null) {
203
+            MsPaperCheckTeacher teacher = msPaperCheckTeacherTaskMapper.getCheckNum(paperCheck);
204
+            totalNum = teacher.getTasknum();
205
+            checkedNum = teacher.getCheckednum();
206
+            if (!dispenseway.equals(2)) {
207
+                //更新教师阅卷任务状态
208
+                msPaperCheckTeacherTaskMapper.updateCheckStatus(sq.getMpid(), sq.getMpsbid(), handleid, 2);
209
+            }
210
+            Integer checktype = sq.getChecktype();
211
+            Integer firstcid = sq.getFirstcid();
212
+            if (!N_Utils.isTrueInteger(checktype)) {
213
+                if (type.equals(1)) {
214
+                    checktype = 1;
215
+                } else if (N_Utils.isTrueInteger(firstcid) && !handleid.equals(firstcid)) {
216
+                    checktype = 2;
217
+                } else {
218
+                    checktype = 1;
219
+                }
220
+            }
221
+            if (correcttype.equals(3)) {//按题块批阅
222
+                MsPaperStudentBlock block = new MsPaperStudentBlock();
223
+                block.setMpsbid(sq.getMpsbid());
224
+                if (checktype.equals(1)) {
225
+                    block.setFirstcid(handleid);
226
+                } else {
227
+                    block.setSecondcid(handleid);
228
+                }
229
+                block.setChecked(1);
230
+                msPaperStudentBlockMapper.updateByPrimaryKeySelective(block);
231
+            } else {//按试题/班级批阅
232
+                MsPaperStudentQuestion question = new MsPaperStudentQuestion();
233
+                question.setMpsqid(sq.getMpsbid());
234
+                question.setChecked(1);
235
+                if (checktype.equals(1)) {
236
+                    question.setFirstcid(handleid);
237
+                } else {
238
+                    question.setSecondcid(handleid);
239
+                }
240
+                msPaperStudentQuestionMapper.updateByPrimaryKeySelective(question);
151 241
             }
152 242
         }
153 243
         Map map = new HashMap();
154 244
         map.put("sq", sq);
245
+        map.put("totalNum", totalNum);
246
+        map.put("checkedNum", checkedNum);
155 247
         String msg = "获取成功";
156 248
         return new ResultVo(0, msg, map);
157 249
     }
@@ -164,14 +256,27 @@ public class MsPaperCheckTeacherTaskService {
164 256
      * @Return java.util.List<java.util.Map>
165 257
      **/
166 258
     public List<Map> listByQuestion(Integer mpid) {
167
-        MsPaper paper = msPaperMapper.selectByPrimaryKey(mpid);
168
-        if (paper == null) {
169
-            throw new ServiceException("该试卷不存在");
170
-        }
171
-        Integer correcttype = paper.getCorrecttype();
259
+        Integer correcttype = msPaperMapper.getCorrectTypeByMpId(mpid);
172 260
         if (!N_Utils.isTrueInteger(correcttype)) {
173 261
             throw new ServiceException("该试卷未设置批阅方式");
174 262
         }
175 263
         return msPaperCheckTeacherTaskMapper.listByQuestion(mpid, correcttype);
176 264
     }
265
+
266
+    /**
267
+     * @Description 阅卷进度-按试题-查看详情
268
+     * @Date 2024/11/11 9:24
269
+     * @Author YWX
270
+     * @Param [mpid, mblockid]
271
+     * @Return java.util.List<java.util.Map>
272
+     **/
273
+    public List<Map> detailByQuestion(Integer mpid, Integer mblockid) {
274
+        MsPaperCheck check = msPaperCheckMapper.findByMBlockId(mpid, mblockid);
275
+        if (check == null) {
276
+            throw new ServiceException("该试题不存在");
277
+        }
278
+        Integer dispenseway = check.getDispenseway();
279
+        List<Map> list = msPaperCheckTeacherTaskMapper.detailByQuestion(mpid, mblockid, dispenseway, check.getChecktype());
280
+        return setListNum(dispenseway, list);
281
+    }
177 282
 }

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

@@ -30,4 +30,6 @@ public class MsCheckParam extends BaseBean {
30 30
     private Integer usertype;
31 31
     //分配方式1平均分配2效率优先3定量分配
32 32
     private Integer dispenseway;
33
+    //考试试题表id
34
+    private Integer mptqid;
33 35
 }

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

@@ -9,6 +9,8 @@ import lombok.Data;
9 9
  **/
10 10
 @Data
11 11
 public class MsPaperCheckVo {
12
+    //试卷ID
13
+    private Integer mpid;
12 14
     //题块ID
13 15
     private Integer mblockid;
14 16
     //阅卷试卷学生题块ID
@@ -39,4 +41,6 @@ public class MsPaperCheckVo {
39 41
     private Integer arbitratetime;
40 42
     //仲裁分值
41 43
     private Double arbitratescore;
44
+    //批阅情况1一评2二评
45
+    private Integer checktype;
42 46
 }

+ 4
- 0
smarking/src/main/resources/mapper/paper/MsPaperMapper.xml View File

@@ -108,4 +108,8 @@
108 108
     <select id="getSubjectStateByMpid" resultType="com.xhkjedu.smarking.vo.paper.PExamSubjectVo">
109 109
         select s.msid,s.msstate from ms_subject s left join ms_paper p on s.msid=p.msid where p.mpid=#{mpid}
110 110
     </select>
111
+    <!--获取试卷批阅设置-->
112
+    <select id="getCorrectTypeByMpId" resultType="java.lang.Integer">
113
+        select correcttype from ms_paper where mpid=#{mpid}
114
+    </select>
111 115
 </mapper>

+ 220
- 54
smarking/src/main/resources/mapper/papercheck/MsPaperCheckTeacherTaskMapper.xml View File

@@ -29,6 +29,12 @@
29 29
             #{item.mpcttid}
30 30
         </foreach>
31 31
     </update>
32
+    <!--更新教师阅卷任务状态-->
33
+    <update id="updateCheckStatus">
34
+        update ms_paper_check_teacher_task
35
+        set checkstate = #{checkstate}
36
+        where mpid=#{mpid} and mpsbid=#{mpsbid} and teacherid=#{teacherid}
37
+    </update>
32 38
     <!--删除教师阅卷任务-->
33 39
     <delete id="deleteByMpsbids">
34 40
         delete from ms_paper_check_teacher_task where mpsbid in (${mpsbids})
@@ -101,30 +107,65 @@
101 107
     <!--阅卷进度-按教师-->
102 108
     <resultMap id="teacherResultMap" type="java.util.Map">
103 109
         <id property="teacherid" column="teacherid"/>
104
-        <id property="teachername" column="teachername"/>
105
-        <collection property="blocks" ofType="java.util.Map">
110
+        <result property="teachername" column="teachername"/>
111
+        <collection property="blocks" ofType="java.util.Map" javaType="java.util.List">
106 112
             <id property="mblockid" column="mblockid"/>
107
-            <id property="blockname" column="blockname"/>
108
-            <id property="totalNum" column="total_num"/>
109
-            <id property="checkedNum" column="checked_num"/>
110
-            <id property="uncheckedNum" column="uncheck_num"/>
113
+            <result property="qorder" column="qorder"/>
114
+            <result property="qn" column="qn"/>
115
+            <result property="blockname" column="blockname"/>
116
+            <result property="totalNum" column="total_num"/>
117
+            <result property="checkedNum" column="checked_num"/>
118
+            <result property="uncheckedNum" column="uncheck_num"/>
111 119
         </collection>
112 120
     </resultMap>
113 121
     <select id="listByTeacher" resultMap="teacherResultMap">
114
-        select pct.teacherid,u.username as teachername
115
-        ,if(pc.dispenseway=2,count(psb.mpsbid)*pc.checktype
116
-            ,count(if(psb.firstcid=pct.teacherid or psb.secondcid=pct.teacherid,psb.mpsbid,null))
117
-         ) as total_num
118
-        ,count(if((psb.firstcid=pct.teacherid and psb.firstcime>0) or (psb.secondcid=pct.teacherid and psb.secondctime>0),psb.mpsbid,null)) as checked_num
119
-        ,count(if((psb.firstcid=pct.teacherid and psb.firstcime=0) or (psb.secondcid=pct.teacherid and psb.secondctime=0),psb.mpsbid,null)) as uncheck_num
120
-        ,pct.mblockid,pb.blockname
121
-        from ms_paper_check_teacher pct left join t_user u on u.userid = pct.teacherid
122
-        left join ms_paper_block pb on pct.mblockid = pb.mblockid
123
-        left join ms_paper_check pc on pct.mblockid = pc.mblockid
124
-        left join ms_paper_student_block psb on psb.mblockid = pct.mblockid
125
-        where pct.mpid=#{mpid}
126
-        group by pct.teacherid,pct.mblockid
127
-        order by teachername,pb.blockorder
122
+        <if test="correcttype==1">
123
+            select pct.teacherid,u.username as teachername
124
+            ,if(pc.dispenseway=2,count(psb.mpsqid)*pc.checktype
125
+            ,count(if(psb.firstcid=pct.teacherid or psb.secondcid=pct.teacherid,psb.mpsqid,null))
126
+            ) as total_num
127
+            ,count(if((psb.firstcid=pct.teacherid and psb.firstcime>0) or (psb.secondcid=pct.teacherid and psb.secondctime>0),psb.mpsqid,null)) as checked_num
128
+            ,count(if((psb.firstcid=pct.teacherid and psb.firstcime=0) or (psb.secondcid=pct.teacherid and psb.secondctime=0),psb.mpsqid,null)) as uncheck_num
129
+            ,psb.mptqid as mblockid,psb.qorder,psb.qn
130
+            from ms_paper_check_teacher pct left join t_user u on u.userid = pct.teacherid
131
+            left join ms_paper_check pc on pct.mblockid = pc.mblockid and pct.mpid = pc.mpid
132
+            left join ms_paper_student_question psb on pct.mpid = psb.mpid
133
+            inner join ms_class c on c.examid=psb.examid and c.subjectid=psb.subjectid and c.classid=pct.mblockid
134
+            where pct.mpid=#{mpid} and psb.ctype in (3, 13, 14, 15)
135
+            group by pct.teacherid,psb.mptqid
136
+            order by teachername,psb.qorder,psb.qn
137
+        </if>
138
+        <if test="correcttype==2">
139
+            select pct.teacherid,u.username as teachername
140
+            ,if(pc.dispenseway=2,count(psb.mpsqid)*pc.checktype
141
+            ,count(if(psb.firstcid=pct.teacherid or psb.secondcid=pct.teacherid,psb.mpsqid,null))
142
+            ) as total_num
143
+            ,count(if((psb.firstcid=pct.teacherid and psb.firstcime>0) or (psb.secondcid=pct.teacherid and psb.secondctime>0),psb.mpsqid,null)) as checked_num
144
+            ,count(if((psb.firstcid=pct.teacherid and psb.firstcime=0) or (psb.secondcid=pct.teacherid and psb.secondctime=0),psb.mpsqid,null)) as uncheck_num
145
+            ,pct.mblockid,psb.qorder,psb.qn
146
+            from ms_paper_check_teacher pct left join t_user u on u.userid = pct.teacherid
147
+            left join ms_paper_check pc on pct.mblockid = pc.mblockid and pct.mpid = pc.mpid
148
+            left join ms_paper_student_question psb on psb.mptqid = pct.mblockid and pct.mpid = psb.mpid
149
+            where pct.mpid=#{mpid}
150
+            group by pct.teacherid,pct.mblockid
151
+            order by teachername,psb.qorder,psb.qn
152
+        </if>
153
+        <if test="correcttype==3">
154
+            select pct.teacherid,u.username as teachername
155
+            ,if(pc.dispenseway=2,count(psb.mpsbid)*pc.checktype
156
+                ,count(if(psb.firstcid=pct.teacherid or psb.secondcid=pct.teacherid,psb.mpsbid,null))
157
+             ) as total_num
158
+            ,count(if((psb.firstcid=pct.teacherid and psb.firstcime>0) or (psb.secondcid=pct.teacherid and psb.secondctime>0),psb.mpsbid,null)) as checked_num
159
+            ,count(if((psb.firstcid=pct.teacherid and psb.firstcime=0) or (psb.secondcid=pct.teacherid and psb.secondctime=0),psb.mpsbid,null)) as uncheck_num
160
+            ,pct.mblockid,pb.blockname
161
+            from ms_paper_check_teacher pct left join t_user u on u.userid = pct.teacherid
162
+            left join ms_paper_block pb on pct.mblockid = pb.mblockid and pct.mpid = pb.mpid
163
+            left join ms_paper_check pc on pct.mblockid = pc.mblockid and pct.mpid = pc.mpid
164
+            left join ms_paper_student_block psb on psb.mblockid = pct.mblockid and pct.mpid = psb.mpid
165
+            where pct.mpid=#{mpid}
166
+            group by pct.teacherid,pct.mblockid
167
+            order by teachername,pb.blockorder
168
+        </if>
128 169
     </select>
129 170
     <!--教师阅卷-待批阅列表-->
130 171
     <select id="listPending" resultType="java.util.Map">
@@ -138,7 +179,7 @@
138 179
         from ms_subject s inner join ms_exam e on s.examid = e.examid
139 180
         inner join ms_paper_check pc on pc.msid = s.msid
140 181
         <if test="param.usertype==1 and param.handleid!=null">
141
-            inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid
182
+            inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid=pc.mpid
142 183
         </if>
143 184
         inner join ms_paper_student_block psb on psb.mblockid = pc.mblockid
144 185
         where e.schoolid=#{param.schoolid} and s.checkstate=1 and e.deleted=1
@@ -161,10 +202,10 @@
161 202
         ,count(if((psb.firstcime=0 and psb.firstcid=#{param.handleid})
162 203
         or (psb.secondctime=0 and psb.secondcid=#{param.handleid}) or pc.dispenseway=2
163 204
         ,psb.mpsbid,null)) as my_unchecked_num
164
-        from ms_paper_check pc left join ms_paper_student_block psb on psb.mblockid = pc.mblockid
165
-        inner join ms_paper_block pb on pc.mblockid = pb.mblockid
205
+        from ms_paper_check pc left join ms_paper_student_block psb on psb.mblockid = pc.mblockid and psb.mpid = pc.mpid
206
+        inner join ms_paper_block pb on pc.mblockid = pb.mblockid and pb.mpid = pc.mpid
166 207
         <if test="param.usertype==1 and param.handleid!=null">
167
-            inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.teacherid = #{param.handleid}
208
+            inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid=pc.mpid and pct.teacherid = #{param.handleid}
168 209
             and (psb.firstcid = #{param.handleid} or psb.secondcid = #{param.handleid} or pc.dispenseway=2)
169 210
         </if>
170 211
         where pc.mpid=#{param.mpid}
@@ -180,40 +221,39 @@
180 221
         group by pb.mblockid
181 222
         order by pb.blockorder
182 223
     </select>
183
-    <!--获取题块阅卷状态-->
184
-    <select id="listPaperCheck" resultType="com.xhkjedu.smarking.model.papercheck.MsPaperCheck">
224
+    <!--教师阅卷-待批题块列表-->
225
+    <select id="listBlockCheck" resultType="com.xhkjedu.smarking.model.papercheck.MsPaperCheck">
185 226
         select pc.mblockid,pc.checktype,pc.hidefirstscore,pc.scoreway,pc.finalscore,pc.roundvalue,pc.dispenseway,pc.numtype
186
-        ,pc.checkstate
187
-        from ms_paper_check pc inner join ms_paper_student_block psb on psb.mblockid = pc.mblockid
188
-        inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.teacherid = #{param.handleid}
189
-        where pc.checkstate=1 and psb.checked!=2 and pc.mblockid in
190
-        <foreach collection="param.mblockids" item="mblockid" open="(" separator="," close=")">
191
-            #{mblockid}
192
-        </foreach>
227
+        ,pc.checkstate,pc.correcttype,pc.mpid
228
+        from ms_paper_check pc inner join ms_paper_student_block psb on psb.mblockid = pc.mblockid and psb.mpid = pc.mpid
229
+        inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
230
+        where pc.checkstate=1 and psb.checked!=2 and pc.mpid=#{param.mpid}
231
+        group by pc.mblockid
193 232
         order by pc.mpcid
194 233
     </select>
195
-    <!--获取待批试题(平均、定量分配)-->
234
+    <!--教师阅卷-按题块-获取待批试题-->
196 235
     <select id="getCorrectBlock" resultType="com.xhkjedu.smarking.vo.papercheck.MsPaperCheckVo">
197
-        select pctt.mblockid,psb.mpsbid,psb.stuanswer,psb.checked
198
-        ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime
199
-        from ms_paper_student_block psb inner join ms_paper_check_teacher_task pctt on psb.mpsbid = pctt.mpsbid
200
-        where pctt.mblockid = #{param.mblockid} and pctt.teacherid = #{param.handleid}
201
-        order by field(pctt.checkstate,2,1,3),pctt.taskorder
202
-        limit 1
203
-    </select>
204
-    <!--获取待批试题(效率优先)-->
205
-    <select id="getCorrectBlock2" resultType="com.xhkjedu.smarking.vo.papercheck.MsPaperCheckVo">
206
-        select pctt.mblockid,psb.mpsbid,psb.answertype,psb.stuanswer,psb.qscore,psb.checked
207
-        ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime
208
-        from ms_paper_student_block psb
209
-        where psb.mblockid = #{param.mblockid}
210
-        and (psb.checked=0 or psb.firstcid=#{param.handleid}
211
-        <if test="param.checktype==2">
212
-            or psb.secondcid=#{param.handleid}
213
-        </if>
214
-        )
215
-        order by field(psb.checked,2,1,3),pctt.taskorder
216
-        limit 1
236
+        <if test="param.dispenseway!=null and param.dispenseway!=2">
237
+            select pctt.mblockid,pctt.mpsbid,pctt.checktype,psb.stuanswer,psb.checked
238
+            ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime
239
+            from ms_paper_student_block psb inner join ms_paper_check_teacher_task pctt on psb.mpsbid = pctt.mpsbid and psb.mpid=pctt.mpid
240
+            where pctt.mpid=#{param.mpid} and pctt.mblockid = #{param.mblockid} and pctt.teacherid = #{param.teacherid}
241
+            order by field(pctt.checkstate,2,1,3),pctt.taskorder
242
+            limit 1
243
+        </if>
244
+        <if test="param.dispenseway!=null and param.dispenseway==2">
245
+            select psb.mblockid,psb.mpsbid,psb.answertype,psb.stuanswer,psb.qscore,psb.checked
246
+            ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime
247
+            from ms_paper_student_block psb
248
+            where psb.mpid=#{param.mpid} and psb.mblockid = #{param.mblockid}
249
+            and (psb.checked=0 or (psb.checked=1 and (psb.firstcid=#{param.teacherid}
250
+            <if test="param.checktype==2">
251
+                or psb.secondcid=#{param.teacherid}
252
+            </if>
253
+            )))
254
+            order by field(psb.checked,1,0,2)
255
+            limit 1
256
+        </if>
217 257
     </select>
218 258
     <!--阅卷进度-按试题-->
219 259
     <resultMap id="questionResultMap" type="java.util.Map">
@@ -239,4 +279,130 @@
239 279
         group by q.mptqid
240 280
         order by q.qorder,q.qn
241 281
     </select>
282
+    <!--阅卷进度-按试题-查看详情-->
283
+    <select id="detailByQuestion" resultType="java.util.Map">
284
+        <if test="dispenseway!=null and dispenseway!=2">
285
+            select pctt.teacherid,u.username as teachername
286
+            ,count(pctt.mpcttid) as total_num,count(if(pctt.checkstate=3,1,null)) as checked_num
287
+            ,count(if(pctt.checkstate!=3,1,null))as uncheck_num
288
+            from ms_paper_check_teacher_task pctt left join t_user u on u.userid = pctt.teacherid
289
+            where pctt.mpid=#{mpid} and pctt.mblockid=#{mblockid}
290
+            group by pctt.teacherid
291
+        </if>
292
+        <if test="dispenseway!=null and dispenseway==2">
293
+            select t.teacherid,u.username as teachername
294
+            ,sum(t.total_num) as total_num,sum(t.checked_num) as checked_num,sum(t.uncheck_num) as uncheck_num
295
+            from(select psb.firstcid as teacherid,count(*) as total_num,count(if(psb.firstcime is not null,1,null)) as checked_num
296
+            ,count(if(psb.firstcime is null,1,null)) as uncheck_num
297
+            from ms_paper_student_question psb
298
+            where psb.mpid=#{mpid} and psb.mptqid=#{mblockid}
299
+            group by psb.firstcid
300
+            <if test="checktype!=null and checktype==2">
301
+                union
302
+                select psb.secondcid as teacherid,count(*) as total_num,count(if(psb.secondctime is not null,1,null)) as checked_num
303
+                ,count(if(psb.secondctime is null,1,null)) as uncheck_num
304
+                from ms_paper_student_question psb
305
+                where psb.mpid=#{mpid} and psb.mptqid=#{mblockid}
306
+                group by psb.secondcid
307
+            </if>)t left join t_user u on t.teacherid=u.userid
308
+            group by t.teacherid
309
+        </if>
310
+    </select>
311
+    <!--教师阅卷-待批试题列表-->
312
+    <select id="listQuestionCheck" resultType="com.xhkjedu.smarking.model.papercheck.MsPaperCheck">
313
+        select pc.mblockid,pc.checktype,pc.hidefirstscore,pc.scoreway,pc.finalscore,pc.roundvalue,pc.dispenseway,pc.numtype
314
+        ,pc.checkstate,pc.correcttype,pc.mpid
315
+        from ms_paper_check pc inner join ms_paper_student_question psb on psb.mptqid = pc.mblockid and psb.mpid = pc.mpid
316
+        inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
317
+        where pc.checkstate=1 and psb.checked!=2 and pc.mpid=#{param.mpid}
318
+        group by pc.mblockid
319
+        order by pc.mpcid
320
+    </select>
321
+    <!--教师阅卷-按试题-获取待批试题-->
322
+    <select id="getCorrectQuestion" resultType="com.xhkjedu.smarking.vo.papercheck.MsPaperCheckVo">
323
+        <if test="param.dispenseway!=null and param.dispenseway!=2">
324
+            select pctt.mblockid,pctt.mpsbid,pctt.checktype,psb.stuanswer,psb.checked
325
+            ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime
326
+            from ms_paper_student_question psb inner join ms_paper_check_teacher_task pctt on psb.mpsqid = pctt.mpsbid and psb.mpid=pctt.mpid
327
+            where pctt.mpid=#{param.mpid} and pctt.mblockid = #{param.mblockid} and pctt.teacherid = #{param.teacherid}
328
+            order by field(pctt.checkstate,2,1,3),pctt.taskorder
329
+            limit 1
330
+        </if>
331
+        <if test="param.dispenseway!=null and param.dispenseway==2">
332
+            select psb.mptqid as mblockid,psb.mpsqid as mpsbid,psb.answertype,psb.stuanswer,psb.qscore,psb.checked
333
+            ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime
334
+            from ms_paper_student_question psb
335
+            where psb.mpid=#{param.mpid} and psb.mptqid = #{param.mblockid}
336
+            and (psb.checked=0 or (psb.checked=1 and (psb.firstcid=#{param.teacherid}
337
+            <if test="param.checktype==2">
338
+                or psb.secondcid=#{param.teacherid}
339
+            </if>
340
+            )))
341
+            order by field(psb.checked,1,0,2)
342
+            limit 1
343
+        </if>
344
+    </select>
345
+    <!--教师阅卷-待批班级列表-->
346
+    <select id="listClassCheck" resultType="com.xhkjedu.smarking.model.papercheck.MsPaperCheck">
347
+        select pc.mblockid,pc.checktype,pc.hidefirstscore,pc.scoreway,pc.finalscore,pc.roundvalue,pc.dispenseway,pc.numtype
348
+        ,pc.checkstate,pc.correcttype,pc.mpid
349
+        from ms_paper_check pc inner join ms_paper_student_question psb on psb.mpid = pc.mpid
350
+        inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
351
+        where pc.checkstate=1 and psb.checked!=2 and pc.mpid=#{param.mpid}
352
+        group by pc.mblockid
353
+        order by pc.mpcid
354
+    </select>
355
+    <!--教师阅卷-按班级-获取待批试题-->
356
+    <select id="getCorrectClassQuestion" resultType="com.xhkjedu.smarking.vo.papercheck.MsPaperCheckVo">
357
+        <if test="param.dispenseway!=null and param.dispenseway!=2">
358
+            select pctt.mblockid,pctt.mpsbid,pctt.checktype,psb.stuanswer,psb.checked
359
+            ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime,psb.mptqid
360
+            from ms_paper_student_question psb inner join ms_paper_check_teacher_task pctt on psb.mpsqid = pctt.mpsbid and psb.mpid=pctt.mpid
361
+            where pctt.mpid=#{param.mpid} and pctt.mblockid = #{param.mblockid} and pctt.teacherid = #{param.teacherid}
362
+            order by field(pctt.checkstate,2,1,3),pctt.taskorder
363
+            limit 1
364
+        </if>
365
+        <if test="param.dispenseway!=null and param.dispenseway==2">
366
+            select c.classid as mblockid,psb.mpsqid as mpsbid,psb.answertype,psb.stuanswer,psb.qscore,psb.checked
367
+            ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime,psb.mptqid
368
+            from ms_paper_student_question psb inner join ms_class c on psb.mpid=c.mpid
369
+            where psb.mpid=#{param.mpid} and c.classid = #{param.mblockid}
370
+            and (psb.checked=0 or (psb.checked=1 and (psb.firstcid=#{param.teacherid}
371
+            <if test="param.checktype==2">
372
+                or psb.secondcid=#{param.teacherid}
373
+            </if>
374
+            )))
375
+            order by field(psb.checked,1,0,2),psb.mptqid
376
+            limit 1
377
+        </if>
378
+    </select>
379
+    <!--获取教师批阅数量-->
380
+    <select id="getCheckNum" resultType="com.xhkjedu.smarking.model.papercheck.MsPaperCheckTeacher">
381
+        <if test="param.dispenseway!=null and param.dispenseway!=2">
382
+            select pct.tasknum,count(if(pctt.checkstate=3,1,null)) as checkednum
383
+            from ms_paper_check_teacher pct left join ms_paper_check_teacher_task pctt on pct.mpid=pctt.mpid and pct.teacherid=pctt.teacherid pct.mblockid=pctt.mblockid
384
+            where pct.mpid=#{param.mpid} and pct.teacherid=#{param.handleid} and pct.mblockid=#{param.mblockid}
385
+        </if>
386
+        <if test="param.dispenseway!=null and param.dispenseway==2">
387
+            <if test="param.correcttype==3">
388
+                select count(psb.mpsbid*#{param.checktype}) as tasknum
389
+                ,count(if(pctt.checkstate=3,1,null)) as checkednum
390
+                from ms_paper_student_block psb left join ms_paper_check_teacher_task pctt on psb.mpid=pctt.mpid and pctt.teacherid=#{param.teacherid} and psb.mpsbid=pctt.mpsbid
391
+                where psb.mpid=#{param.mpid} and psb.mblockid=#{param.mblockid}
392
+            </if>
393
+            <if test="param.correcttype==2">
394
+                select count(psb.mpsqid*#{param.checktype}) as tasknum
395
+                ,count(if(pctt.checkstate=3,1,null)) as checkednum
396
+                from ms_paper_student_question psb left join ms_paper_check_teacher_task pctt on psb.mpid=pctt.mpid and pctt.teacherid=#{param.teacherid} and psb.mpsqid=pctt.mpsbid
397
+                where psb.mpid=#{param.mpid} and psb.mptqid=#{param.mblockid}
398
+            </if>
399
+            <if test="param.correcttype==1">
400
+                select count(psb.mpsqid*#{param.checktype}) as tasknum
401
+                ,count(if(pctt.checkstate=3,1,null)) as checkednum
402
+                from ms_paper_student_question psb left join ms_paper_check_teacher_task pctt on psb.mpid=pctt.mpid and pctt.teacherid=#{param.teacherid} and psb.mpsqid=pctt.mpsbid
403
+                inner join ms_class_student cs on psb.examid=cs.examid and psb.subjectid=cs.subjectid and psb.studentid=cs.studentid
404
+                where psb.mpid=#{param.mpid} and psb.mptqid=#{param.mptqid} and cs.classid=#{param.mblockid}
405
+            </if>
406
+        </if>
407
+    </select>
242 408
 </mapper>

Loading…
Cancel
Save