Browse Source

扫描异常处理

ywx
王宁 2 months ago
parent
commit
ff142ac9b5

+ 56
- 3
smarking/src/main/java/com/xhkjedu/smarking/controller/scan/MsScanbatchPaperController.java View File

@@ -115,6 +115,20 @@ public class MsScanbatchPaperController {
115 115
         return new ResultVo(0, "获取成功", list);
116 116
     }
117 117
 
118
+    /*
119
+     * @Description 扫描异常-异常列表-数量
120
+     * @Date 2024/11/11 10:30:02
121
+     * @Author WN
122
+     * @Param [msScanbatchPaper]
123
+     * @Return com.xhkjedu.vo.ResultVo
124
+     **/
125
+    @PostMapping("/error_list_num")
126
+    public ResultVo listScanPaperErrorsNum(@RequestBody MsScanbatchPaper msScanbatchPaper) {
127
+        N_Utils.validation(new Object[]{msScanbatchPaper.getMpid(), "试卷id", 1});
128
+        Map<String, Object> map = msScanbatchPaperService.listScanPaperErrorNum(msScanbatchPaper.getMpid());
129
+        return new ResultVo(0, "获取成功", map);
130
+    }
131
+
118 132
     /*
119 133
      * @Description 扫描异常-删除
120 134
      * @Date 2024/11/8 15:31:23
@@ -161,14 +175,14 @@ public class MsScanbatchPaperController {
161 175
     }
162 176
 
163 177
     /*
164
-     * @Description 扫描异常--考号异常确认
178
+     * @Description 扫描异常--考号异常-考号确认
165 179
      * @Date 2024/11/8 17:37:47
166 180
      * @Author WN
167 181
      * @Param [ps]
168 182
      * @Return com.xhkjedu.vo.ResultVo
169 183
      **/
170
-    @PostMapping("/error_delnum")
171
-    public ResultVo getDelScanPaperCount(@RequestBody PaperStudentWebVo ps) {
184
+    @PostMapping("/error_eno")
185
+    public ResultVo updateExamnoConfirm(@RequestBody PaperStudentWebVo ps) {
172 186
         N_Utils.validation(new Object[]{ ps.getMspid(), "扫描试卷id", 1, ps.getMpid(), "试卷id", 1, ps.getExamno(), "考号", 2});
173 187
 
174 188
         try {
@@ -180,5 +194,44 @@ public class MsScanbatchPaperController {
180 194
         }
181 195
     }
182 196
 
197
+    /*
198
+     * @Description 扫描异常--考号异常-考号重复确认
199
+     * @Date 2024/11/11 9:36:32
200
+     * @Author WN
201
+     * @Param [ps]
202
+     * @Return com.xhkjedu.vo.ResultVo
203
+     **/
204
+    @PostMapping("/error_eno_repeat")
205
+    public ResultVo updateExamnoRepeatConfirm(@RequestBody PaperStudentWebVo ps) {
206
+        N_Utils.validation(new Object[]{ ps.getMspid(), "扫描试卷id", 1, ps.getMpid(), "试卷id", 1, ps.getExamno(), "考号", 2});
207
+
208
+        try {
209
+            msScanbatchPaperService.updateExamnoRepeatConfirm(ps);
210
+            return new ResultVo(0, "考号重复确认成功");
211
+        } catch (Exception e) {
212
+            log.error("考号重复确认失败:" + e.getMessage());
213
+            return new ResultVo(1, "考号重复确认失败");
214
+        }
215
+    }
216
+
217
+    /*
218
+     * @Description 扫描异常--缺考异常确认
219
+     * @Date 2024/11/11 10:12:17
220
+     * @Author WN
221
+     * @Param [list]
222
+     * @Return com.xhkjedu.vo.ResultVo
223
+     **/
224
+    @PostMapping("/error_miss")
225
+    public ResultVo updateExamnoMissConfirm(@RequestBody List<PaperStudentWebVo> list) {
226
+        if (N_Utils.isListEmpty(list)) return new ResultVo(1, "处理数据不能为空");
227
+
228
+        for (PaperStudentWebVo ps : list) {
229
+            N_Utils.validation(new Object[]{ps.getMspid(), "扫描试卷id", 1});
230
+        }
231
+
232
+        msScanbatchPaperService.updateMissExamConfirm(list);
233
+        return new ResultVo(0, "缺考确认成功");
234
+    }
235
+
183 236
 
184 237
 }

+ 8
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/scan/MsScanbatchPaperMapper.java View File

@@ -3,6 +3,7 @@ package com.xhkjedu.smarking.mapper.scan;
3 3
 import com.xhkjedu.base.TkMapper;
4 4
 import com.xhkjedu.smarking.model.scan.MsScanbatch;
5 5
 import com.xhkjedu.smarking.model.scan.MsScanbatchPaper;
6
+import com.xhkjedu.smarking.vo.stupaper.PaperStudentWebVo;
6 7
 import org.apache.ibatis.annotations.Param;
7 8
 
8 9
 import java.util.List;
@@ -31,8 +32,15 @@ public interface MsScanbatchPaperMapper extends TkMapper<MsScanbatchPaper> {
31 32
     List<MsScanbatch> getScanErrorNum(@Param("mpid") Integer mpid);
32 33
     //扫描异常-异常列表
33 34
     List<Map<String,Object>> listScanPaperErrors(@Param("p") MsScanbatchPaper p);
35
+    //扫描异常-异常列表-数量
36
+    Map<String,Object> listScanPaperErrorsNum(@Param("mpid") Integer mpid);
34 37
     //扫描异常-更改状态
35 38
     int updateScanPaperMsstate(@Param("mspid") Integer mspid, @Param("msstate") Integer msstate);
39
+    //扫描异常-更改状态和考号
40
+    int updateScanPaperMsstateAndExamno(@Param("mspid") Integer mspid, @Param("msstate") Integer msstate,@Param("examno") String examno);
36 41
     //扫描异常-已删除数量
37 42
     int getDeleteScanPaperCount(@Param("mpid") Integer mpid);
43
+
44
+    //扫描异常-缺考异常-异常处理
45
+    int updateBatchScanPaperMspstate(@Param("list") List<PaperStudentWebVo> list);
38 46
 }

+ 2
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/stupaper/MsPaperStudentMapper.java View File

@@ -68,5 +68,7 @@ public interface MsPaperStudentMapper extends TkMapper<MsPaperStudent> {
68 68
 
69 69
     //扫描异常-清空学生扫描试卷信息
70 70
     int updateStuPaperForScanErrorClear(@Param("mpsid")Integer mpsid);
71
+    //扫描异常-缺考异常-更改状态
72
+    int updateBatchStuPaperSstate(@Param("list") List<MsPaperStudent> paperStudents);
71 73
 
72 74
 }

+ 65
- 10
smarking/src/main/java/com/xhkjedu/smarking/service/scan/MsScanbatchPaperService.java View File

@@ -494,6 +494,17 @@ public class MsScanbatchPaperService {
494 494
         return msScanbatchPaperMapper.listScanPaperErrors(msScanbatchPaper);
495 495
     }
496 496
 
497
+    /*
498
+     * @Description 扫描异常-异常列表-数量
499
+     * @Date 2024/11/11 10:29:09
500
+     * @Author WN
501
+     * @Param [mpid]
502
+     * @Return java.util.Map<java.lang.String,java.lang.Object>
503
+     **/
504
+    public Map<String,Object> listScanPaperErrorNum(Integer mpid){
505
+        return msScanbatchPaperMapper.listScanPaperErrorsNum(mpid);
506
+    }
507
+
497 508
     /*
498 509
      * @Description 扫描异常-更改状态
499 510
      * @Date 2024/11/8 15:28:47
@@ -523,7 +534,16 @@ public class MsScanbatchPaperService {
523 534
      * @Param [psWebVo]
524 535
      * @Return void
525 536
      **/
537
+    @Transactional(rollbackFor = Exception.class)
526 538
     public void updateExamnoConfirm(PaperStudentWebVo psWebVo) throws Exception{
539
+        //判断新考号情况
540
+        chandleExamnoConfirm(psWebVo);
541
+        //标记要确认的信息为已处理
542
+        msScanbatchPaperMapper.updateScanPaperMsstateAndExamno(psWebVo.getMspid(),2,psWebVo.getExamno());
543
+    }
544
+
545
+    //扫描异常-考确认新考号
546
+    private void chandleExamnoConfirm(PaperStudentWebVo psWebVo) throws Exception{
527 547
         //根据考号获取用户id
528 548
         Integer userid = userMapper.getUseridByExamno(psWebVo.getExamno());
529 549
         if(!N_Utils.isTrueInteger(userid)){
@@ -535,7 +555,14 @@ public class MsScanbatchPaperService {
535 555
         //如果新考号对应学生已有扫描信息,标记要处理的扫描试卷和新考号学生都为考号重复;异常类型1扫描出错 2考号有误 3考号重复 4缺考异常
536 556
         if(N_Utils.isTrueInteger(msPaperStudent.getMspid())){
537 557
             msScanbatchPaperMapper.updatePaperErrortype(psWebVo.getMspid(),3);//更改要处理的数据为3考号重复
538
-            clearPaperStudentQuestionAnswer(msPaperStudent);//标记要处理的学生试卷信息为3考号重复
558
+
559
+            //标记确认考号对应学生扫描试卷信息为3考号重复
560
+            msScanbatchPaperMapper.updatePaperErrortype(msPaperStudent.getMspid(),3);
561
+            Integer mpsid = msPaperStudent.getMpsid();
562
+            //清空试卷信息
563
+            msPaperStudentMapper.updateStuPaperForScanErrorClear(mpsid);
564
+            //清空试卷题块、试题
565
+            msPaperStudentBlockMapper.updateStudentBlockQuestionByMpsid(mpsid);
539 566
         }else{
540 567
             MsScanbatchPaper msScanbatchPaper = msScanbatchPaperMapper.selectByPrimaryKey(psWebVo.getMspid());
541 568
             List<MsScanbatchPaperBlock> blocks = msScanbatchPaperBlockMapper.listBlockQuestions(psWebVo.getMspid());
@@ -552,15 +579,43 @@ public class MsScanbatchPaperService {
552 579
         }
553 580
     }
554 581
 
555
-    //扫描异常-考号重复-清空学生答案
556
-    private void clearPaperStudentQuestionAnswer(MsPaperStudent msPaperStudent){
557
-        //标记确认考号对应学生扫描试卷信息为3考号重复
558
-        msScanbatchPaperMapper.updatePaperErrortype(msPaperStudent.getMspid(),3);
559
-        Integer mpsid = msPaperStudent.getMpsid();
560
-        //清空试卷信息
561
-        msPaperStudentMapper.updateStuPaperForScanErrorClear(mpsid);
562
-        //清空试卷题块、试题
563
-        msPaperStudentBlockMapper.updateStudentBlockQuestionByMpsid(mpsid);
582
+    /*
583
+     * @Description 扫描异常--考号重复确认
584
+     * @Date 2024/11/11 9:35:46
585
+     * @Author WN
586
+     * @Param [psWebVo]
587
+     * @Return void
588
+     **/
589
+    @Transactional(rollbackFor = Exception.class)
590
+    public void updateExamnoRepeatConfirm(PaperStudentWebVo psWebVo) throws Exception{
591
+        chandleExamnoConfirm(psWebVo);
592
+        //标记要确认的信息为已处理
593
+        msScanbatchPaperMapper.updateScanPaperMsstate(psWebVo.getMspid(),2);
594
+    }
595
+
596
+    /*
597
+     * @Description 扫描异常--缺考异常
598
+     * @Date 2024/11/11 10:10:10
599
+     * @Author WN
600
+     * @Param [list]
601
+     * @Return void
602
+     **/
603
+    @Transactional(rollbackFor = Exception.class)
604
+    public void updateMissExamConfirm(List<PaperStudentWebVo> list){
605
+        List<MsPaperStudent> pslist = new ArrayList<>();//保存需要设置为非缺考学生
606
+        for(PaperStudentWebVo psWebVo : list){
607
+            MsPaperStudent msPaperStudent = new MsPaperStudent();
608
+            msPaperStudent.setMspid(psWebVo.getMspid());
609
+            msPaperStudent.setSstate(2);
610
+            msPaperStudent.setMpid(psWebVo.getMpid());
611
+            pslist.add(msPaperStudent);
612
+            psWebVo.setMspstate(2);
613
+        }
614
+
615
+        //更改缺考学生为正常考试
616
+        msPaperStudentMapper.updateBatchStuPaperSstate(pslist);
617
+        //更改扫描信息里异常为已处理
618
+        msScanbatchPaperMapper.updateBatchScanPaperMspstate(list);
564 619
     }
565 620
 
566 621
 }

+ 2
- 0
smarking/src/main/java/com/xhkjedu/smarking/vo/stupaper/PaperStudentWebVo.java View File

@@ -45,4 +45,6 @@ public class PaperStudentWebVo {
45 45
 
46 46
     //提交方式:1主动提交2自动提交3返回提交
47 47
     private Integer submittype;
48
+
49
+    private Integer mspstate;//状态0默认1待处理2已处理10已删除
48 50
 }

+ 18
- 0
smarking/src/main/resources/mapper/scan/MsScanbatchPaperMapper.xml View File

@@ -43,14 +43,32 @@
43 43
         order by p.mspid
44 44
     </select>
45 45
 
46
+    <!--扫描异常-列表-异常数量-->
47
+    <select id="listScanPaperErrorsNum" resultType="java.util.Map">
48
+        select p.errortype,count(*) errornum
49
+        from ms_scanbatch_paper p left join ms_scanbatch b on p.batchid=b.batchid
50
+        where b.mpid=#{mpid} and p.haserror=1 group by p.mspid
51
+    </select>
52
+
46 53
     <!--扫描异常-更改状态-->
47 54
     <update id="updateScanPaperMsstate">
48 55
         update ms_scanbatch_paper set mspstate = #{mspstate} where mspid = #{mspid}
49 56
     </update>
57
+    <!--扫描异常-更改状态和考号-->
58
+    <update id="updateScanPaperMsstateAndExamno">
59
+        update ms_scanbatch_paper set mspstate = #{mspstate},examno=#{examno} where mspid = #{mspid}
60
+    </update>
50 61
 
51 62
     <!--扫描异常-已删除数量-->
52 63
     <select id="getDeleteScanPaperCount" resultType="java.lang.Integer">
53 64
         select count(mspid) from ms_scanbatch_paper where mpid=#{mpid} and mspstate=10
54 65
     </select>
55 66
 
67
+    <!--扫描异常-缺考异常-异常处理-->
68
+    <update id="updateBatchScanPaperMspstate">
69
+        <foreach collection="list" item="p" separator=";">
70
+            update ms_scanbatch_paper set mspstate=#{p.mspstate} where mspid=#{p.mspid}
71
+        </foreach>
72
+    </update>
73
+
56 74
 </mapper>

+ 6
- 0
smarking/src/main/resources/mapper/stupaper/MsPaperStudentMapper.xml View File

@@ -240,6 +240,12 @@
240 240
         update ms_paper_student set sstate=0,checked=0,stuscore=0.0,hasbad=0,batchid=null,mspid=null,
241 241
                                     paperfront=null,paperback=null,pagenum=0 where mpsid=#{mpsid}
242 242
     </update>
243
+    <!--扫描异常-缺考异常-更改状态-->
244
+    <update id="updateBatchStuPaperSstate">
245
+        <foreach collection="list" item="p" separator=";">
246
+            update ms_paper_student set sstate=#{p.sstate} where mspid=#{p.mspid} and mpid=#{p.mpid}
247
+        </foreach>
248
+    </update>
243 249
 
244 250
 
245 251
 </mapper>

Loading…
Cancel
Save