Sfoglia il codice sorgente

扫描答题卡详情

tags/正式版本
雍文秀 2 anni fa
parent
commit
b94e79be2a

+ 10
- 6
sexam/src/main/java/com/xhkjedu/sexam/controller/paperstudent/EScanbatchController.java Vedi File

@@ -100,11 +100,15 @@ public class EScanbatchController {
100 100
         Integer sstate = eps.getSstate();
101 101
         Integer page = eps.getPage();
102 102
         Integer pageSize = eps.getPageSize();
103
-        N_Utils.validation(new Object[]{epid, "试卷id", 1, sstate, "扫描状态", 1
104
-                , page, "页码", 1, pageSize, "显示条数", 1});
105
-        PageHelper.startPage(page, pageSize);
106
-        List<Map> list = eScanbatchService.listScanStu(epid, sstate, eps.getCreatename(), eps.getClassid());
107
-        PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
108
-        return new ResultVo(0, "获取成功", pageResult);
103
+        N_Utils.validation(new Object[]{epid, "试卷id", 1, sstate, "扫描状态", 1});
104
+        if (N_Utils.isEmptyInteger(page)) {
105
+            List<Map> list = eScanbatchService.listScanStu(epid, sstate, eps.getCreatename(), eps.getClassid());
106
+            return new ResultVo(0, "获取成功", list);
107
+        } else {
108
+            PageHelper.startPage(page, pageSize);
109
+            List<Map> list = eScanbatchService.listScanStu(epid, sstate, eps.getCreatename(), eps.getClassid());
110
+            PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
111
+            return new ResultVo(0, "获取成功", pageResult);
112
+        }
109 113
     }
110 114
 }

+ 4
- 1
sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/EScanbatchMapper.java Vedi File

@@ -30,7 +30,7 @@ public interface EScanbatchMapper extends TkMapper<EScanbatch> {
30 30
     List<Map> listScanSubject(@org.apache.ibatis.annotations.Param("examid") Integer examid);
31 31
 
32 32
     //试卷扫描批次信息
33
-    List<Map> listScanBatchPapers(@Param("epid")Integer epid);
33
+    List<Map> listScanBatchPapers(@Param("epid") Integer epid);
34 34
 
35 35
     //获取答题卡扫描结果
36 36
     EScanbatch getScanResult(@Param("epid") Integer epid);
@@ -38,4 +38,7 @@ public interface EScanbatchMapper extends TkMapper<EScanbatch> {
38 38
     //扫描答题卡详情-学生列表
39 39
     List<Map> listScanStu(@Param("epid") Integer epid, @Param("sstate") Integer sstate, @Param("username") String username,
40 40
                           @Param("classid") Integer classid);
41
+
42
+    //试卷基础信息
43
+    Map listByEpId(@Param("epid") Integer epid);
41 44
 }

+ 18
- 22
sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EScanbatchService.java Vedi File

@@ -83,27 +83,22 @@ public class EScanbatchService {
83 83
      **/
84 84
     public Map scanPaperDetail(Integer epid) {
85 85
         Map paper = ePaperMapper.getExamPaperSubjectForScan(epid);
86
-        int ysznum = 0;
87 86
         Integer ysrnum = Integer.parseInt(paper.get("ysrnum").toString());
88
-        if(paper.get("scantronfile")!=null){
89
-            String scantronfile = paper.get("scantronfile").toString();
90
-            List<String> sflist = JSON.parseArray(scantronfile,String.class);
91
-            int pn = sflist.size() / 2;//答题卡的张数
92
-            ysznum = ysrnum * pn;//应扫码张数
93
-        }
94
-        paper.put("ysznum",ysznum);
95
-        paper.remove("scantronfile");
87
+        Integer scantronnum = Integer.parseInt(paper.get("scantronnum").toString());
88
+        int ysznum = ysrnum * scantronnum;//应扫码张数
89
+        paper.put("ysznum", ysznum);
90
+        paper.remove("scantronnum");
96 91
 
97 92
         String alljson = paper.get("alljson").toString();
98
-        Map pamap = JSON.parseObject(alljson,Map.class);
93
+        Map pamap = JSON.parseObject(alljson, Map.class);
99 94
         List<Map> ranglist = (List<Map>) pamap.get("ranglist");
100
-        for(Map m : ranglist){
95
+        for (Map m : ranglist) {
101 96
             String ptname = m.get("qtname").toString();
102
-            Integer num = Integer.parseInt( m.get("num").toString());
103
-            if("客观题".equals(ptname)){
104
-                paper.put("kgt",num);
105
-            }else{
106
-                paper.put("zgt",num);
97
+            Integer num = Integer.parseInt(m.get("num").toString());
98
+            if ("客观题".equals(ptname)) {
99
+                paper.put("kgt", num);
100
+            } else {
101
+                paper.put("zgt", num);
107 102
             }
108 103
         }
109 104
         paper.remove("alljson");
@@ -118,21 +113,22 @@ public class EScanbatchService {
118 113
 
119 114
     //扫描答题卡详情
120 115
     public Map getScanDetail(Integer epid, Integer examid) {
121
-        Map map = eBaseMapper.findById(examid);
116
+        Map map = eScanbatchMapper.listByEpId(epid);
122 117
         List<Map> classes = eClassMapper.listByExamId(examid);
123 118
         int stunum = classes.stream().mapToInt(m -> (int) m.get("classnum")).sum();
119
+        Integer scantronnum = N_Utils.str2Int(map.get("scantronnum").toString());
120
+        Integer jhnum = stunum * scantronnum;
124 121
         EScanbatch scanbatch = eScanbatchMapper.getScanResult(epid);//获取答题卡扫描结果
125
-        Integer batchnum = scanbatch.getBatchnum();
126 122
         Integer scannum = scanbatch.getScannum();
127 123
         Integer errornum = scanbatch.getErrornum();
128 124
         Integer sbnum = scannum - errornum;
129 125
         Integer qknum = scanbatch.getQknum();
130
-        Integer wsnum = ExamUtil.subtractInt(stunum, batchnum);
131
-        map.put("jhnum", stunum);//计划张数
126
+        Integer wsnum = ExamUtil.subtractInt(jhnum, scannum);
127
+        map.put("jhnum", jhnum);//计划张数
132 128
         map.put("wsnum", wsnum);//未扫张数
133
-        map.put("ysnum", batchnum);//已扫张数
129
+        map.put("ysnum", scannum);//已扫张数
134 130
         map.put("qknum", qknum);//缺考人数
135
-        map.put("smrate", N_Utils.getIntegerDivideAndMulitiply(scannum, stunum));//扫描进度
131
+        map.put("smrate", N_Utils.getIntegerDivideAndMulitiply(scannum, jhnum));//扫描进度
136 132
         map.put("sbnum", sbnum);//识别张数
137 133
         map.put("sbrate", N_Utils.getIntegerDivideAndMulitiply(sbnum, scannum));//识别比例
138 134
         map.put("classes", classes);//班级列表

+ 1
- 1
sexam/src/main/resources/mapper/paper/EPaperMapper.xml Vedi File

@@ -127,7 +127,7 @@
127 127
 
128 128
     <!--根据试卷id获取考试科目信息-->
129 129
     <select id="getExamPaperSubjectForScan" resultType="java.util.Map">
130
-        select e.examname,e.gradeid,s.subjectname,p.pnum,p.ptype,a.alljson,p.scantronfile,
130
+        select e.examname,e.gradeid,s.subjectname,p.pnum,p.ptype,a.alljson,ifnull(p.scantronnum,1)scantronnum,
131 131
                (select count(*) from e_paper_student ps where ps.epid=p.epid) ysrnum
132 132
         from e_paper p left join e_subject s on p.esid=s.esid
133 133
         left join e_base e on s.examid=e.examid left join e_paper_analyze a on p.epid=a.epid

+ 8
- 1
sexam/src/main/resources/mapper/paperstudent/EScanbatchMapper.xml Vedi File

@@ -49,7 +49,8 @@
49 49
 
50 50
     <!--获取答题卡扫描结果-->
51 51
     <select id="getScanResult" resultType="com.xhkjedu.sexam.model.paperstudent.EScanbatch">
52
-        select sum(batchnum)batchnum,sum(scannum)scannum,sum(errornum)errornum,sum(qknum)qknum,examid
52
+        select ifnull(sum(batchnum),0)batchnum,ifnull(sum(scannum),0)scannum
53
+        ,ifnull(sum(errornum),0)errornum,ifnull(sum(qknum),0)qknum
53 54
         from e_scanbatch where epid=#{epid}
54 55
     </select>
55 56
     <!--扫描答题卡详情-学生列表-->
@@ -72,4 +73,10 @@
72 73
             </if>
73 74
         </where>
74 75
     </select>
76
+    <!--试卷基础信息-->
77
+    <select id="listByEpId" resultType="java.util.Map">
78
+        select ifnull(ep.scantronnum,1)scantronnum,eb.examname,eb.gradeid
79
+        from e_paper ep left join e_base eb on ep.examid = eb.examid
80
+        where ep.epid=#{epid}
81
+    </select>
75 82
 </mapper>

Loading…
Annulla
Salva