Browse Source

扫描答题卡详情

tags/正式版本
雍文秀 2 years ago
parent
commit
79197a7bfc

+ 17
- 1
sexam/src/main/java/com/xhkjedu/sexam/controller/paperstudent/EScanbatchController.java View File

11
 import org.springframework.web.bind.annotation.RestController;
11
 import org.springframework.web.bind.annotation.RestController;
12
 
12
 
13
 import javax.annotation.Resource;
13
 import javax.annotation.Resource;
14
-import java.util.List;
15
 import java.util.Map;
14
 import java.util.Map;
16
 
15
 
17
 /**
16
 /**
32
         Map map = eScanbatchService.saveScanBatch(eScanbatch);
31
         Map map = eScanbatchService.saveScanBatch(eScanbatch);
33
         return new ResultVo(0, "成功保存", map);
32
         return new ResultVo(0, "成功保存", map);
34
     }
33
     }
34
+
35
+    /**
36
+     * 扫描答题卡详情
37
+     *
38
+     * @return com.xhkjedu.vo.ResultVo
39
+     * @Param [eps]
40
+     * @Author ywx
41
+     * @Date 2022/8/11 15:47
42
+     **/
43
+    @PostMapping("/detail")
44
+    public ResultVo getScanDetail(@RequestBody EPaperStudent eps) {
45
+        Integer epid = eps.getEpid();
46
+        Integer examid = eps.getExamid();
47
+        N_Utils.validation(new Object[]{epid, "试卷id", 1, examid, "考试id", 1});
48
+        Map map = eScanbatchService.getScanDetail(epid, examid);
49
+        return new ResultVo(0, "获取详情成功", map);
50
+    }
35
 }
51
 }

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/EScanbatchMapper.java View File

22
 
22
 
23
     //更改出错数量
23
     //更改出错数量
24
     void updateErrornum(@Param("batchid")Integer batchid);
24
     void updateErrornum(@Param("batchid")Integer batchid);
25
+
26
+    //获取答题卡扫描结果
27
+    EScanbatch getScanResult(@Param("epid") Integer epid);
25
 }
28
 }

+ 27
- 1
sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EScanbatchService.java View File

1
 package com.xhkjedu.sexam.service.paperstudent;
1
 package com.xhkjedu.sexam.service.paperstudent;
2
 
2
 
3
+import com.xhkjedu.sexam.mapper.exam.EClassMapper;
3
 import com.xhkjedu.sexam.mapper.paper.EPaperMapper;
4
 import com.xhkjedu.sexam.mapper.paper.EPaperMapper;
4
 import com.xhkjedu.sexam.mapper.paperstudent.EScanbatchMapper;
5
 import com.xhkjedu.sexam.mapper.paperstudent.EScanbatchMapper;
5
 import com.xhkjedu.sexam.model.paperstudent.EScanbatch;
6
 import com.xhkjedu.sexam.model.paperstudent.EScanbatch;
7
+import com.xhkjedu.sexam.utils.ExamUtil;
6
 import com.xhkjedu.utils.N_Utils;
8
 import com.xhkjedu.utils.N_Utils;
7
-import org.springframework.stereotype.Repository;
8
 import org.springframework.stereotype.Service;
9
 import org.springframework.stereotype.Service;
9
 
10
 
10
 import javax.annotation.Resource;
11
 import javax.annotation.Resource;
11
 import java.util.HashMap;
12
 import java.util.HashMap;
13
+import java.util.List;
12
 import java.util.Map;
14
 import java.util.Map;
13
 
15
 
14
 /**
16
 /**
22
     private EScanbatchMapper eScanbatchMapper;
24
     private EScanbatchMapper eScanbatchMapper;
23
     @Resource
25
     @Resource
24
     private EPaperMapper ePaperMapper;
26
     private EPaperMapper ePaperMapper;
27
+    @Resource
28
+    private EClassMapper eClassMapper;
25
 
29
 
26
     /**
30
     /**
27
      * @description: 保持扫描试卷批次信息
31
      * @description: 保持扫描试卷批次信息
56
         rtnmap.put("batchname",batchname);
60
         rtnmap.put("batchname",batchname);
57
         return rtnmap;
61
         return rtnmap;
58
     }
62
     }
63
+
64
+    //扫描答题卡详情
65
+    public Map getScanDetail(Integer epid, Integer examid) {
66
+        Map map = new HashMap();
67
+        List<Map> classes = eClassMapper.listByExamId(examid);
68
+        int stunum = classes.stream().mapToInt(m -> (int) m.get("classnum")).sum();
69
+        EScanbatch scanbatch = eScanbatchMapper.getScanResult(epid);//获取答题卡扫描结果
70
+        Integer batchnum = scanbatch.getBatchnum();
71
+        Integer scannum = scanbatch.getScannum();
72
+        Integer errornum = scanbatch.getErrornum();
73
+        Integer qknum = scanbatch.getQknum();
74
+        Integer wsnum = ExamUtil.subtractInt(stunum, batchnum);
75
+        map.put("jhnum", stunum);//计划张数
76
+        map.put("wsnum", wsnum);//未扫张数
77
+        map.put("ysnum", batchnum);//已扫张数
78
+        map.put("qknum", qknum);//缺考人数
79
+        map.put("smrate", N_Utils.getIntegerDivideAndMulitiply(wsnum, stunum));//扫描进度
80
+        map.put("sbnum", scannum);//识别张数
81
+        map.put("sbrate", N_Utils.getIntegerDivideAndMulitiply(scannum - errornum, scannum));//识别比例
82
+        map.put("classes", classes);//班级列表
83
+        return map;
84
+    }
59
 }
85
 }

+ 9
- 0
sexam/src/main/java/com/xhkjedu/sexam/utils/ExamUtil.java View File

122
 
122
 
123
     }
123
     }
124
 
124
 
125
+    //两数相减
126
+    public static Integer subtractInt(Integer a, Integer b) {
127
+        BigInteger biginta = new BigInteger(a + "");
128
+        BigInteger bigintb = new BigInteger(b + "");
129
+        return biginta.subtract(bigintb).intValue();
130
+
131
+    }
132
+
125
     /**
133
     /**
126
      * 分数百分比
134
      * 分数百分比
135
+     *
127
      * @param v1 分数
136
      * @param v1 分数
128
      * @param v2 占比如80%写作0.8
137
      * @param v2 占比如80%写作0.8
129
      * @return
138
      * @return

+ 5
- 1
sexam/src/main/resources/mapper/paperstudent/EScanbatchMapper.xml View File

26
     <update id="updateErrornum">
26
     <update id="updateErrornum">
27
         update e_scanbatch set errornum=(select count(*) from e_scanerror e where e.batchid=#{batchid}) where batchid=#{batchid}
27
         update e_scanbatch set errornum=(select count(*) from e_scanerror e where e.batchid=#{batchid}) where batchid=#{batchid}
28
     </update>
28
     </update>
29
-
29
+    <!--获取答题卡扫描结果-->
30
+    <select id="getScanResult" resultType="com.xhkjedu.sexam.model.paperstudent.EScanbatch">
31
+        select sum(batchnum)batchnum,sum(scannum)scannum,su(errornum)errornum,sum(es.qknum)qknum,examid
32
+        from e_scanbatch where epid=#{epid}
33
+    </select>
30
 </mapper>
34
 </mapper>

Loading…
Cancel
Save