Procházet zdrojové kódy

Merge remote-tracking branch 'origin/ywx' into wn

ywx
王宁 před 1 měsícem
rodič
revize
8a0d2c8064

+ 37
- 0
smarking/src/main/java/com/xhkjedu/smarking/controller/papercheck/MsPaperCheckTeacherTaskController.java Zobrazit soubor

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5 5
 import com.xhkjedu.smarking.service.papercheck.MsPaperCheckTeacherTaskService;
6 6
 import com.xhkjedu.smarking.vo.papercheck.MsCheckParam;
7
+import com.xhkjedu.smarking.vo.papercheck.MsPaperCheckVo;
7 8
 import com.xhkjedu.utils.N_Utils;
8 9
 import com.xhkjedu.utils.PageUtil;
9 10
 import com.xhkjedu.vo.PageResult;
@@ -132,6 +133,26 @@ public class MsPaperCheckTeacherTaskController {
132 133
         return new ResultVo(0, "查询成功", msPaperCheckTeacherTaskService.getCorrectBlock(param));
133 134
     }
134 135
 
136
+    /**
137
+     * @Description 批阅
138
+     * @Date 2024/11/12 10:00
139
+     * @Author YWX
140
+     * @Param [param]
141
+     * @Return com.xhkjedu.vo.ResultVo
142
+     **/
143
+    @PostMapping("/correct")
144
+    public ResultVo correct(@RequestBody MsPaperCheckVo param) {
145
+        N_Utils.validation(new Object[]{
146
+                param.getHandleid(), "操作人ID", 1
147
+                , param.getMpid(), "试卷ID", 1
148
+                , param.getMblockid(), "题块ID", 1
149
+                , param.getChecktype(), "批阅情况", 1
150
+                , param.getMpsbid(), "学生试题ID", 1
151
+        });
152
+        msPaperCheckTeacherTaskService.correct(param);
153
+        return new ResultVo(0, "保存成功");
154
+    }
155
+
135 156
     /**
136 157
      * @Description 阅卷进度-按试题
137 158
      * @Date 2024/11/8 16:19
@@ -146,4 +167,20 @@ public class MsPaperCheckTeacherTaskController {
146 167
         List<Map> list = msPaperCheckTeacherTaskService.listByQuestion(mpid);
147 168
         return new ResultVo(0, "查询成功", list);
148 169
     }
170
+
171
+    /**
172
+     * @Description 阅卷进度-按试题-查看详情
173
+     * @Date 2024/11/11 9:24
174
+     * @Author YWX
175
+     * @Param [param]
176
+     * @Return com.xhkjedu.vo.ResultVo
177
+     **/
178
+    @PostMapping("/detail_by_question")
179
+    public ResultVo detailByQuestion(@RequestBody MsCheckParam param) {
180
+        Integer mpid = param.getMpid();
181
+        Integer mblockid = param.getMblockid();
182
+        N_Utils.validation(new Object[]{mpid, "试卷ID", 1, mblockid, "试题ID", 1});
183
+        List<Map> list = msPaperCheckTeacherTaskService.detailByQuestion(mpid, mblockid);
184
+        return new ResultVo(0, "查询成功", list);
185
+    }
149 186
 }

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/paper/MsPaperMapper.java Zobrazit soubor

@@ -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
 }

+ 32
- 9
smarking/src/main/java/com/xhkjedu/smarking/mapper/papercheck/MsPaperCheckTeacherTaskMapper.java Zobrazit soubor

@@ -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,41 @@ 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);
81
+
82
+    //教师批阅-批阅试题
83
+    void correct(@Param("param") MsPaperCheckVo param);
61 84
 }

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/stupaper/MsPaperStudentQuestionMapper.java Zobrazit soubor

@@ -42,4 +42,7 @@ public interface MsPaperStudentQuestionMapper extends TkMapper<MsPaperStudentQue
42 42
     Integer updateBatchStuAnswerForScan(@Param("list") List<MsPaperStudentQuestion> list);
43 43
     //扫描记录-查看原卷-客观题保存-获取学生答案
44 44
     List<MsPaperStudentQuestion> listStuQuestionsByMspidAnbBlockid(@Param("mspid") Integer mspid,@Param("mblockid") Integer mblockid);
45
+
46
+    //更新学生单题批阅信息
47
+    void checkByMptqidAndStudentId(@Param("list") List<MsPaperStudentQuestion> list,@Param("block") MsPaperStudentBlock block);
45 48
 }

+ 6
- 2
smarking/src/main/java/com/xhkjedu/smarking/model/paper/MsPaperBlockQuestion.java Zobrazit soubor

@@ -3,8 +3,7 @@ package com.xhkjedu.smarking.model.paper;
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;
5 5
 
6
-import javax.persistence.Id;
7
-import javax.persistence.Table;
6
+import javax.persistence.*;
8 7
 
9 8
 /**
10 9
  * @Description 阅卷试卷题块试题表
@@ -29,12 +28,17 @@ public class MsPaperBlockQuestion extends BaseBean {
29 28
     private String bqn;
30 29
     //试题分值
31 30
     private Double bqscore;
31
+    @Transient
32
+    //学生得分
33
+    private Double stuscore;
32 34
     //排序/首个题号
33 35
     private Integer bqorder;
34 36
     //合并给分点试卷试题ID集合
35 37
     private String mergeqid;
36 38
     //合并给分点试卷试题题号集合
37 39
     private String mergeqn;
40
+    //合并给分点试卷试题分值集合
41
+    private String mergescore;
38 42
     //给分步长方式1等间隔2特定分数
39 43
     private Integer scorestepway;
40 44
     //给分步长内容

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/papercheck/MsPaperCheck.java Zobrazit soubor

@@ -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
 }

+ 4
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/stupaper/MsPaperStudentQuestion.java Zobrazit soubor

@@ -92,6 +92,10 @@ public class MsPaperStudentQuestion extends BaseBean {
92 92
     private Integer problemtype;
93 93
     //疑难备注
94 94
     private String problemcomm;
95
+    //是否最终批改结果0否1是
96
+    private Integer hasfinal;
97
+    //最终批改原因1仲裁2学科组成批
98
+    private Integer finalreason;
95 99
 
96 100
     //少选分值
97 101
     @Transient

+ 228
- 22
smarking/src/main/java/com/xhkjedu/smarking/service/papercheck/MsPaperCheckTeacherTaskService.java Zobrazit soubor

@@ -4,9 +4,15 @@ 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;
10
+import com.xhkjedu.smarking.model.paper.MsPaperBlockQuestion;
9 11
 import com.xhkjedu.smarking.model.papercheck.MsPaperCheck;
12
+import com.xhkjedu.smarking.model.papercheck.MsPaperCheckTeacher;
13
+import com.xhkjedu.smarking.model.stupaper.MsPaperStudentBlock;
14
+import com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion;
15
+import com.xhkjedu.smarking.utils.MarkingUtil;
10 16
 import com.xhkjedu.smarking.vo.papercheck.MsCheckParam;
11 17
 import com.xhkjedu.smarking.vo.papercheck.MsPaperCheckVo;
12 18
 import com.xhkjedu.utils.N_Utils;
@@ -32,6 +38,11 @@ public class MsPaperCheckTeacherTaskService {
32 38
     private MsPaperCheckMapper msPaperCheckMapper;
33 39
     @Resource
34 40
     private MsPaperMapper msPaperMapper;
41
+    @Resource
42
+    private MsPaperStudentBlockMapper msPaperStudentBlockMapper;
43
+    @Resource
44
+    private MsPaperStudentQuestionMapper msPaperStudentQuestionMapper;
45
+
35 46
 
36 47
     /**
37 48
      * @Description 阅卷进度-按题块
@@ -58,6 +69,11 @@ public class MsPaperCheckTeacherTaskService {
58 69
         }
59 70
         Integer dispenseway = check.getDispenseway();
60 71
         List<Map> list = msPaperCheckTeacherTaskMapper.detailByBlock(mpid, mblockid, dispenseway, check.getChecktype());
72
+        return setListNum(dispenseway, list);
73
+    }
74
+
75
+    //计算题块/试题的总数和未批阅的数量
76
+    private List<Map> setListNum(Integer dispenseway, List<Map> list) {
61 77
         if (dispenseway.equals(2)) {
62 78
             int totalNum = list.stream().mapToInt(m -> N_Utils.obj2Int(m.get("totalNum"))).sum();
63 79
             int totalCheckedNum = list.stream().mapToInt(m -> N_Utils.obj2Int(m.get("checkedNum"))).sum();
@@ -78,7 +94,11 @@ public class MsPaperCheckTeacherTaskService {
78 94
      * @Return java.util.List<java.util.Map>
79 95
      **/
80 96
     public List<Map> listByTeacher(Integer mpid) {
81
-        return msPaperCheckTeacherTaskMapper.listByTeacher(mpid);
97
+        Integer correcttype = msPaperMapper.getCorrectTypeByMpId(mpid);
98
+        if (!N_Utils.isTrueInteger(correcttype)) {
99
+            throw new ServiceException("该试卷未设置批阅方式");
100
+        }
101
+        return msPaperCheckTeacherTaskMapper.listByTeacher(mpid, correcttype);
82 102
     }
83 103
 
84 104
     /**
@@ -131,27 +151,103 @@ public class MsPaperCheckTeacherTaskService {
131 151
      * @Return java.util.Map
132 152
      **/
133 153
     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("暂无要批阅的题块");
154
+        Integer correcttype = msPaperMapper.getCorrectTypeByMpId(param.getMpid());
155
+        if (!N_Utils.isTrueInteger(correcttype)) {
156
+            throw new ServiceException("该试卷未设置批阅方式");
157
+        }
138 158
         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);
159
+        Integer dispenseway = null;
160
+        Integer type = null;//评卷方式1单评2双评
161
+        Integer handleid = param.getHandleid();
162
+        MsPaperCheck paperCheck = null;
163
+        if (correcttype.equals(3)) {//按题块批阅
164
+            List<MsPaperCheck> checks = msPaperCheckTeacherTaskMapper.listBlockCheck(param);
165
+            if (N_Utils.isListEmpty(checks)) throw new ServiceException("暂无要批阅的题块");
166
+            for (MsPaperCheck check : checks) {
167
+                check.setTeacherid(handleid);
168
+                sq = msPaperCheckTeacherTaskMapper.getCorrectBlock(check);
169
+                if (sq != null) {
170
+                    paperCheck = check;
171
+                    break;
172
+                }
173
+            }
174
+        } else if (correcttype.equals(2)) {//按试题批阅
175
+            List<MsPaperCheck> checks = msPaperCheckTeacherTaskMapper.listQuestionCheck(param);
176
+            if (N_Utils.isListEmpty(checks)) throw new ServiceException("暂无要批阅的试题");
177
+            for (MsPaperCheck check : checks) {
178
+                check.setTeacherid(handleid);
179
+                sq = msPaperCheckTeacherTaskMapper.getCorrectQuestion(check);
180
+                if (sq != null) {
181
+                    paperCheck = check;
182
+                    break;
183
+                }
148 184
             }
149
-            if (sq != null) {
150
-                break;
185
+        } else {//按班级批阅
186
+            List<MsPaperCheck> checks = msPaperCheckTeacherTaskMapper.listClassCheck(param);
187
+            if (N_Utils.isListEmpty(checks)) throw new ServiceException("暂无要批阅的班级");
188
+            for (MsPaperCheck check : checks) {
189
+                check.setTeacherid(handleid);
190
+                sq = msPaperCheckTeacherTaskMapper.getCorrectClassQuestion(check);
191
+                if (sq != null) {
192
+                    paperCheck = check;
193
+                    break;
194
+                }
151 195
             }
152 196
         }
197
+
198
+        if (paperCheck != null) {
199
+            dispenseway = paperCheck.getDispenseway();
200
+            type = paperCheck.getChecktype();
201
+        }
202
+        Integer totalNum = 0;
203
+        Integer checkedNum = 0;
204
+        if (sq != null) {
205
+            MsPaperCheckTeacher teacher = msPaperCheckTeacherTaskMapper.getCheckNum(paperCheck);
206
+            totalNum = teacher.getTasknum();
207
+            checkedNum = teacher.getCheckednum();
208
+            if (!dispenseway.equals(2)) {
209
+                //更新教师阅卷任务状态
210
+                msPaperCheckTeacherTaskMapper.updateCheckStatus(sq.getMpid(), sq.getMpsbid(), handleid, 2);
211
+            }
212
+            Integer checktype = sq.getChecktype();
213
+            Integer firstcid = sq.getFirstcid();
214
+            if (!N_Utils.isTrueInteger(checktype)) {
215
+                if (type.equals(1)) {
216
+                    checktype = 1;
217
+                } else if (N_Utils.isTrueInteger(firstcid) && !handleid.equals(firstcid)) {
218
+                    checktype = 2;
219
+                } else {
220
+                    checktype = 1;
221
+                }
222
+            }
223
+            if (correcttype.equals(3)) {//按题块批阅
224
+                MsPaperStudentBlock block = new MsPaperStudentBlock();
225
+                block.setMpsbid(sq.getMpsbid());
226
+                if (checktype.equals(1)) {
227
+                    block.setFirstcid(handleid);
228
+                } else {
229
+                    block.setSecondcid(handleid);
230
+                }
231
+                block.setChecked(1);
232
+                msPaperStudentBlockMapper.updateByPrimaryKeySelective(block);
233
+            } else {//按试题/班级批阅
234
+                MsPaperStudentQuestion question = new MsPaperStudentQuestion();
235
+                question.setMpsqid(sq.getMpsbid());
236
+                question.setChecked(1);
237
+                if (checktype.equals(1)) {
238
+                    question.setFirstcid(handleid);
239
+                } else {
240
+                    question.setSecondcid(handleid);
241
+                }
242
+                msPaperStudentQuestionMapper.updateByPrimaryKeySelective(question);
243
+            }
244
+            sq.setChecktype(checktype);
245
+            sq.setMpid(paperCheck.getMpid());
246
+        }
153 247
         Map map = new HashMap();
154 248
         map.put("sq", sq);
249
+        map.put("totalNum", totalNum);
250
+        map.put("checkedNum", checkedNum);
155 251
         String msg = "获取成功";
156 252
         return new ResultVo(0, msg, map);
157 253
     }
@@ -164,14 +260,124 @@ public class MsPaperCheckTeacherTaskService {
164 260
      * @Return java.util.List<java.util.Map>
165 261
      **/
166 262
     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();
263
+        Integer correcttype = msPaperMapper.getCorrectTypeByMpId(mpid);
172 264
         if (!N_Utils.isTrueInteger(correcttype)) {
173 265
             throw new ServiceException("该试卷未设置批阅方式");
174 266
         }
175 267
         return msPaperCheckTeacherTaskMapper.listByQuestion(mpid, correcttype);
176 268
     }
269
+
270
+    /**
271
+     * @Description 阅卷进度-按试题-查看详情
272
+     * @Date 2024/11/11 9:24
273
+     * @Author YWX
274
+     * @Param [mpid, mblockid]
275
+     * @Return java.util.List<java.util.Map>
276
+     **/
277
+    public List<Map> detailByQuestion(Integer mpid, Integer mblockid) {
278
+        MsPaperCheck check = msPaperCheckMapper.findByMBlockId(mpid, mblockid);
279
+        if (check == null) {
280
+            throw new ServiceException("该试题不存在");
281
+        }
282
+        Integer dispenseway = check.getDispenseway();
283
+        List<Map> list = msPaperCheckTeacherTaskMapper.detailByQuestion(mpid, mblockid, dispenseway, check.getChecktype());
284
+        return setListNum(dispenseway, list);
285
+    }
286
+
287
+    /**
288
+     * @Description 批阅
289
+     * @Date 2024/11/12 10:02
290
+     * @Author YWX
291
+     * @Param [param]
292
+     * @Return void
293
+     **/
294
+    public void correct(MsPaperCheckVo param) {
295
+        MsPaperCheck check = msPaperCheckMapper.findByMBlockId(param.getMpid(), param.getMblockid());
296
+        if (check == null) {
297
+            throw new ServiceException("该阅卷任务不存在");
298
+        } else if (check.getCheckstate().equals(0)) {
299
+            throw new ServiceException("该阅卷任务未开始");
300
+        } else if (check.getCheckstate().equals(2)) {
301
+            throw new ServiceException("该阅卷任务已暂停");
302
+        }
303
+        Integer checktype = check.getChecktype();
304
+        Integer correcttype = check.getCorrecttype();
305
+        Integer mpsbid = param.getMpsbid();
306
+        Integer hasgood = param.getHasgood();
307
+        Integer hasbad = param.getHasbad();
308
+        Integer hasproblem = param.getHasproblem();
309
+        Integer problemtype = param.getProblemtype();
310
+        String problemcomm = param.getProblemcomm();
311
+        Double qscore = param.getQscore();
312
+        List<MsPaperBlockQuestion> questions = param.getQuestions();
313
+        int checked = 1;
314
+        if (checktype.equals(1)) {//单评
315
+            if (hasproblem.equals(0)) {
316
+                checked = 2;
317
+            }
318
+            Double firstccore = param.getFirstccore();
319
+            if (correcttype.equals(3)) {//按题块批阅
320
+                //题块批阅信息
321
+                MsPaperStudentBlock block = new MsPaperStudentBlock();
322
+                block.setMpsbid(mpsbid);
323
+                block.setChecked(checked);
324
+                block.setFirstcime(N_Utils.getSecondTimestamp());
325
+                block.setFirstccore(firstccore);
326
+                block.setHasgood(hasgood);
327
+                block.setHasbad(hasbad);
328
+                block.setHasproblem(hasproblem);
329
+                block.setProblemtype(problemtype);
330
+                block.setProblemcomm(problemcomm);
331
+                msPaperStudentBlockMapper.updateByPrimaryKeySelective(block);
332
+                block.setStudentid(param.getStudentid());
333
+                block.setMblockid(param.getMblockid());
334
+
335
+                List<MsPaperStudentQuestion> studentQuestions = new ArrayList<>();
336
+                for (MsPaperBlockQuestion question : questions) {
337
+                    Double stuscore = question.getStuscore();
338
+                    if (N_Utils.isTrueInteger(question.getMptqid())) {
339
+                        MsPaperStudentQuestion studentQuestion = new MsPaperStudentQuestion();
340
+                        studentQuestion.setMptqid(question.getMptqid());
341
+                        studentQuestion.setFirstccore(stuscore);
342
+                        studentQuestion.setStuscore(stuscore);
343
+                        studentQuestions.add(studentQuestion);
344
+                    } else {
345
+                        String[] mptqids = question.getMergeqid().split(",");
346
+                        String[] mergescores = question.getMergescore().split(",");
347
+                        double[] scores = new double[mergescores.length];
348
+                        int last = mergescores.length - 1;
349
+                        double score = 0;
350
+                        for (int i = 0; i < mergescores.length; i++) {
351
+                            scores[i] = MarkingUtil.mul(MarkingUtil.div(mergescores[i], qscore), stuscore);
352
+                            score = MarkingUtil.add(score, scores[i]);
353
+                            if (i == last) {
354
+                                scores[i] = MarkingUtil.sub(stuscore, score);
355
+                            }
356
+                        }
357
+                        for (int i = 0; i < mptqids.length; i++) {
358
+                            MsPaperStudentQuestion studentQuestion = new MsPaperStudentQuestion();
359
+                            studentQuestion.setMptqid(N_Utils.obj2Int(mptqids[i]));
360
+                            studentQuestion.setFirstccore(scores[i]);
361
+                            studentQuestion.setStuscore(scores[i]);
362
+                            studentQuestions.add(studentQuestion);
363
+                        }
364
+                    }
365
+                }
366
+                msPaperStudentQuestionMapper.checkByMptqidAndStudentId(studentQuestions, block);//更新学生单题批阅信息
367
+            } else {//按试题批阅
368
+                MsPaperStudentQuestion question = new MsPaperStudentQuestion();
369
+                question.setMpsqid(mpsbid);
370
+                question.setChecked(checked);
371
+                question.setFirstcime(N_Utils.getSecondTimestamp());
372
+                question.setFirstccore(firstccore);
373
+                question.setHasgood(hasgood);
374
+                question.setHasbad(hasbad);
375
+                question.setHasproblem(hasproblem);
376
+                question.setProblemtype(problemtype);
377
+                question.setProblemcomm(problemcomm);
378
+                msPaperStudentQuestionMapper.updateByPrimaryKeySelective(question);
379
+            }
380
+        }
381
+        msPaperCheckTeacherTaskMapper.correct(param);
382
+    }
177 383
 }

+ 13
- 0
smarking/src/main/java/com/xhkjedu/smarking/utils/MarkingUtil.java Zobrazit soubor

@@ -159,6 +159,19 @@ public class MarkingUtil {
159 159
         BigDecimal b2 = new BigDecimal(Double.toString(v2));
160 160
         return b1.multiply(b2).doubleValue();
161 161
     }
162
+
163
+    /**
164
+     * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到 小数点以后2位,以后的数字舍弃。
165
+     * @param v1 被除数
166
+     * @param v2 除数
167
+     * @return 两个参数的商
168
+     */
169
+    public static double div(Object v1, Object v2) {
170
+        BigDecimal b1 = new BigDecimal(v1.toString());
171
+        BigDecimal b2 = new BigDecimal(v2.toString());
172
+        return b1.divide(b2, 2, BigDecimal.ROUND_DOWN).doubleValue();
173
+    }
174
+
162 175
     /**
163 176
      * 提供精确的减法运算。
164 177
      *

+ 2
- 0
smarking/src/main/java/com/xhkjedu/smarking/vo/papercheck/MsCheckParam.java Zobrazit soubor

@@ -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
 }

+ 30
- 0
smarking/src/main/java/com/xhkjedu/smarking/vo/papercheck/MsPaperCheckVo.java Zobrazit soubor

@@ -1,7 +1,10 @@
1 1
 package com.xhkjedu.smarking.vo.papercheck;
2 2
 
3
+import com.xhkjedu.smarking.model.paper.MsPaperBlockQuestion;
3 4
 import lombok.Data;
4 5
 
6
+import java.util.List;
7
+
5 8
 /**
6 9
  * @Description 阅卷分配VO
7 10
  * @Author YWX
@@ -9,6 +12,8 @@ import lombok.Data;
9 12
  **/
10 13
 @Data
11 14
 public class MsPaperCheckVo {
15
+    //试卷ID
16
+    private Integer mpid;
12 17
     //题块ID
13 18
     private Integer mblockid;
14 19
     //阅卷试卷学生题块ID
@@ -31,12 +36,37 @@ public class MsPaperCheckVo {
31 36
     private Integer secondcid;
32 37
     //单评批改时间
33 38
     private Integer firstcime;
39
+    //单评批改分值
40
+    private Double firstccore;
34 41
     //复评批改时间
35 42
     private Integer secondctime;
43
+    //复评批改分值
44
+    private Double secondcscore;
36 45
     //仲裁人
37 46
     private Integer arbitrateid;
38 47
     //仲裁时间
39 48
     private Integer arbitratetime;
40 49
     //仲裁分值
41 50
     private Double arbitratescore;
51
+    //批阅情况1一评2二评
52
+    private Integer checktype;
53
+    //操作人ID
54
+    private Integer handleid;
55
+
56
+    //得分数组
57
+    private String checkscore;
58
+    //疑难0默认1疑难
59
+    private Integer hasproblem;
60
+    //疑难类型1图形模糊2答题错位3没有图像4图像颠倒5其他问题
61
+    private Integer problemtype;
62
+    //疑难备注
63
+    private String problemcomm;
64
+    //优秀试卷0默认1优秀
65
+    private Integer hasgood;
66
+    //违纪试卷0默认1违纪
67
+    private Integer hasbad;
68
+    //学生ID
69
+    private Integer studentid;
70
+    //题块试题列表
71
+    private List<MsPaperBlockQuestion> questions;
42 72
 }

+ 4
- 0
smarking/src/main/resources/mapper/paper/MsPaperMapper.xml Zobrazit soubor

@@ -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>

+ 240
- 55
smarking/src/main/resources/mapper/papercheck/MsPaperCheckTeacherTaskMapper.xml Zobrazit soubor

@@ -29,6 +29,18 @@
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>
38
+    <!--教师批阅-批阅试题-->
39
+    <update id="correct">
40
+        update ms_paper_check_teacher_task
41
+        set checkstate = 3,checkscore = #{checkscore}
42
+        where mpid=#{mpid} and mpsbid=#{mpsbid} and teacherid=#{teacherid}
43
+    </update>
32 44
     <!--删除教师阅卷任务-->
33 45
     <delete id="deleteByMpsbids">
34 46
         delete from ms_paper_check_teacher_task where mpsbid in (${mpsbids})
@@ -101,30 +113,65 @@
101 113
     <!--阅卷进度-按教师-->
102 114
     <resultMap id="teacherResultMap" type="java.util.Map">
103 115
         <id property="teacherid" column="teacherid"/>
104
-        <id property="teachername" column="teachername"/>
105
-        <collection property="blocks" ofType="java.util.Map">
116
+        <result property="teachername" column="teachername"/>
117
+        <collection property="blocks" ofType="java.util.Map" javaType="java.util.List">
106 118
             <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"/>
119
+            <result property="qorder" column="qorder"/>
120
+            <result property="qn" column="qn"/>
121
+            <result property="blockname" column="blockname"/>
122
+            <result property="totalNum" column="total_num"/>
123
+            <result property="checkedNum" column="checked_num"/>
124
+            <result property="uncheckedNum" column="uncheck_num"/>
111 125
         </collection>
112 126
     </resultMap>
113 127
     <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
128
+        <if test="correcttype==1">
129
+            select pct.teacherid,u.username as teachername
130
+            ,if(pc.dispenseway=2,count(psb.mpsqid)*pc.checktype
131
+            ,count(if(psb.firstcid=pct.teacherid or psb.secondcid=pct.teacherid,psb.mpsqid,null))
132
+            ) as total_num
133
+            ,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
134
+            ,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
135
+            ,psb.mptqid as mblockid,psb.qorder,psb.qn
136
+            from ms_paper_check_teacher pct left join t_user u on u.userid = pct.teacherid
137
+            left join ms_paper_check pc on pct.mblockid = pc.mblockid and pct.mpid = pc.mpid
138
+            left join ms_paper_student_question psb on pct.mpid = psb.mpid
139
+            inner join ms_class c on c.examid=psb.examid and c.subjectid=psb.subjectid and c.classid=pct.mblockid
140
+            where pct.mpid=#{mpid} and psb.ctype in (3, 13, 14, 15)
141
+            group by pct.teacherid,psb.mptqid
142
+            order by teachername,psb.qorder,psb.qn
143
+        </if>
144
+        <if test="correcttype==2">
145
+            select pct.teacherid,u.username as teachername
146
+            ,if(pc.dispenseway=2,count(psb.mpsqid)*pc.checktype
147
+            ,count(if(psb.firstcid=pct.teacherid or psb.secondcid=pct.teacherid,psb.mpsqid,null))
148
+            ) as total_num
149
+            ,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
150
+            ,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
151
+            ,pct.mblockid,psb.qorder,psb.qn
152
+            from ms_paper_check_teacher pct left join t_user u on u.userid = pct.teacherid
153
+            left join ms_paper_check pc on pct.mblockid = pc.mblockid and pct.mpid = pc.mpid
154
+            left join ms_paper_student_question psb on psb.mptqid = pct.mblockid and pct.mpid = psb.mpid
155
+            where pct.mpid=#{mpid}
156
+            group by pct.teacherid,pct.mblockid
157
+            order by teachername,psb.qorder,psb.qn
158
+        </if>
159
+        <if test="correcttype==3">
160
+            select pct.teacherid,u.username as teachername
161
+            ,if(pc.dispenseway=2,count(psb.mpsbid)*pc.checktype
162
+                ,count(if(psb.firstcid=pct.teacherid or psb.secondcid=pct.teacherid,psb.mpsbid,null))
163
+             ) as total_num
164
+            ,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
165
+            ,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
166
+            ,pct.mblockid,pb.blockname
167
+            from ms_paper_check_teacher pct left join t_user u on u.userid = pct.teacherid
168
+            left join ms_paper_block pb on pct.mblockid = pb.mblockid and pct.mpid = pb.mpid
169
+            left join ms_paper_check pc on pct.mblockid = pc.mblockid and pct.mpid = pc.mpid
170
+            left join ms_paper_student_block psb on psb.mblockid = pct.mblockid and pct.mpid = psb.mpid
171
+            where pct.mpid=#{mpid}
172
+            group by pct.teacherid,pct.mblockid
173
+            order by teachername,pb.blockorder
174
+        </if>
128 175
     </select>
129 176
     <!--教师阅卷-待批阅列表-->
130 177
     <select id="listPending" resultType="java.util.Map">
@@ -138,7 +185,7 @@
138 185
         from ms_subject s inner join ms_exam e on s.examid = e.examid
139 186
         inner join ms_paper_check pc on pc.msid = s.msid
140 187
         <if test="param.usertype==1 and param.handleid!=null">
141
-            inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid
188
+            inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid=pc.mpid
142 189
         </if>
143 190
         inner join ms_paper_student_block psb on psb.mblockid = pc.mblockid
144 191
         where e.schoolid=#{param.schoolid} and s.checkstate=1 and e.deleted=1
@@ -161,10 +208,10 @@
161 208
         ,count(if((psb.firstcime=0 and psb.firstcid=#{param.handleid})
162 209
         or (psb.secondctime=0 and psb.secondcid=#{param.handleid}) or pc.dispenseway=2
163 210
         ,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
211
+        from ms_paper_check pc left join ms_paper_student_block psb on psb.mblockid = pc.mblockid and psb.mpid = pc.mpid
212
+        inner join ms_paper_block pb on pc.mblockid = pb.mblockid and pb.mpid = pc.mpid
166 213
         <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}
214
+            inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid=pc.mpid and pct.teacherid = #{param.handleid}
168 215
             and (psb.firstcid = #{param.handleid} or psb.secondcid = #{param.handleid} or pc.dispenseway=2)
169 216
         </if>
170 217
         where pc.mpid=#{param.mpid}
@@ -172,7 +219,20 @@
172 219
         order by pb.blockorder
173 220
     </select>
174 221
     <!--教师阅卷-题块列表-->
175
-    <select id="listTeacherBlock" resultType="java.util.Map">
222
+    <resultMap id="teacherBlockResultMap" type="java.util.Map">
223
+        <result property="mblockid" column="mblockid"/>
224
+        <result property="blockname" column="blockname"/>
225
+        <result property="blockorder" column="blockorder"/>
226
+        <result property="bqnum" column="bqnum"/>
227
+        <collection property="questions" select="listQuestion" column="mblockid"/>
228
+    </resultMap>
229
+    <select id="listQuestion" resultType="java.util.Map">
230
+        select pbq.mbqid,pbq.mptqid,pbq.mbqtype,pbq.bqscore,pbq.bqorder,pbq.bqn
231
+        ,pbq.mergeqid,pbq.mergeqn,pbq.mergescore,pbq.scorestepway,pbq.scorestep
232
+        from ms_paper_block_question pbq where pbq.mblockid=#{mblockid}
233
+        order by pbq.bqn
234
+    </select>
235
+    <select id="listTeacherBlock" resultMap="teacherBlockResultMap">
176 236
         select pct.mblockid,pb.blockname,pb.blockorder,pb.bqnum
177 237
         from ms_paper_block pb inner join ms_paper_check_teacher pct on pb.mblockid = pct.mblockid
178 238
         and pct.teacherid = #{param.handleid}
@@ -180,40 +240,39 @@
180 240
         group by pb.mblockid
181 241
         order by pb.blockorder
182 242
     </select>
183
-    <!--获取题块阅卷状态-->
184
-    <select id="listPaperCheck" resultType="com.xhkjedu.smarking.model.papercheck.MsPaperCheck">
243
+    <!--教师阅卷-待批题块列表-->
244
+    <select id="listBlockCheck" resultType="com.xhkjedu.smarking.model.papercheck.MsPaperCheck">
185 245
         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>
246
+        ,pc.checkstate,pc.correcttype,pc.mpid
247
+        from ms_paper_check pc inner join ms_paper_student_block psb on psb.mblockid = pc.mblockid and psb.mpid = pc.mpid
248
+        inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
249
+        where pc.checkstate=1 and psb.checked!=2 and pc.mpid=#{param.mpid}
250
+        group by pc.mblockid
193 251
         order by pc.mpcid
194 252
     </select>
195
-    <!--获取待批试题(平均、定量分配)-->
253
+    <!--教师阅卷-按题块-获取待批试题-->
196 254
     <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
255
+        <if test="param.dispenseway!=null and param.dispenseway!=2">
256
+            select pctt.mblockid,pctt.mpsbid,pctt.checktype,psb.stuanswer,psb.checked
257
+            ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime,psb.studentid
258
+            from ms_paper_student_block psb inner join ms_paper_check_teacher_task pctt on psb.mpsbid = pctt.mpsbid and psb.mpid=pctt.mpid
259
+            where pctt.mpid=#{param.mpid} and pctt.mblockid = #{param.mblockid} and pctt.teacherid = #{param.teacherid}
260
+            order by field(pctt.checkstate,2,1,3),pctt.taskorder
261
+            limit 1
262
+        </if>
263
+        <if test="param.dispenseway!=null and param.dispenseway==2">
264
+            select psb.mblockid,psb.mpsbid,psb.answertype,psb.stuanswer,psb.qscore,psb.checked
265
+            ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime,psb.studentid
266
+            from ms_paper_student_block psb
267
+            where psb.mpid=#{param.mpid} and psb.mblockid = #{param.mblockid}
268
+            and (psb.checked=0 or (psb.checked=1 and (psb.firstcid=#{param.teacherid}
269
+            <if test="param.checktype==2">
270
+                or psb.secondcid=#{param.teacherid}
271
+            </if>
272
+            )))
273
+            order by field(psb.checked,1,0,2)
274
+            limit 1
275
+        </if>
217 276
     </select>
218 277
     <!--阅卷进度-按试题-->
219 278
     <resultMap id="questionResultMap" type="java.util.Map">
@@ -239,4 +298,130 @@
239 298
         group by q.mptqid
240 299
         order by q.qorder,q.qn
241 300
     </select>
301
+    <!--阅卷进度-按试题-查看详情-->
302
+    <select id="detailByQuestion" resultType="java.util.Map">
303
+        <if test="dispenseway!=null and dispenseway!=2">
304
+            select pctt.teacherid,u.username as teachername
305
+            ,count(pctt.mpcttid) as total_num,count(if(pctt.checkstate=3,1,null)) as checked_num
306
+            ,count(if(pctt.checkstate!=3,1,null))as uncheck_num
307
+            from ms_paper_check_teacher_task pctt left join t_user u on u.userid = pctt.teacherid
308
+            where pctt.mpid=#{mpid} and pctt.mblockid=#{mblockid}
309
+            group by pctt.teacherid
310
+        </if>
311
+        <if test="dispenseway!=null and dispenseway==2">
312
+            select t.teacherid,u.username as teachername
313
+            ,sum(t.total_num) as total_num,sum(t.checked_num) as checked_num,sum(t.uncheck_num) as uncheck_num
314
+            from(select psb.firstcid as teacherid,count(*) as total_num,count(if(psb.firstcime is not null,1,null)) as checked_num
315
+            ,count(if(psb.firstcime is null,1,null)) as uncheck_num
316
+            from ms_paper_student_question psb
317
+            where psb.mpid=#{mpid} and psb.mptqid=#{mblockid}
318
+            group by psb.firstcid
319
+            <if test="checktype!=null and checktype==2">
320
+                union
321
+                select psb.secondcid as teacherid,count(*) as total_num,count(if(psb.secondctime is not null,1,null)) as checked_num
322
+                ,count(if(psb.secondctime is null,1,null)) as uncheck_num
323
+                from ms_paper_student_question psb
324
+                where psb.mpid=#{mpid} and psb.mptqid=#{mblockid}
325
+                group by psb.secondcid
326
+            </if>)t left join t_user u on t.teacherid=u.userid
327
+            group by t.teacherid
328
+        </if>
329
+    </select>
330
+    <!--教师阅卷-待批试题列表-->
331
+    <select id="listQuestionCheck" resultType="com.xhkjedu.smarking.model.papercheck.MsPaperCheck">
332
+        select pc.mblockid,pc.checktype,pc.hidefirstscore,pc.scoreway,pc.finalscore,pc.roundvalue,pc.dispenseway,pc.numtype
333
+        ,pc.checkstate,pc.correcttype,pc.mpid
334
+        from ms_paper_check pc inner join ms_paper_student_question psb on psb.mptqid = pc.mblockid and psb.mpid = pc.mpid
335
+        inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
336
+        where pc.checkstate=1 and psb.checked!=2 and pc.mpid=#{param.mpid}
337
+        group by pc.mblockid
338
+        order by pc.mpcid
339
+    </select>
340
+    <!--教师阅卷-按试题-获取待批试题-->
341
+    <select id="getCorrectQuestion" resultType="com.xhkjedu.smarking.vo.papercheck.MsPaperCheckVo">
342
+        <if test="param.dispenseway!=null and param.dispenseway!=2">
343
+            select pctt.mblockid,pctt.mpsbid,pctt.checktype,psb.stuanswer,psb.checked
344
+            ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime
345
+            from ms_paper_student_question psb inner join ms_paper_check_teacher_task pctt on psb.mpsqid = pctt.mpsbid and psb.mpid=pctt.mpid
346
+            where pctt.mpid=#{param.mpid} and pctt.mblockid = #{param.mblockid} and pctt.teacherid = #{param.teacherid}
347
+            order by field(pctt.checkstate,2,1,3),pctt.taskorder
348
+            limit 1
349
+        </if>
350
+        <if test="param.dispenseway!=null and param.dispenseway==2">
351
+            select psb.mptqid as mblockid,psb.mpsqid as mpsbid,psb.answertype,psb.stuanswer,psb.qscore,psb.checked
352
+            ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime
353
+            from ms_paper_student_question psb
354
+            where psb.mpid=#{param.mpid} and psb.mptqid = #{param.mblockid}
355
+            and (psb.checked=0 or (psb.checked=1 and (psb.firstcid=#{param.teacherid}
356
+            <if test="param.checktype==2">
357
+                or psb.secondcid=#{param.teacherid}
358
+            </if>
359
+            )))
360
+            order by field(psb.checked,1,0,2)
361
+            limit 1
362
+        </if>
363
+    </select>
364
+    <!--教师阅卷-待批班级列表-->
365
+    <select id="listClassCheck" resultType="com.xhkjedu.smarking.model.papercheck.MsPaperCheck">
366
+        select pc.mblockid,pc.checktype,pc.hidefirstscore,pc.scoreway,pc.finalscore,pc.roundvalue,pc.dispenseway,pc.numtype
367
+        ,pc.checkstate,pc.correcttype,pc.mpid
368
+        from ms_paper_check pc inner join ms_paper_student_question psb on psb.mpid = pc.mpid
369
+        inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
370
+        where pc.checkstate=1 and psb.checked!=2 and pc.mpid=#{param.mpid}
371
+        group by pc.mblockid
372
+        order by pc.mpcid
373
+    </select>
374
+    <!--教师阅卷-按班级-获取待批试题-->
375
+    <select id="getCorrectClassQuestion" resultType="com.xhkjedu.smarking.vo.papercheck.MsPaperCheckVo">
376
+        <if test="param.dispenseway!=null and param.dispenseway!=2">
377
+            select pctt.mblockid,pctt.mpsbid,pctt.checktype,psb.stuanswer,psb.checked
378
+            ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime,psb.mptqid
379
+            from ms_paper_student_question psb inner join ms_paper_check_teacher_task pctt on psb.mpsqid = pctt.mpsbid and psb.mpid=pctt.mpid
380
+            where pctt.mpid=#{param.mpid} and pctt.mblockid = #{param.mblockid} and pctt.teacherid = #{param.teacherid}
381
+            order by field(pctt.checkstate,2,1,3),pctt.taskorder
382
+            limit 1
383
+        </if>
384
+        <if test="param.dispenseway!=null and param.dispenseway==2">
385
+            select c.classid as mblockid,psb.mpsqid as mpsbid,psb.answertype,psb.stuanswer,psb.qscore,psb.checked
386
+            ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime,psb.mptqid
387
+            from ms_paper_student_question psb inner join ms_class c on psb.mpid=c.mpid
388
+            where psb.mpid=#{param.mpid} and c.classid = #{param.mblockid}
389
+            and (psb.checked=0 or (psb.checked=1 and (psb.firstcid=#{param.teacherid}
390
+            <if test="param.checktype==2">
391
+                or psb.secondcid=#{param.teacherid}
392
+            </if>
393
+            )))
394
+            order by field(psb.checked,1,0,2),psb.mptqid
395
+            limit 1
396
+        </if>
397
+    </select>
398
+    <!--获取教师批阅数量-->
399
+    <select id="getCheckNum" resultType="com.xhkjedu.smarking.model.papercheck.MsPaperCheckTeacher">
400
+        <if test="param.dispenseway!=null and param.dispenseway!=2">
401
+            select pct.tasknum,count(if(pctt.checkstate=3,1,null)) as checkednum
402
+            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
403
+            where pct.mpid=#{param.mpid} and pct.teacherid=#{param.handleid} and pct.mblockid=#{param.mblockid}
404
+        </if>
405
+        <if test="param.dispenseway!=null and param.dispenseway==2">
406
+            <if test="param.correcttype==3">
407
+                select count(psb.mpsbid*#{param.checktype}) as tasknum
408
+                ,count(if(pctt.checkstate=3,1,null)) as checkednum
409
+                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
410
+                where psb.mpid=#{param.mpid} and psb.mblockid=#{param.mblockid}
411
+            </if>
412
+            <if test="param.correcttype==2">
413
+                select count(psb.mpsqid*#{param.checktype}) as tasknum
414
+                ,count(if(pctt.checkstate=3,1,null)) as checkednum
415
+                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
416
+                where psb.mpid=#{param.mpid} and psb.mptqid=#{param.mblockid}
417
+            </if>
418
+            <if test="param.correcttype==1">
419
+                select count(psb.mpsqid*#{param.checktype}) as tasknum
420
+                ,count(if(pctt.checkstate=3,1,null)) as checkednum
421
+                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
422
+                inner join ms_class_student cs on psb.examid=cs.examid and psb.subjectid=cs.subjectid and psb.studentid=cs.studentid
423
+                where psb.mpid=#{param.mpid} and psb.mptqid=#{param.mptqid} and cs.classid=#{param.mblockid}
424
+            </if>
425
+        </if>
426
+    </select>
242 427
 </mapper>

+ 56
- 0
smarking/src/main/resources/mapper/stupaper/MsPaperStudentQuestionMapper.xml Zobrazit soubor

@@ -141,6 +141,62 @@
141 141
             <if test="q.mptqid!=null and q.mptqid!=0">and mptqid=#{q.mptqid}</if>
142 142
         </foreach>
143 143
     </update>
144
+    <!--更新学生单题批阅信息-->
145
+    <update id="checkByMptqidAndStudentId">
146
+        update ms_paper_student_question set checked=#{block.checked}
147
+        <trim prefix="stuscore = case mptqid" suffix="end,">
148
+            <foreach collection="list" item="q" separator="when">
149
+                #{q.mptqid} then ifnull(#{q.stuscore},stuscore)
150
+            </foreach>
151
+        </trim>
152
+        <if test="block.firstcime!=null and block.firstcime!=0">
153
+            <trim prefix="firstccore = case mptqid" suffix="end,">
154
+               <foreach collection="list" item="q" separator="when">
155
+                   #{q.mptqid} then #{q.firstccore}
156
+               </foreach>
157
+            </trim>
158
+            <trim prefix="firstcime = case mptqid" suffix="end,">
159
+                <foreach collection="list" item="q" separator="when">
160
+                    #{q.mptqid} then #{q.firstcime}
161
+                </foreach>
162
+            </trim>
163
+        </if>
164
+        <if test="block.secondctime!=null and block.secondctime!=0">
165
+            <trim prefix="secondcscore = case mptqid" suffix="end,">
166
+                <foreach collection="list" item="q" separator="when">
167
+                    #{q.mptqid} then #{q.secondcscore}
168
+                </foreach>
169
+            </trim>
170
+            <trim prefix="secondctime = case mptqid" suffix="end,">
171
+                <foreach collection="list" item="q" separator="when">
172
+                    #{q.mptqid} then #{q.secondctime}
173
+                </foreach>
174
+            </trim>
175
+        </if>
176
+        <if test="block.hasgood!=null and block.hasgood!=0">
177
+           ,hasgood=#{block.hasgood}
178
+        </if>
179
+        <if test="block.hasbad!=null and block.hasbad!=0">
180
+           ,hasbad=#{block.hasbad}
181
+        </if>
182
+        <if test="block.hasproblem!=null and block.hasproblem!=0">
183
+           ,hasproblem=#{block.hasproblem}
184
+        </if>
185
+        <if test="block.problemtype!=null and block.problemtype!=0">
186
+           ,problemtype=#{block.problemtype}
187
+        </if>
188
+        <if test="block.problemcomm!=null and block.problemcomm!=''">
189
+           ,problemcomm=#{block.problemcomm}
190
+        </if>
191
+        <if test="block.hasfinal!=null and block.hasfinal!=0">
192
+           ,hasfinal=#{block.hasfinal}
193
+        </if>
194
+        <if test="block.hasfinal!=null and block.finalreason!=0">
195
+           ,finalreason=#{block.finalreason}
196
+        </if>
197
+        where mblockid=#{block.mblockid} and studentid=#{block.studentid} and mptqid in
198
+        <foreach collection="list" item="q" separator="," open="(" close=")">#{q.mptqid}</foreach>
199
+    </update>
144 200
 
145 201
     <!--扫描记录-查看原卷-客观题保存-获取学生答案-->
146 202
     <select id="listStuQuestionsByMspidAnbBlockid" resultType="com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion">

Načítá se…
Zrušit
Uložit