Browse Source

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

ywx
王宁 2 months ago
parent
commit
823b71e59a

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

@@ -27,6 +27,8 @@ public class MsPaperCheck extends BaseBean {
27 27
     private Integer checktype;
28 28
     //仲裁教师ID
29 29
     private Integer arbitrateid;
30
+    //仲裁分差
31
+    private Double diffscore;
30 32
     //是否隐藏初评分0否1是
31 33
     private Integer hidefirstscore;
32 34
     //分差计算方式1题块总分值2任一给分点

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

@@ -45,12 +45,16 @@ public class MsPaperStudentBlock extends BaseBean {
45 45
     private Integer firstcime;
46 46
     //单评批改分值
47 47
     private Double firstccore;
48
+    //单评批改分值数组
49
+    private String firstccores;
48 50
     //复评批改人
49 51
     private Integer secondcid;
50 52
     //复评批改时间
51 53
     private Integer secondctime;
52 54
     //复评批改分值
53 55
     private Double secondcscore;
56
+    //复评批改分值数组
57
+    private String secondcscores;
54 58
     //仲裁人
55 59
     private Integer arbitrateid;
56 60
     //仲裁时间

+ 165
- 1
smarking/src/main/java/com/xhkjedu/smarking/service/papercheck/MsPaperCheckTeacherTaskService.java View File

@@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
22 22
 
23 23
 import javax.annotation.Resource;
24 24
 import java.util.*;
25
+import java.util.stream.Collectors;
25 26
 
26 27
 /**
27 28
  * @Description 阅卷批阅教师任务表 服务实现类
@@ -311,11 +312,11 @@ public class MsPaperCheckTeacherTaskService {
311 312
         Double qscore = param.getQscore();
312 313
         List<MsPaperBlockQuestion> questions = param.getQuestions();
313 314
         int checked = 1;
315
+        Double firstccore = param.getFirstccore();
314 316
         if (checktype.equals(1)) {//单评
315 317
             if (hasproblem.equals(0)) {
316 318
                 checked = 2;
317 319
             }
318
-            Double firstccore = param.getFirstccore();
319 320
             if (correcttype.equals(3)) {//按题块批阅
320 321
                 //题块批阅信息
321 322
                 MsPaperStudentBlock block = new MsPaperStudentBlock();
@@ -375,9 +376,172 @@ public class MsPaperCheckTeacherTaskService {
375 376
                 question.setHasproblem(hasproblem);
376 377
                 question.setProblemtype(problemtype);
377 378
                 question.setProblemcomm(problemcomm);
379
+                question.setStuscore(firstccore);
378 380
                 msPaperStudentQuestionMapper.updateByPrimaryKeySelective(question);
379 381
             }
382
+        } else {//双评
383
+            Integer handleid = param.getHandleid();
384
+            Integer firstcid = param.getFirstcid();
385
+            Integer secondcid = param.getSecondcid();
386
+            Integer firstcime = param.getFirstcime();
387
+            Integer secondcime = param.getSecondctime();
388
+            Double secondcscore = param.getSecondcscore();
389
+            Integer type = param.getChecktype();//批阅情况1一评2二评
390
+            boolean corrected = false;
391
+            if ((handleid.equals(firstcid) && N_Utils.isTrueInteger(secondcime))
392
+                    || (handleid.equals(secondcid) && N_Utils.isTrueInteger(firstcime))) {
393
+                checked = 2;
394
+                corrected = true;
395
+            }
396
+            Double diffscore = check.getDiffscore();//仲裁分差
397
+            Integer scoreway = check.getScoreway();//分差计算方式1题块总分值2任一给分点
398
+            Integer finalscore = check.getFinalscore();//最终得分取值1不取整(保留2位小数) 2取整-向上取值 3取整-向下取值
399
+            Double roundvalue = check.getRoundvalue();//取整取值间隔
400
+            Double endscore = null;
401
+            if (checked == 2) {//分差计算方式为题块总分值
402
+                double scoreDiff = MarkingUtil.scoreDiff(firstccore, secondcscore);
403
+                if (scoreway.equals(1) && diffscore.compareTo(scoreDiff) < 0) {//分差大于仲裁分差
404
+                    hasproblem = 1;
405
+                    problemtype = 5;
406
+                    problemcomm = "题块总分值大于仲裁分差";
407
+                    checked = 1;
408
+                } else if (scoreway.equals(1)) {
409
+                    double addScore = MarkingUtil.add(firstccore, secondcscore);
410
+                    endscore = getUserScore(finalscore, addScore, roundvalue);
411
+                }
412
+            }
413
+            if (correcttype.equals(3)) {//按题块批阅
414
+                //题块批阅信息
415
+                MsPaperStudentBlock block = new MsPaperStudentBlock();
416
+                block.setMpsbid(mpsbid);
417
+                String stuscores = questions.stream().map(MsPaperBlockQuestion::getMergescore).collect(Collectors.joining(";"));
418
+                if (type.equals(1)) {
419
+                    block.setFirstcime(N_Utils.getSecondTimestamp());
420
+                    block.setFirstccore(firstccore);
421
+                    block.setFirstccores(stuscores);
422
+                } else {
423
+                    block.setSecondctime(N_Utils.getSecondTimestamp());
424
+                    block.setSecondcscore(secondcscore);
425
+                    block.setSecondcscores(stuscores);
426
+                }
427
+
428
+                String[] cores;
429
+                if (type.equals(1)) {
430
+                    cores = param.getSecondcscores().split(";");
431
+                } else {
432
+                    cores = param.getFirstccores().split(";");
433
+                }
434
+                List<MsPaperStudentQuestion> studentQuestions = new ArrayList<>();
435
+                for (int j = 0; j < questions.size(); j++) {
436
+                    MsPaperBlockQuestion question = questions.get(j);
437
+                    Double stuscore = question.getStuscore();
438
+                    if (N_Utils.isTrueInteger(question.getMptqid())) {
439
+                        MsPaperStudentQuestion studentQuestion = new MsPaperStudentQuestion();
440
+                        studentQuestion.setMptqid(question.getMptqid());
441
+                        if (type.equals(1)) {
442
+                            studentQuestion.setFirstccore(stuscore);
443
+                        } else {
444
+                            studentQuestion.setSecondcscore(stuscore);
445
+                        }
446
+                        if (corrected && hasproblem.equals(0)) {
447
+                            double scoreDiff = MarkingUtil.scoreDiff(stuscore, cores[j]);
448
+                            if (scoreway.equals(2) && diffscore.compareTo(scoreDiff) < 0) {//分差大于仲裁分差
449
+                                hasproblem = 1;
450
+                                problemtype = 5;
451
+                                problemcomm = "任一给分点大于仲裁分差";
452
+                                checked = 1;
453
+                                corrected = false;
454
+                            } else if (scoreway.equals(2)) {
455
+                                double addScore = MarkingUtil.add(stuscore, cores[j]);
456
+                                endscore = getUserScore(finalscore, addScore, roundvalue);
457
+                                studentQuestion.setStuscore(endscore);
458
+                            }
459
+                        }
460
+                        studentQuestions.add(studentQuestion);
461
+                    } else {
462
+                        String[] mptqids = question.getMergeqid().split(",");
463
+                        String[] mergescores = question.getMergescore().split(",");
464
+                        double[] scores = new double[mergescores.length];
465
+                        int last = mergescores.length - 1;
466
+                        double score = 0;
467
+                        for (int i = 0; i < mergescores.length; i++) {
468
+                            scores[i] = MarkingUtil.mul(MarkingUtil.div(mergescores[i], qscore), stuscore);
469
+                            score = MarkingUtil.add(score, scores[i]);
470
+                            if (i == last) {
471
+                                scores[i] = MarkingUtil.sub(stuscore, score);
472
+                            }
473
+                        }
474
+                        String[] cores2 = cores[j].split(",");
475
+                        for (int i = 0; i < mptqids.length; i++) {
476
+                            MsPaperStudentQuestion studentQuestion = new MsPaperStudentQuestion();
477
+                            studentQuestion.setMptqid(N_Utils.obj2Int(mptqids[i]));
478
+                            if (type.equals(1)) {
479
+                                studentQuestion.setFirstccore(scores[i]);
480
+                            } else {
481
+                                studentQuestion.setSecondcscore(scores[i]);
482
+                            }
483
+                            if (corrected && hasproblem.equals(0)) {
484
+                                double scoreDiff = MarkingUtil.scoreDiff(scores[i], cores2[i]);
485
+                                if (scoreway.equals(2) && diffscore.compareTo(scoreDiff) < 0) {//分差大于仲裁分差
486
+                                    hasproblem = 1;
487
+                                    problemtype = 5;
488
+                                    problemcomm = "任一给分点大于仲裁分差";
489
+                                    checked = 1;
490
+                                    corrected = false;
491
+                                } else if (scoreway.equals(2)) {
492
+                                    double addScore = MarkingUtil.add(scores[i], cores2[i]);
493
+                                    endscore = getUserScore(finalscore, addScore, roundvalue);
494
+                                    studentQuestion.setStuscore(endscore);
495
+                                }
496
+                            }
497
+                            studentQuestions.add(studentQuestion);
498
+                        }
499
+                    }
500
+                }
501
+
502
+                block.setChecked(checked);
503
+                block.setHasgood(hasgood);
504
+                block.setHasbad(hasbad);
505
+                block.setHasproblem(hasproblem);
506
+                block.setProblemtype(problemtype);
507
+                block.setProblemcomm(problemcomm);
508
+                block.setStudentid(param.getStudentid());
509
+                block.setMblockid(param.getMblockid());
510
+                msPaperStudentBlockMapper.updateByPrimaryKeySelective(block);
511
+
512
+                msPaperStudentQuestionMapper.checkByMptqidAndStudentId(studentQuestions, block);//更新学生单题批阅信息
513
+            } else {//按试题批阅
514
+                MsPaperStudentQuestion question = new MsPaperStudentQuestion();
515
+                question.setChecked(checked);
516
+                if (type.equals(1)) {
517
+                    question.setFirstcime(N_Utils.getSecondTimestamp());
518
+                    question.setFirstccore(firstccore);
519
+                } else {
520
+                    question.setSecondctime(N_Utils.getSecondTimestamp());
521
+                    question.setSecondcscore(secondcscore);
522
+                }
523
+                question.setHasgood(hasgood);
524
+                question.setHasbad(hasbad);
525
+                question.setHasproblem(hasproblem);
526
+                question.setProblemtype(problemtype);
527
+                question.setProblemcomm(problemcomm);
528
+                question.setStuscore(endscore);
529
+                question.setMpsqid(mpsbid);
530
+            }
380 531
         }
381 532
         msPaperCheckTeacherTaskMapper.correct(param);
382 533
     }
534
+
535
+    //最终得分计算
536
+    private Double getUserScore(Integer finalscore, double addScore, Double roundvalue) {
537
+        double score;
538
+        if (finalscore.equals(1)) {
539
+            score = MarkingUtil.div(addScore, 2);
540
+        } else if (finalscore.equals(2)) {
541
+            score = MarkingUtil.roundUp(addScore, roundvalue);
542
+        } else {
543
+            score = MarkingUtil.roundDown(addScore, roundvalue);
544
+        }
545
+        return score;
546
+    }
383 547
 }

+ 54
- 6
smarking/src/main/java/com/xhkjedu/smarking/utils/MarkingUtil.java View File

@@ -125,9 +125,9 @@ public class MarkingUtil {
125 125
      * @param v2 加数
126 126
      * @return 两个参数的和
127 127
      */
128
-    public static double add(double v1, double v2) {
129
-        BigDecimal b1 = new BigDecimal(Double.toString(v1));
130
-        BigDecimal b2 = new BigDecimal(Double.toString(v2));
128
+    public static double add(Object v1, Object v2) {
129
+        BigDecimal b1 = new BigDecimal(v1.toString());
130
+        BigDecimal b2 = new BigDecimal(v2.toString());
131 131
         return b1.add(b2).doubleValue();
132 132
     }
133 133
 
@@ -172,6 +172,54 @@ public class MarkingUtil {
172 172
         return b1.divide(b2, 2, BigDecimal.ROUND_DOWN).doubleValue();
173 173
     }
174 174
 
175
+    /**
176
+     * 向上取值
177
+     * @param score 原始得分
178
+     * @param interval 取值间隔
179
+     * @return 向上取值后的结果
180
+     */
181
+    public static double roundUp(double score, double interval) {
182
+        return Math.ceil(score / interval) * interval;
183
+    }
184
+
185
+    /**
186
+     * 向下取值
187
+     * @param score 原始得分
188
+     * @param interval 取值间隔
189
+     * @return 向下取值后的结果
190
+     */
191
+    public static double roundDown(double score, double interval) {
192
+        return Math.floor(score / interval) * interval;
193
+    }
194
+
195
+    /**
196
+     * 计算总分并处理超过满分的情况
197
+     * @param scores 得分数组
198
+     * @param interval 取值间隔
199
+     * @param maxScore 满分
200
+     * @return 最终总分
201
+     */
202
+    public static double calculateTotalScore(double[] scores, double interval, double maxScore) {
203
+        double totalScore = 0.0;
204
+
205
+        for (double score : scores) {
206
+            totalScore += roundUp(score, interval);
207
+        }
208
+
209
+        return Math.min(totalScore, maxScore);
210
+    }
211
+
212
+    /**
213
+     * 计算两个分数之间的分差
214
+     * @param score1 第一个分数
215
+     * @param score2 第二个分数
216
+     * @return 分差
217
+     */
218
+    public static double scoreDiff(Object score1, Object score2) {
219
+        return Math.abs(sub(score1, score2));
220
+    }
221
+
222
+
175 223
     /**
176 224
      * 提供精确的减法运算。
177 225
      *
@@ -179,9 +227,9 @@ public class MarkingUtil {
179 227
      * @param v2 减数
180 228
      * @return 两个参数的差
181 229
      */
182
-    public static double sub(double v1, double v2) {
183
-        BigDecimal b1 = new BigDecimal(Double.toString(v1));
184
-        BigDecimal b2 = new BigDecimal(Double.toString(v2));
230
+    public static double sub(Object v1, Object v2) {
231
+        BigDecimal b1 = new BigDecimal(v1.toString());
232
+        BigDecimal b2 = new BigDecimal(v2.toString());
185 233
         return b1.subtract(b2).doubleValue();
186 234
     }
187 235
 

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

@@ -38,10 +38,14 @@ public class MsPaperCheckVo {
38 38
     private Integer firstcime;
39 39
     //单评批改分值
40 40
     private Double firstccore;
41
+    //单评批改分值数组
42
+    private String firstccores;
41 43
     //复评批改时间
42 44
     private Integer secondctime;
43 45
     //复评批改分值
44 46
     private Double secondcscore;
47
+    //复评批改分值数组
48
+    private String secondcscores;
45 49
     //仲裁人
46 50
     private Integer arbitrateid;
47 51
     //仲裁时间

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

@@ -65,7 +65,7 @@
65 65
     </select>
66 66
     <!--根据题块id获取阅卷信息-->
67 67
     <select id="findByMBlockId" resultType="com.xhkjedu.smarking.model.papercheck.MsPaperCheck">
68
-        select mpcid,mpid,mblockid,checktype,arbitrateid,hidefirstscore,scoreway,finalscore,roundvalue,dispenseway
68
+        select mpcid,mpid,mblockid,checktype,arbitrateid,diffscore,hidefirstscore,scoreway,finalscore,roundvalue,dispenseway
69 69
         from ms_paper_check where mpid = #{mpid} and mblockid = #{mblockid}
70 70
     </select>
71 71
     <!--获取学生作答及批阅信息(按题块)-->
@@ -114,6 +114,7 @@
114 114
         <result property="qn" column="qn"/>
115 115
         <result property="mblockid" column="mblockid"/>
116 116
         <result property="mpid" column="mpid"/>
117
+        <result property="qscore" column="qscore"/>
117 118
         <result property="msid" column="msid"/>
118 119
         <result property="mpcid" column="mpcid"/>
119 120
         <result property="checktype" column="checktype"/>
@@ -122,7 +123,7 @@
122 123
         <collection property="teachers" select="listCheckTeacher" column="mblockid"/>
123 124
     </resultMap>
124 125
     <select id="listQuestion" resultMap="questionResultMap">
125
-        select q.qorder,q.qn,q.mptqid as mblockid,q.mpid,p.msid,pc.mpcid,pc.checktype,pc.dispenseway
126
+        select q.qorder,q.qn,q.mptqid as mblockid,q.mpid,q.qscore,p.msid,pc.mpcid,pc.checktype,pc.dispenseway
126 127
         ,if(pc.checktype=2,(select u.username from t_user u where u.userid=pc.arbitrateid),'') as arbitratename
127 128
         from ms_paper_qtype_question q left join ms_paper_check pc on q.mpid=pc.mpid
128 129
         inner join ms_paper p on q.mpid=p.mpid

+ 12
- 0
smarking/src/main/resources/mapper/papercheck/MsPaperCheckTeacherTaskMapper.xml View File

@@ -255,14 +255,17 @@
255 255
         <if test="param.dispenseway!=null and param.dispenseway!=2">
256 256
             select pctt.mblockid,pctt.mpsbid,pctt.checktype,psb.stuanswer,psb.checked
257 257
             ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime,psb.studentid
258
+            ,psb.firstccore,psb.secondcscore,psb.firstccores,psb.secondcscores
258 259
             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 260
             where pctt.mpid=#{param.mpid} and pctt.mblockid = #{param.mblockid} and pctt.teacherid = #{param.teacherid}
261
+            and pctt.checkstate!=3 and psb.hasproblem=0
260 262
             order by field(pctt.checkstate,2,1,3),pctt.taskorder
261 263
             limit 1
262 264
         </if>
263 265
         <if test="param.dispenseway!=null and param.dispenseway==2">
264 266
             select psb.mblockid,psb.mpsbid,psb.answertype,psb.stuanswer,psb.qscore,psb.checked
265 267
             ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime,psb.studentid
268
+            ,psb.firstccore,psb.secondcscore,psb.firstccores,psb.secondcscores
266 269
             from ms_paper_student_block psb
267 270
             where psb.mpid=#{param.mpid} and psb.mblockid = #{param.mblockid}
268 271
             and (psb.checked=0 or (psb.checked=1 and (psb.firstcid=#{param.teacherid}
@@ -270,6 +273,7 @@
270 273
                 or psb.secondcid=#{param.teacherid}
271 274
             </if>
272 275
             )))
276
+            and psb.hasproblem=0
273 277
             order by field(psb.checked,1,0,2)
274 278
             limit 1
275 279
         </if>
@@ -342,14 +346,17 @@
342 346
         <if test="param.dispenseway!=null and param.dispenseway!=2">
343 347
             select pctt.mblockid,pctt.mpsbid,pctt.checktype,psb.stuanswer,psb.checked
344 348
             ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime
349
+            ,psb.firstccore,psb.secondcscore
345 350
             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 351
             where pctt.mpid=#{param.mpid} and pctt.mblockid = #{param.mblockid} and pctt.teacherid = #{param.teacherid}
352
+            and pctt.checkstate!=3 and psb.hasproblem=0
347 353
             order by field(pctt.checkstate,2,1,3),pctt.taskorder
348 354
             limit 1
349 355
         </if>
350 356
         <if test="param.dispenseway!=null and param.dispenseway==2">
351 357
             select psb.mptqid as mblockid,psb.mpsqid as mpsbid,psb.answertype,psb.stuanswer,psb.qscore,psb.checked
352 358
             ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime
359
+            ,psb.firstccore,psb.secondcscore
353 360
             from ms_paper_student_question psb
354 361
             where psb.mpid=#{param.mpid} and psb.mptqid = #{param.mblockid}
355 362
             and (psb.checked=0 or (psb.checked=1 and (psb.firstcid=#{param.teacherid}
@@ -357,6 +364,7 @@
357 364
                 or psb.secondcid=#{param.teacherid}
358 365
             </if>
359 366
             )))
367
+            and psb.hasproblem=0
360 368
             order by field(psb.checked,1,0,2)
361 369
             limit 1
362 370
         </if>
@@ -376,14 +384,17 @@
376 384
         <if test="param.dispenseway!=null and param.dispenseway!=2">
377 385
             select pctt.mblockid,pctt.mpsbid,pctt.checktype,psb.stuanswer,psb.checked
378 386
             ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime,psb.mptqid
387
+            ,psb.firstccore,psb.secondcscore
379 388
             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 389
             where pctt.mpid=#{param.mpid} and pctt.mblockid = #{param.mblockid} and pctt.teacherid = #{param.teacherid}
390
+            and pctt.checkstate!=3 and psb.hasproblem=0
381 391
             order by field(pctt.checkstate,2,1,3),pctt.taskorder
382 392
             limit 1
383 393
         </if>
384 394
         <if test="param.dispenseway!=null and param.dispenseway==2">
385 395
             select c.classid as mblockid,psb.mpsqid as mpsbid,psb.answertype,psb.stuanswer,psb.qscore,psb.checked
386 396
             ,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime,psb.mptqid
397
+            ,psb.firstccore,psb.secondcscore
387 398
             from ms_paper_student_question psb inner join ms_class c on psb.mpid=c.mpid
388 399
             where psb.mpid=#{param.mpid} and c.classid = #{param.mblockid}
389 400
             and (psb.checked=0 or (psb.checked=1 and (psb.firstcid=#{param.teacherid}
@@ -391,6 +402,7 @@
391 402
                 or psb.secondcid=#{param.teacherid}
392 403
             </if>
393 404
             )))
405
+            and psb.hasproblem=0
394 406
             order by field(psb.checked,1,0,2),psb.mptqid
395 407
             limit 1
396 408
         </if>

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

@@ -194,6 +194,9 @@
194 194
         <if test="block.hasfinal!=null and block.finalreason!=0">
195 195
            ,finalreason=#{block.finalreason}
196 196
         </if>
197
+        <if test="block.checked!=null and block.checked!=0">
198
+            ,checked=#{block.checked}
199
+        </if>
197 200
         where mblockid=#{block.mblockid} and studentid=#{block.studentid} and mptqid in
198 201
         <foreach collection="list" item="q" separator="," open="(" close=")">#{q.mptqid}</foreach>
199 202
     </update>

Loading…
Cancel
Save