Przeglądaj źródła

Merge remote-tracking branch 'cloud-schoolapi/ywx'

# Conflicts:
#	sexam/src/main/java/com/xhkjedu/sexam/controller/paperstudent/EScanbatchController.java
#	sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/EScanbatchMapper.java
#	sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EScanbatchService.java
#	sexam/src/main/resources/mapper/paperstudent/EScanbatchMapper.xml
tags/正式版本
王宁 2 lat temu
rodzic
commit
1c37265a25

+ 18
- 1
sexam/src/main/java/com/xhkjedu/sexam/controller/paperstudent/EScanbatchController.java Wyświetl plik

@@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
12 12
 import org.springframework.web.bind.annotation.RestController;
13 13
 
14 14
 import javax.annotation.Resource;
15
-import java.util.List;
16 15
 import java.util.Map;
17 16
 
18 17
 /**
@@ -51,6 +50,23 @@ public class EScanbatchController {
51 50
         return new ResultVo(0, "获取成功", map);
52 51
     }
53 52
 
53
+    /**
54
+     * 扫描答题卡详情
55
+     *
56
+     * @return com.xhkjedu.vo.ResultVo
57
+     * @Param [eps]
58
+     * @Author ywx
59
+     * @Date 2022/8/11 15:47
60
+     **/
61
+    @PostMapping("/detail")
62
+    public ResultVo getScanDetail(@RequestBody EPaperStudent eps) {
63
+        Integer epid = eps.getEpid();
64
+        Integer examid = eps.getExamid();
65
+        N_Utils.validation(new Object[]{epid, "试卷id", 1, examid, "考试id", 1});
66
+        Map map = eScanbatchService.getScanDetail(epid, examid);
67
+        return new ResultVo(0, "获取详情成功", map);
68
+    }
69
+
54 70
     /**
55 71
      * @description: 试卷扫描答题卡
56 72
      * @param: [eScanbatch]
@@ -65,4 +81,5 @@ public class EScanbatchController {
65 81
         Map map = eScanbatchService.scanPaperDetail(epid);
66 82
         return new ResultVo(0, "获取成功", map);
67 83
     }
84
+
68 85
 }

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/EScanbatchMapper.java Wyświetl plik

@@ -31,4 +31,7 @@ public interface EScanbatchMapper extends TkMapper<EScanbatch> {
31 31
 
32 32
     //试卷扫描批次信息
33 33
     List<Map> listScanBatchPapers(@Param("epid")Integer epid);
34
+
35
+    //获取答题卡扫描结果
36
+    EScanbatch getScanResult(@Param("epid") Integer epid);
34 37
 }

+ 27
- 1
sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EScanbatchService.java Wyświetl plik

@@ -2,11 +2,12 @@ package com.xhkjedu.sexam.service.paperstudent;
2 2
 
3 3
 import com.alibaba.fastjson.JSON;
4 4
 import com.xhkjedu.sexam.mapper.exam.EBaseMapper;
5
+import com.xhkjedu.sexam.mapper.exam.EClassMapper;
5 6
 import com.xhkjedu.sexam.mapper.paper.EPaperMapper;
6 7
 import com.xhkjedu.sexam.mapper.paperstudent.EScanbatchMapper;
7 8
 import com.xhkjedu.sexam.model.paperstudent.EScanbatch;
9
+import com.xhkjedu.sexam.utils.ExamUtil;
8 10
 import com.xhkjedu.utils.N_Utils;
9
-import org.springframework.stereotype.Repository;
10 11
 import org.springframework.stereotype.Service;
11 12
 
12 13
 import javax.annotation.Resource;
@@ -28,6 +29,9 @@ public class EScanbatchService {
28 29
     @Resource
29 30
     private EBaseMapper eBaseMapper;
30 31
 
32
+    @Resource
33
+    private EClassMapper eClassMapper;
34
+
31 35
     /**
32 36
      * @description: 保持扫描试卷批次信息
33 37
      * @param: [eScanbatch]
@@ -100,4 +104,26 @@ public class EScanbatchService {
100 104
         rtnmap.put("scans",batchlist);
101 105
         return rtnmap;
102 106
     }
107
+
108
+    //扫描答题卡详情
109
+    public Map getScanDetail(Integer epid, Integer examid) {
110
+        Map map = new HashMap();
111
+        List<Map> classes = eClassMapper.listByExamId(examid);
112
+        int stunum = classes.stream().mapToInt(m -> (int) m.get("classnum")).sum();
113
+        EScanbatch scanbatch = eScanbatchMapper.getScanResult(epid);//获取答题卡扫描结果
114
+        Integer batchnum = scanbatch.getBatchnum();
115
+        Integer scannum = scanbatch.getScannum();
116
+        Integer errornum = scanbatch.getErrornum();
117
+        Integer qknum = scanbatch.getQknum();
118
+        Integer wsnum = ExamUtil.subtractInt(stunum, batchnum);
119
+        map.put("jhnum", stunum);//计划张数
120
+        map.put("wsnum", wsnum);//未扫张数
121
+        map.put("ysnum", batchnum);//已扫张数
122
+        map.put("qknum", qknum);//缺考人数
123
+        map.put("smrate", N_Utils.getIntegerDivideAndMulitiply(wsnum, stunum));//扫描进度
124
+        map.put("sbnum", scannum);//识别张数
125
+        map.put("sbrate", N_Utils.getIntegerDivideAndMulitiply(scannum - errornum, scannum));//识别比例
126
+        map.put("classes", classes);//班级列表
127
+        return map;
128
+    }
103 129
 }

+ 9
- 0
sexam/src/main/java/com/xhkjedu/sexam/utils/ExamUtil.java Wyświetl plik

@@ -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

+ 6
- 0
sexam/src/main/resources/mapper/paperstudent/EScanbatchMapper.xml Wyświetl plik

@@ -48,4 +48,10 @@
48 48
         select * from e_scanbatch where epid=#{epid} order by createtime desc
49 49
     </select>
50 50
 
51
+    <!--获取答题卡扫描结果-->
52
+    <select id="getScanResult" resultType="com.xhkjedu.sexam.model.paperstudent.EScanbatch">
53
+        select sum(batchnum)batchnum,sum(scannum)scannum,su(errornum)errornum,sum(es.qknum)qknum,examid
54
+        from e_scanbatch where epid=#{epid}
55
+    </select>
56
+
51 57
 </mapper>

Ładowanie…
Anuluj
Zapisz