Parcourir la source

扫描答题卡详情

tags/正式版本
雍文秀 il y a 2 ans
Parent
révision
79197a7bfc

+ 17
- 1
sexam/src/main/java/com/xhkjedu/sexam/controller/paperstudent/EScanbatchController.java Voir le fichier

@@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
11 11
 import org.springframework.web.bind.annotation.RestController;
12 12
 
13 13
 import javax.annotation.Resource;
14
-import java.util.List;
15 14
 import java.util.Map;
16 15
 
17 16
 /**
@@ -32,4 +31,21 @@ public class EScanbatchController {
32 31
         Map map = eScanbatchService.saveScanBatch(eScanbatch);
33 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 Voir le fichier

@@ -22,4 +22,7 @@ public interface EScanbatchMapper extends TkMapper<EScanbatch> {
22 22
 
23 23
     //更改出错数量
24 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 Voir le fichier

@@ -1,14 +1,16 @@
1 1
 package com.xhkjedu.sexam.service.paperstudent;
2 2
 
3
+import com.xhkjedu.sexam.mapper.exam.EClassMapper;
3 4
 import com.xhkjedu.sexam.mapper.paper.EPaperMapper;
4 5
 import com.xhkjedu.sexam.mapper.paperstudent.EScanbatchMapper;
5 6
 import com.xhkjedu.sexam.model.paperstudent.EScanbatch;
7
+import com.xhkjedu.sexam.utils.ExamUtil;
6 8
 import com.xhkjedu.utils.N_Utils;
7
-import org.springframework.stereotype.Repository;
8 9
 import org.springframework.stereotype.Service;
9 10
 
10 11
 import javax.annotation.Resource;
11 12
 import java.util.HashMap;
13
+import java.util.List;
12 14
 import java.util.Map;
13 15
 
14 16
 /**
@@ -22,6 +24,8 @@ public class EScanbatchService {
22 24
     private EScanbatchMapper eScanbatchMapper;
23 25
     @Resource
24 26
     private EPaperMapper ePaperMapper;
27
+    @Resource
28
+    private EClassMapper eClassMapper;
25 29
 
26 30
     /**
27 31
      * @description: 保持扫描试卷批次信息
@@ -56,4 +60,26 @@ public class EScanbatchService {
56 60
         rtnmap.put("batchname",batchname);
57 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 Voir le fichier

@@ -122,8 +122,17 @@ public class ExamUtil {
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 136
      * @param v1 分数
128 137
      * @param v2 占比如80%写作0.8
129 138
      * @return

+ 5
- 1
sexam/src/main/resources/mapper/paperstudent/EScanbatchMapper.xml Voir le fichier

@@ -26,5 +26,9 @@
26 26
     <update id="updateErrornum">
27 27
         update e_scanbatch set errornum=(select count(*) from e_scanerror e where e.batchid=#{batchid}) where batchid=#{batchid}
28 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 34
 </mapper>

Chargement…
Annuler
Enregistrer