Browse Source

完善扫描相关

ywx
王宁 4 days ago
parent
commit
24792f3029

+ 1
- 1
smarking/src/main/java/com/xhkjedu/smarking/controller/scan/MsScanbatchController.java View File

@@ -105,7 +105,7 @@ public class MsScanbatchController {
105 105
     public ResultVo listRecordClassStudents(@RequestBody ScanParams params) {
106 106
         Integer page = params.getPage();
107 107
         Integer pageSize = params.getPageSize();
108
-        N_Utils.validation(new Object[]{params.getMpid(), "试卷id", 1,page, "显示页码", 1, pageSize, "显示条数", 1});
108
+        N_Utils.validation(new Object[]{params.getMpid(), "试卷id", 1,params.getExamid(), "考试id", 1,page, "显示页码", 1, pageSize, "显示条数", 1});
109 109
         PageHelper.startPage(page, pageSize);
110 110
         int examid = msPaperService.getExamidByMpid(params.getMpid());
111 111
         params.setExamid(examid);

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

@@ -77,7 +77,7 @@ public class MsScanbatchPaperController {
77 77
             String message = e.getMessage();
78 78
             if(!message.contains("禁止扫描")){
79 79
                 message = "保存失败";
80
-                log.error("保存扫描试卷失败", e.getMessage());
80
+                log.error("保存扫描试卷失败:" + e.getMessage());
81 81
             }
82 82
             return new ResultVo(1, message);
83 83
         }

+ 5
- 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.scan.ScanParams;
6 7
 import com.xhkjedu.smarking.vo.stupaper.PaperStudentWebVo;
7 8
 import org.apache.ibatis.annotations.Param;
8 9
 
@@ -43,4 +44,8 @@ public interface MsScanbatchPaperMapper extends TkMapper<MsScanbatchPaper> {
43 44
 
44 45
     //扫描异常-缺考异常-异常处理
45 46
     int updateBatchScanPaperMspstate(@Param("list") List<PaperStudentWebVo> list);
47
+    //获取重新识别数据
48
+    List<MsScanbatchPaper> listScanPapersForReidentify(@Param("param") ScanParams param);
49
+    //删除需要重新识别试卷识别数据
50
+    int deleteScanPaperForReidentify(@Param("param") ScanParams param);
46 51
 }

+ 1
- 3
smarking/src/main/java/com/xhkjedu/smarking/mapper/stupaper/MsPaperStudentBlockMapper.java View File

@@ -16,9 +16,6 @@ public interface MsPaperStudentBlockMapper extends TkMapper<MsPaperStudentBlock>
16 16
     //根据学生试卷ID清空作答及批阅信息
17 17
     int updateStudentBlockQuestionByMpsid(@Param("mpsid")Integer mpsid);
18 18
 
19
-    //清空试卷下所有学生作答及批阅信息
20
-    int updateStudentBlockQuestionByMpid(@Param("mpid")Integer mpid);
21
-
22 19
     //获取学生题块试题
23 20
     List<MsPaperStudentBlock> listPaperStuBlockQuestions(@Param("mpsid")Integer mpsid);
24 21
 
@@ -32,4 +29,5 @@ public interface MsPaperStudentBlockMapper extends TkMapper<MsPaperStudentBlock>
32 29
     void updateByMpsbidsAndTeacherid(@Param("mpsbids") String mpsbids,@Param("teacherid") Integer teacherid);
33 30
     //批量保存学生题块
34 31
     void insertBatchStudentBlock(@Param("list") List<MsPaperStudentBlock> list);
32
+
35 33
 }

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

@@ -7,6 +7,7 @@ import com.xhkjedu.smarking.model.report.reportstu.MsrStudent;
7 7
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudent;
8 8
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudentScore;
9 9
 import com.xhkjedu.smarking.vo.exam.CStudentVo;
10
+import com.xhkjedu.smarking.vo.scan.ScanParams;
10 11
 import com.xhkjedu.smarking.vo.stupaper.PaperStuExamVo;
11 12
 import org.apache.ibatis.annotations.Param;
12 13
 import org.springframework.scheduling.annotation.Async;
@@ -58,8 +59,6 @@ public interface MsPaperStudentMapper extends TkMapper<MsPaperStudent> {
58 59
     Integer updateStudentPaper(@Param("ps")MsPaperStudent ps);
59 60
     //试卷答案-客观题-批量更新学生试卷分值
60 61
     int updateBathStudentPaperScoreByMpsid(@Param("mpid") Integer mpid,@Param("mpsids") List<Integer> mpsids);
61
-    //修改学生试卷设置题块收试题数量
62
-    Integer updatePaperMergepnumByMpid(@Param("mpid")Integer mpid,@Param("mergepnum")Integer mergepnum);
63 62
 
64 63
     //学生考试-获取开始考试学生数量
65 64
     Integer getNumByExamIdAndSubjectIdAndStuId(@Param("student") MsClassStudent student);
@@ -93,4 +92,7 @@ public interface MsPaperStudentMapper extends TkMapper<MsPaperStudent> {
93 92
 
94 93
     //试学生成绩列表
95 94
     List<MsrStudent> listPaperStudentByExamId(@Param("examid") Integer examid, @Param("mpids") List<Integer> mpids);
95
+
96
+    //清空试卷下所有学生识别作答及批阅信息
97
+    int updateStudentBlockQuestionForReIdentify(@Param("param") ScanParams param);
96 98
 }

+ 4
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/paper/MsTemplate.java View File

@@ -23,6 +23,10 @@ public class MsTemplate extends BaseBean {
23 23
     private Integer mpid;
24 24
     //模板尺寸1A4 2A3
25 25
     private Integer tsize;
26
+    //纸张宽度(像素)
27
+    private Integer twidth;
28
+    //纸张高度(像素)
29
+    private Integer theight;
26 30
     //正面图片
27 31
     private String tfront;
28 32
     //反面图片

+ 4
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/scan/MsScanbatchPaper.java View File

@@ -27,6 +27,10 @@ public class MsScanbatchPaper extends BaseBean {
27 27
     private String paperfront;
28 28
     //试卷反面
29 29
     private String paperback;
30
+    //纸张宽度(像素)
31
+    private Integer twidth;
32
+    //纸张高度(像素)
33
+    private Integer theight;
30 34
     //是否识别0未识别1已识别
31 35
     private Integer identified;
32 36
     //考号

+ 6
- 2
smarking/src/main/java/com/xhkjedu/smarking/service/exam/SubjectScoreService.java View File

@@ -44,8 +44,12 @@ public class SubjectScoreService {
44 44
             double avgobj = 0.0;
45 45
             double avgsub = 0.0;
46 46
             if(queMap!= null){
47
-                avgobj = (double) queMap.get("avgobj");
48
-                avgsub = (double) queMap.get("avgsub");
47
+                if(queMap.get("avgobj")!= null){
48
+                    avgobj = (double) queMap.get("avgobj");
49
+                }
50
+                if(queMap.get("avgsub") != null){
51
+                    avgsub = (double) queMap.get("avgsub");
52
+                }
49 53
             }
50 54
             map.put("avgobj", avgobj);
51 55
             map.put("avgsub", avgsub);

+ 39
- 5
smarking/src/main/java/com/xhkjedu/smarking/service/scan/MsScanbatchPaperService.java View File

@@ -23,6 +23,7 @@ import com.xhkjedu.smarking.model.stupaper.MsPaperStudent;
23 23
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudentBlock;
24 24
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion;
25 25
 import com.xhkjedu.smarking.utils.MarkingUtil;
26
+import com.xhkjedu.smarking.vo.scan.ScanParams;
26 27
 import com.xhkjedu.smarking.vo.stupaper.PaperStudentWebVo;
27 28
 import com.xhkjedu.smarking.vo.system.SchoolCloudVo;
28 29
 import com.xhkjedu.utils.N_Utils;
@@ -637,19 +638,52 @@ public class MsScanbatchPaperService {
637 638
     }
638 639
 
639 640
     @Transactional(rollbackFor = Exception.class)
640
-    public void reIdentifyPaper(Integer examid,String subjectid,Integer mpid) {
641
-        Integer examstate  = msExamMapper.getExamstate(examid);
641
+    public void reIdentifyPaper(ScanParams param) {
642
+        Integer examstate  = msExamMapper.getExamstate(param.getExamid());
642 643
         if(examstate >= 3){
643 644
             throw new ServiceException("考试已统分,禁止重新识别");
644 645
         }
645 646
 
646
-        //清空学生题块试题信息和学生试卷扫描信息
647
-        msPaperStudentBlockMapper.updateStudentBlockQuestionByMpid(mpid);
648
-        msPaperStudentMapper.updateStuPaperForScanClearByMpid(mpid);
647
+        Integer mpid = param.getMpid();
648
+        //获取符合条件的需要重新识别的试卷
649
+        List<MsScanbatchPaper> scanbatchPapers = msScanbatchPaperMapper.listScanPapersForReidentify(param);
650
+        if(scanbatchPapers.isEmpty()) return;
649 651
 
650 652
         //获取考试对应的试卷模板及坐标信息
651 653
         List<MsTemplate> templates = msTemplateMapper.listTemplateBlockQueByMpid(mpid);
654
+        if(templates.isEmpty()) throw new ServiceException("该考试未设置试卷模板");
652 655
 
656
+        //清空学生题块试题信息和学生试卷扫描识别信息
657
+        msPaperStudentMapper.updateStudentBlockQuestionForReIdentify(param);
658
+        //清空符合条件的需要从新识别的试卷的识别信息
659
+        msScanbatchPaperMapper.deleteScanPaperForReidentify(param);
653 660
     }
654 661
 
662
+    private void chandleIdentifyPaper(List<MsScanbatchPaper> scanbatchPapers,List<MsTemplate> templates){
663
+        MsTemplate template = getPaperTemplate(scanbatchPapers,templates);//试卷模板
664
+        for(MsScanbatchPaper scanbatchPaper : scanbatchPapers){
665
+
666
+        }
667
+    }
668
+    //重新识别-试卷模板
669
+    private MsTemplate getPaperTemplate(List<MsScanbatchPaper> scanbatchPapers,List<MsTemplate> templates){
670
+        MsTemplate template = null;//试卷模板
671
+        if(templates.size() == 1){
672
+            template = templates.get(0);
673
+        }else{
674
+            MsScanbatchPaper firstPaper = scanbatchPapers.get(0);
675
+            Integer maxWidth = firstPaper.getTwidth() + 30;
676
+            Integer minWidth = firstPaper.getTwidth() - 30;
677
+            for(MsTemplate t : templates){
678
+                if(t.getTwidth() >= minWidth && t.getTwidth() <= maxWidth){
679
+                    template = t;
680
+                    break;
681
+                }
682
+            }
683
+        }
684
+        return template;
685
+    }
686
+
687
+
688
+
655 689
 }

+ 2
- 2
smarking/src/main/java/com/xhkjedu/smarking/vo/scan/ScanParams.java View File

@@ -18,7 +18,7 @@ public class ScanParams extends BaseBean {
18 18
 
19 19
     private Integer batchid;//批次ID
20 20
 
21
-    private Integer hasscan;//是否扫描1已扫2未扫
21
+    private Integer hasscan;//是否扫描0全部1已扫2未扫
22 22
 
23
-    private Integer hasidentify;//是否识别1已识别2未识别
23
+    private Integer hasidentify;//是否识别0全部1已识别2未识别
24 24
 }

+ 1
- 1
smarking/src/main/resources/mapper/exam/MsSubjectMapper.xml View File

@@ -117,7 +117,7 @@
117 117
         and ms.msstate=0 and concat(ms.sdate,' ',ms.begintime)&lt;=#{strtime}
118 118
     </update>
119 119
     <!--定时任务-科目结束考试-获取待结束考试-->
120
-    <select id="listMsidsForEndSubject" resultType="javj.lang.Integer">
120
+    <select id="listMsidsForEndSubject" resultType="java.lang.Integer">
121 121
         select ms.msid from ms_subject ms left join ms_exam e on ms.examid=e.examid
122 122
         where e.examstate>=1 and e.deleted=1 and e.exammode=3 and ms.msstate=1
123 123
         and adddate(concat(ms.sdate,' ',ms.endtime),interval 5 minute) &lt;#{strtime}

+ 3
- 1
smarking/src/main/resources/mapper/paper/MsTemplateMapper.xml View File

@@ -55,6 +55,8 @@
55 55
         <result property="mtid" column="mtid"/>
56 56
         <result property="mpid" column="mpid"/>
57 57
         <result property="tsize" column="tsize"/>
58
+        <result property="twidth" column="twidth"/>
59
+        <result property="theight" column="theight"/>
58 60
         <result property="blankindex" column="blankindex"/>
59 61
         <result property="anglefront" column="anglefront"/>
60 62
         <result property="angleback" column="angleback"/>
@@ -85,7 +87,7 @@
85 87
         </collection>
86 88
     </resultMap>
87 89
     <select id="listTemplateBlockQueByMpid" resultMap="paperTemplate">
88
-        select t.mtid,t.mpid,t.tsize,t.blankindex,t.anglefront,t.angleback,t.coorfront,t.coorback,
90
+        select t.mtid,t.mpid,t.tsize,t.twidth,t.theight,t.blankindex,t.anglefront,t.angleback,t.coorfront,t.coorback,
89 91
         t.dwtfront,t.dwtback,t.misscoor,t.violatecoor,t.examnocoor,t.cardcoor
90 92
         ,tb.mtbid,tb.mblockid,tb.mttype,tb.mtborder,tb.localcoor,tb.pagenum,tb.extendcoor,tb.scorecoor
91 93
         ,q.mtbqid,q.qn,q.mptqid,q.qlocalcoor,q.mtbqorder

+ 4
- 4
smarking/src/main/resources/mapper/scan/MsScanbatchMapper.xml View File

@@ -51,10 +51,10 @@
51 51
         <if test="params.classid!=null and params.classid!=0">
52 52
             and cs.classid=#{params.classid}
53 53
         </if>
54
-        <if test="params.hasscan!=null and params.hasscan!=0 and params.hasscan==1">
54
+        <if test="params.hasscan!=null and params.hasscan==1">
55 55
             and ps.batchid is not null
56 56
         </if>
57
-        <if test="params.hasscan!=null and params.hasscan!=0 and params.hasscan==2">
57
+        <if test="params.hasscan!=null and params.hasscan==2">
58 58
             and ps.batchid is null
59 59
         </if>
60 60
         order by cs.mcsid
@@ -71,10 +71,10 @@
71 71
         <if test="params.batchid!=null and params.batchid!=0">
72 72
             and b.batchid=#{params.batchid}
73 73
         </if>
74
-        <if test="params.hasidentify!=null and params.hasidentify!=0 and params.hasidentify==1">
74
+        <if test="params.hasidentify!=null and params.hasidentify==1">
75 75
             and sp.identified=1
76 76
         </if>
77
-        <if test="params.hasidentify!=null and params.hasidentify!=0 and params.hasidentify==2">
77
+        <if test="params.hasidentify!=null and params.hasidentify==2">
78 78
             and sp.identified=0
79 79
         </if>
80 80
         order by b.batchid,sp.mspid

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

@@ -71,4 +71,21 @@
71 71
         </foreach>
72 72
     </update>
73 73
 
74
+    <!--获取重新识别数据-->
75
+    <select id="listScanPapersForReidentify" resultType="com.xhkjedu.smarking.model.scan.MsScanbatchPaper">
76
+        select * from ms_scanbatch_paper where mpid=#{param.mpid}
77
+        <if test="param.batchid!=null and param.batchid!=0"> and batchid=#{param.batchid}</if>
78
+        <if test="param.hasidentify!=null and param.hasidentify==1"> and identified=1</if>
79
+        <if test="param.hasidentify!=null and param.hasidentify==2"> and identified=0</if>
80
+        order by mspid
81
+    </select>
82
+    <!--删除需要重新识别试卷识别数据-->
83
+    <delete id="deleteScanPaperForReidentify">
84
+        delete b from ms_scanbatch_paper_block b left join ms_scanbatch_paper p on b.mspid=p.mspid
85
+        where p.mpid=#{param.mpid}
86
+        <if test="param.batchid!=null and param.batchid!=0"> and p.batchid=#{param.batchid}</if>
87
+        <if test="param.hasidentify!=null and param.hasidentify==1"> and p.identified=1</if>
88
+        <if test="param.hasidentify!=null and param.hasidentify==2"> and p.identified=0</if>
89
+    </delete>
90
+
74 91
 </mapper>

+ 0
- 13
smarking/src/main/resources/mapper/stupaper/MsPaperStudentBlockMapper.xml View File

@@ -15,19 +15,6 @@
15 15
             q.hasbad=0,q.hasproblem=0,q.problemtype=0,q.problemcomm=null
16 16
         where b.mpsid = #{mpsid}
17 17
     </update>
18
-    <!--清空试卷下所有学生作答及批阅信息-->
19
-    <update id="updateStudentBlockQuestionByMpid">
20
-        update ms_paper_student_block b join ms_paper_student_question q
21
-        on b.mpsid=q.mpsid and b.mblockid=q.mblockid
22
-            set b.stuanswer=null,b.converted=0,b.checked=0,b.hasgood=0,b.hasbad=0,b.firstcid=null,b.firstcime=null,b.firstccore=0,
23
-                b.secondcid=null,b.secondctime=null,b.secondcscore=0,b.arbitrateid=null,b.arbitratetime=null,b.arbitratescore=0,
24
-                b.hasproblem=0,b.problemtype=0,b.problemcomm=null,b.hasfinal=0,b.finalreason=0,
25
-                q.answered=0,q.answertype=0,q.stuanswer=null,q.converted=0,q.answertime=0,q.stuscore=0,
26
-                q.checked=0,q.firstcid=null,q.firstcime=null,q.firstccore=0,q.secondcid=null,q.secondctime=null,q.secondcscore=0,
27
-                q.arbitrateid=null,q.arbitratetime=null,q.arbitratescore=0,q.hasgood=0,
28
-                q.hasbad=0,q.hasproblem=0,q.problemtype=0,q.problemcomm=null
29
-        where b.mpid = #{mpid}
30
-    </update>
31 18
 
32 19
     <!--获取学生题块试题-->
33 20
     <resultMap id="stuBlockQuestions" type="com.xhkjedu.smarking.model.stupaper.MsPaperStudentBlock">

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

@@ -288,4 +288,25 @@
288 288
         where mpsid=#{mpsid}
289 289
     </update>
290 290
 
291
+    <!--清空试卷下所有学生识别作答及批阅信息-->
292
+    <update id="updateStudentBlockQuestionForReIdentify">
293
+        update ms_paper_student_block b join ms_paper_student_question q
294
+        on b.mpsid=q.mpsid and b.mblockid=q.mblockid
295
+        left join ms_paper_student ps on ps.mpsid=b.mpsid
296
+        left join ms_scanbatch_paper sp on ps.mspid=sp.mspid
297
+        set b.stuanswer=null,b.converted=0,b.checked=0,b.hasgood=0,b.hasbad=0,b.firstcid=null,b.firstcime=null,b.firstccore=0,
298
+        b.secondcid=null,b.secondctime=null,b.secondcscore=0,b.arbitrateid=null,b.arbitratetime=null,b.arbitratescore=0,
299
+        b.hasproblem=0,b.problemtype=0,b.problemcomm=null,b.hasfinal=0,b.finalreason=0,
300
+        q.answered=0,q.answertype=0,q.stuanswer=null,q.converted=0,q.answertime=0,q.stuscore=0,
301
+        q.checked=0,q.firstcid=null,q.firstcime=null,q.firstccore=0,q.secondcid=null,q.secondctime=null,q.secondcscore=0,
302
+        q.arbitrateid=null,q.arbitratetime=null,q.arbitratescore=0,q.hasgood=0,
303
+        q.hasbad=0,q.hasproblem=0,q.problemtype=0,q.problemcomm=null,
304
+        ps.sstate=0,ps.stuscore=0.0,ps.stuscoretype=0,ps.hasbad=0,ps.batchid=null,ps.mspid=null,
305
+        ps.paperfront=null,ps.paperback=null,ps.pagenum=0
306
+        where b.mpid = #{param.mpid}
307
+        <if test="param.batchid!=null and param.batchid!=0"> and sp.batchid=#{param.batchid}</if>
308
+        <if test="param.hasidentify!=null and param.hasidentify==1"> and sp.identified=1</if>
309
+        <if test="param.hasidentify!=null and param.hasidentify==2"> and sp.identified=0</if>
310
+    </update>
311
+
291 312
 </mapper>

Loading…
Cancel
Save