Browse Source

扫码错误类型3和4添加学生姓名

tags/正式版本
王宁 2 years ago
parent
commit
976c4f2fe9

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/EClassStudentMapper.java View File

@@ -16,4 +16,7 @@ public interface EClassStudentMapper extends TkMapper<EClassStudent> {
16 16
 
17 17
     //根据考号搜索参加考试学生
18 18
     List<Map> listStudentByExamidAnExamno(@Param("examid")Integer examid,@Param("examno")String examno);
19
+
20
+    //获取参与考试的学生集合
21
+    List<Map> listStudentsByEpid(@Param("epid")Integer epid);
19 22
 }

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

@@ -79,4 +79,7 @@ public interface EPaperStudentMapper extends TkMapper<EPaperStudent> {
79 79
 
80 80
     //批量更新试卷学生状态
81 81
     void batchUpdateSstate(@Param("sstate") Integer sstate, @Param("epsids") List<Integer> epsids);
82
+
83
+    //批量更新试卷学生试卷状态
84
+    void batchUpdatePStuState(@Param("list") List<EPaperStudent> list);
82 85
 }

+ 10
- 2
sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EPaperStudentService.java View File

@@ -772,8 +772,16 @@ public class EPaperStudentService {
772 772
     //缺考确认
773 773
     @Transactional(rollbackFor = Exception.class)
774 774
     public void qkConfirm(List<PaperStudentWebVo> list) throws Exception {
775
-        List<Integer> epsids = list.stream().map(l -> l.getEpsid()).collect(Collectors.toList());
776
-        ePaperStudentMapper.batchUpdateSstate(2, epsids);//批量更新试卷学生状态
775
+        List<EPaperStudent> pslist = new ArrayList<>();
776
+        for(PaperStudentWebVo objvo : list){
777
+            EPaperStudent ps = new EPaperStudent();
778
+            ps.setEpsid(objvo.getEpsid());
779
+            ps.setSstate(objvo.getSstate());
780
+            pslist.add(ps);
781
+        }
782
+        ePaperStudentMapper.batchUpdatePStuState(pslist);
783
+        /*List<Integer> epsids = list.stream().map(l -> l.getEpsid()).collect(Collectors.toList());
784
+        ePaperStudentMapper.batchUpdateSstate(2, epsids);//批量更新试卷学生状态*/
777 785
         List<Integer> serrorids = list.stream().map(l -> l.getSerrorid()).collect(Collectors.toList());
778 786
         eScanerrorMapper.batchHandleError(serrorids);//更新缺考记录为已处理
779 787
     }

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

@@ -1,14 +1,17 @@
1 1
 package com.xhkjedu.sexam.service.paperstudent;
2 2
 
3 3
 import com.alibaba.fastjson.JSON;
4
+import com.sun.org.apache.xalan.internal.xsltc.runtime.ErrorMessages_ja;
4 5
 import com.xhkjedu.sexam.mapper.exam.EBaseMapper;
5 6
 import com.xhkjedu.sexam.mapper.exam.EClassMapper;
7
+import com.xhkjedu.sexam.mapper.exam.EClassStudentMapper;
6 8
 import com.xhkjedu.sexam.mapper.paper.EPaperMapper;
7 9
 import com.xhkjedu.sexam.mapper.paperstudent.EScanbatchMapper;
8 10
 import com.xhkjedu.sexam.mapper.paperstudent.EScanerrorMapper;
9 11
 import com.xhkjedu.sexam.model.paperstudent.EScanbatch;
10 12
 import com.xhkjedu.sexam.model.paperstudent.EScanerror;
11 13
 import com.xhkjedu.sexam.utils.ExamUtil;
14
+import com.xhkjedu.sexam.vo.paperstudent.PaperStudentWebVo;
12 15
 import com.xhkjedu.utils.N_Utils;
13 16
 import org.springframework.stereotype.Service;
14 17
 
@@ -32,11 +35,12 @@ public class EScanbatchService {
32 35
     private EPaperMapper ePaperMapper;
33 36
     @Resource
34 37
     private EBaseMapper eBaseMapper;
35
-
36 38
     @Resource
37 39
     private EClassMapper eClassMapper;
38 40
     @Resource
39 41
     private EScanerrorMapper eScanerrorMapper;
42
+    @Resource
43
+    private EClassStudentMapper eClassStudentMapper;
40 44
 
41 45
     /**
42 46
      * @description: 保持扫描试卷批次信息
@@ -169,6 +173,26 @@ public class EScanbatchService {
169 173
      **/
170 174
     public Map getScanErrorDetailByErrorType(Integer epid,Integer errortype){
171 175
         List<EScanerror> list = eScanerrorMapper.listErrorsByErrortype(epid,errortype);
176
+        if(errortype == 3 || errortype == 4){
177
+            //获取参加考试的学生名单
178
+            List<Map> stulist = eClassStudentMapper.listStudentsByEpid(epid);
179
+            for(EScanerror e : list){
180
+
181
+                if(N_Utils.isNotEmpty(e.getErrorjson())){
182
+                    String errorsjon = e.getErrorjson();
183
+                    PaperStudentWebVo errvo = JSON.parseObject(errorsjon,PaperStudentWebVo.class);
184
+                    String examno = errvo.getExamno();
185
+                    Map stumap = stulist.stream().filter(s -> examno.equals(s.get("examno").toString())).findFirst().orElse(null);
186
+                    if(stumap!=null){
187
+                        String studentname = stumap.get("studentname").toString();
188
+                        errvo.setStudentname(studentname);
189
+                        e.setErrorjson(JSON.toJSONString(errvo));
190
+                    }
191
+
192
+                }
193
+            }
194
+        }
195
+
172 196
         List<EScanerror> dcllist = list.stream().filter(s -> s.getErrorstate().equals(0)).collect(Collectors.toList());
173 197
         List<EScanerror> ycllist = list.stream().filter(s -> s.getErrorstate().equals(10)).collect(Collectors.toList());
174 198
 

+ 2
- 0
sexam/src/main/java/com/xhkjedu/sexam/vo/paperstudent/PaperStudentWebVo.java View File

@@ -36,4 +36,6 @@ public class PaperStudentWebVo {
36 36
 
37 37
     private Integer pagenum;//当前批次第几页
38 38
     private Integer serrorid;//扫描出错id
39
+
40
+    private String studentname;//学生名称
39 41
 }

+ 7
- 0
sexam/src/main/resources/mapper/exam/EClassStudentMapper.xml View File

@@ -29,6 +29,13 @@
29 29
         LEFT JOIN t_user u on s.studentid=u.userid
30 30
         left join e_base e on c.examid=e.examid
31 31
         where c.examid=#{examid} and u.usertype=2 and u.examno like concat('%', #{examno}, '%') group by s.studentid
32
+    </select>
32 33
 
34
+    <!--获取考试参与的学生集合-->
35
+    <select id="listStudentsByEpid" resultType="java.util.Map">
36
+        select s.studentid,u.username studentname, u.examno from e_class_student s
37
+        left join t_user u on s.studentid=u.userid
38
+        left join e_paper p on s.examid=p.examid
39
+        where p.epid=#{epid} group by s.studentid order by s.studentid
33 40
     </select>
34 41
 </mapper>

+ 16
- 0
sexam/src/main/resources/mapper/paperstudent/EPaperStudentMapper.xml View File

@@ -252,4 +252,20 @@
252 252
             ${epsid}
253 253
         </foreach>
254 254
     </update>
255
+    <!--批量更新试卷学生试卷状态-->
256
+    <update id="batchUpdatePStuState">
257
+        update e_paper_student
258
+        <trim prefix="set" suffixOverrides=",">
259
+            <trim prefix="sstate = case" suffix="end,">
260
+                <foreach collection="list" item="q">
261
+                    when epsid=#{q.epsid} then #{q.sstate}
262
+                </foreach>
263
+            </trim>
264
+        </trim>
265
+        <where>
266
+            <foreach collection="list" item="q" separator="or">
267
+                epsid=#{q.epsid}
268
+            </foreach>
269
+        </where>
270
+    </update>
255 271
 </mapper>

Loading…
Cancel
Save