Browse Source

批阅

ywx
雍文秀 1 month ago
parent
commit
43d9d7f273

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

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

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/papercheck/MsPaperCheckTeacherTaskMapper.java View File

@@ -78,4 +78,7 @@ public interface MsPaperCheckTeacherTaskMapper extends TkMapper<MsPaperCheckTeac
78 78
 
79 79
     //获取教师批阅数量
80 80
     MsPaperCheckTeacher getCheckNum(@Param("param") MsPaperCheck paperCheck);
81
+
82
+    //教师批阅-批阅试题
83
+    void correct(@Param("param") MsPaperCheckVo param);
81 84
 }

+ 3
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/stupaper/MsPaperStudentQuestionMapper.java View File

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

@@ -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
     //给分步长内容

+ 4
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/stupaper/MsPaperStudentQuestion.java View File

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

+ 101
- 0
smarking/src/main/java/com/xhkjedu/smarking/service/papercheck/MsPaperCheckTeacherTaskService.java View File

@@ -7,10 +7,12 @@ import com.xhkjedu.smarking.mapper.papercheck.MsPaperCheckTeacherTaskMapper;
7 7
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentBlockMapper;
8 8
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentQuestionMapper;
9 9
 import com.xhkjedu.smarking.mapper.system.UserMapper;
10
+import com.xhkjedu.smarking.model.paper.MsPaperBlockQuestion;
10 11
 import com.xhkjedu.smarking.model.papercheck.MsPaperCheck;
11 12
 import com.xhkjedu.smarking.model.papercheck.MsPaperCheckTeacher;
12 13
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudentBlock;
13 14
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion;
15
+import com.xhkjedu.smarking.utils.MarkingUtil;
14 16
 import com.xhkjedu.smarking.vo.papercheck.MsCheckParam;
15 17
 import com.xhkjedu.smarking.vo.papercheck.MsPaperCheckVo;
16 18
 import com.xhkjedu.utils.N_Utils;
@@ -239,6 +241,8 @@ public class MsPaperCheckTeacherTaskService {
239 241
                 }
240 242
                 msPaperStudentQuestionMapper.updateByPrimaryKeySelective(question);
241 243
             }
244
+            sq.setChecktype(checktype);
245
+            sq.setMpid(paperCheck.getMpid());
242 246
         }
243 247
         Map map = new HashMap();
244 248
         map.put("sq", sq);
@@ -279,4 +283,101 @@ public class MsPaperCheckTeacherTaskService {
279 283
         List<Map> list = msPaperCheckTeacherTaskMapper.detailByQuestion(mpid, mblockid, dispenseway, check.getChecktype());
280 284
         return setListNum(dispenseway, list);
281 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
+    }
282 383
 }

+ 13
- 0
smarking/src/main/java/com/xhkjedu/smarking/utils/MarkingUtil.java View File

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

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

@@ -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
@@ -33,8 +36,12 @@ public class MsPaperCheckVo {
33 36
     private Integer secondcid;
34 37
     //单评批改时间
35 38
     private Integer firstcime;
39
+    //单评批改分值
40
+    private Double firstccore;
36 41
     //复评批改时间
37 42
     private Integer secondctime;
43
+    //复评批改分值
44
+    private Double secondcscore;
38 45
     //仲裁人
39 46
     private Integer arbitrateid;
40 47
     //仲裁时间
@@ -43,4 +50,23 @@ public class MsPaperCheckVo {
43 50
     private Double arbitratescore;
44 51
     //批阅情况1一评2二评
45 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;
46 72
 }

+ 22
- 3
smarking/src/main/resources/mapper/papercheck/MsPaperCheckTeacherTaskMapper.xml View File

@@ -35,6 +35,12 @@
35 35
         set checkstate = #{checkstate}
36 36
         where mpid=#{mpid} and mpsbid=#{mpsbid} and teacherid=#{teacherid}
37 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>
38 44
     <!--删除教师阅卷任务-->
39 45
     <delete id="deleteByMpsbids">
40 46
         delete from ms_paper_check_teacher_task where mpsbid in (${mpsbids})
@@ -213,7 +219,20 @@
213 219
         order by pb.blockorder
214 220
     </select>
215 221
     <!--教师阅卷-题块列表-->
216
-    <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">
217 236
         select pct.mblockid,pb.blockname,pb.blockorder,pb.bqnum
218 237
         from ms_paper_block pb inner join ms_paper_check_teacher pct on pb.mblockid = pct.mblockid
219 238
         and pct.teacherid = #{param.handleid}
@@ -235,7 +254,7 @@
235 254
     <select id="getCorrectBlock" resultType="com.xhkjedu.smarking.vo.papercheck.MsPaperCheckVo">
236 255
         <if test="param.dispenseway!=null and param.dispenseway!=2">
237 256
             select pctt.mblockid,pctt.mpsbid,pctt.checktype,psb.stuanswer,psb.checked
238
-            ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime
257
+            ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime,psb.studentid
239 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
240 259
             where pctt.mpid=#{param.mpid} and pctt.mblockid = #{param.mblockid} and pctt.teacherid = #{param.teacherid}
241 260
             order by field(pctt.checkstate,2,1,3),pctt.taskorder
@@ -243,7 +262,7 @@
243 262
         </if>
244 263
         <if test="param.dispenseway!=null and param.dispenseway==2">
245 264
             select psb.mblockid,psb.mpsbid,psb.answertype,psb.stuanswer,psb.qscore,psb.checked
246
-            ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime
265
+            ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime,psb.studentid
247 266
             from ms_paper_student_block psb
248 267
             where psb.mpid=#{param.mpid} and psb.mblockid = #{param.mblockid}
249 268
             and (psb.checked=0 or (psb.checked=1 and (psb.firstcid=#{param.teacherid}

+ 56
- 0
smarking/src/main/resources/mapper/stupaper/MsPaperStudentQuestionMapper.xml View File

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

Loading…
Cancel
Save