Browse Source

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 years ago
parent
commit
1c37265a25

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

12
 import org.springframework.web.bind.annotation.RestController;
12
 import org.springframework.web.bind.annotation.RestController;
13
 
13
 
14
 import javax.annotation.Resource;
14
 import javax.annotation.Resource;
15
-import java.util.List;
16
 import java.util.Map;
15
 import java.util.Map;
17
 
16
 
18
 /**
17
 /**
51
         return new ResultVo(0, "获取成功", map);
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
      * @description: 试卷扫描答题卡
71
      * @description: 试卷扫描答题卡
56
      * @param: [eScanbatch]
72
      * @param: [eScanbatch]
65
         Map map = eScanbatchService.scanPaperDetail(epid);
81
         Map map = eScanbatchService.scanPaperDetail(epid);
66
         return new ResultVo(0, "获取成功", map);
82
         return new ResultVo(0, "获取成功", map);
67
     }
83
     }
84
+
68
 }
85
 }

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

31
 
31
 
32
     //试卷扫描批次信息
32
     //试卷扫描批次信息
33
     List<Map> listScanBatchPapers(@Param("epid")Integer epid);
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 View File

2
 
2
 
3
 import com.alibaba.fastjson.JSON;
3
 import com.alibaba.fastjson.JSON;
4
 import com.xhkjedu.sexam.mapper.exam.EBaseMapper;
4
 import com.xhkjedu.sexam.mapper.exam.EBaseMapper;
5
+import com.xhkjedu.sexam.mapper.exam.EClassMapper;
5
 import com.xhkjedu.sexam.mapper.paper.EPaperMapper;
6
 import com.xhkjedu.sexam.mapper.paper.EPaperMapper;
6
 import com.xhkjedu.sexam.mapper.paperstudent.EScanbatchMapper;
7
 import com.xhkjedu.sexam.mapper.paperstudent.EScanbatchMapper;
7
 import com.xhkjedu.sexam.model.paperstudent.EScanbatch;
8
 import com.xhkjedu.sexam.model.paperstudent.EScanbatch;
9
+import com.xhkjedu.sexam.utils.ExamUtil;
8
 import com.xhkjedu.utils.N_Utils;
10
 import com.xhkjedu.utils.N_Utils;
9
-import org.springframework.stereotype.Repository;
10
 import org.springframework.stereotype.Service;
11
 import org.springframework.stereotype.Service;
11
 
12
 
12
 import javax.annotation.Resource;
13
 import javax.annotation.Resource;
28
     @Resource
29
     @Resource
29
     private EBaseMapper eBaseMapper;
30
     private EBaseMapper eBaseMapper;
30
 
31
 
32
+    @Resource
33
+    private EClassMapper eClassMapper;
34
+
31
     /**
35
     /**
32
      * @description: 保持扫描试卷批次信息
36
      * @description: 保持扫描试卷批次信息
33
      * @param: [eScanbatch]
37
      * @param: [eScanbatch]
100
         rtnmap.put("scans",batchlist);
104
         rtnmap.put("scans",batchlist);
101
         return rtnmap;
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 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

+ 6
- 0
sexam/src/main/resources/mapper/paperstudent/EScanbatchMapper.xml View File

48
         select * from e_scanbatch where epid=#{epid} order by createtime desc
48
         select * from e_scanbatch where epid=#{epid} order by createtime desc
49
     </select>
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
 </mapper>
57
 </mapper>

Loading…
Cancel
Save