Browse Source

试卷处理

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

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/EBaseController.java View File

@@ -182,7 +182,7 @@ public class EBaseController {
182 182
         if (exam.getExamstate() != 0) return new ResultVo(0, "发布成功");
183 183
 
184 184
         List<UserVo> students = eBaseService.listStuByExamId(examid);//获取考生
185
-        eBaseService.updateExamStateStart(examid, examcomm, students);//发布考试
185
+        eBaseService.updateExamStateStart(examid, examcomm, students,exam.getExammode());//发布考试
186 186
 
187 187
         if (notice == 2 && msg == 2) return new ResultVo(0, "发布成功");
188 188
 

+ 0
- 1
sexam/src/main/java/com/xhkjedu/sexam/controller/paperstudent/EPaperStudentController.java View File

@@ -128,7 +128,6 @@ public class EPaperStudentController {
128 128
     @PostMapping("/sca")
129 129
     public ResultVo saveCommitPaperScantron(@RequestBody PaperStudentWebVo ps) {
130 130
         try {
131
-            N_Utils.validation(new Object[]{ps.getEpid(), "试卷id", 1,ps.getExamno(),"考号",2});
132 131
             ePaperStudentService.saveCommitPaperForScantron(ps);
133 132
             return new ResultVo(0, "成功保存学生答题卡");
134 133
         } catch (Exception e) {

+ 29
- 1
sexam/src/main/java/com/xhkjedu/sexam/service/exam/EBaseService.java View File

@@ -6,6 +6,7 @@ import com.xhkjedu.sexam.mapper.exam.EClassMapper;
6 6
 import com.xhkjedu.sexam.mapper.exam.EClassStudentMapper;
7 7
 import com.xhkjedu.sexam.mapper.exam.ESubjectMapper;
8 8
 import com.xhkjedu.sexam.mapper.paper.EPaperMapper;
9
+import com.xhkjedu.sexam.mapper.paper.EPaperQtypeMapper;
9 10
 import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentMapper;
10 11
 import com.xhkjedu.sexam.mapper.system.UserMapper;
11 12
 import com.xhkjedu.sexam.model.exam.EBase;
@@ -14,7 +15,9 @@ import com.xhkjedu.sexam.model.exam.EClass;
14 15
 import com.xhkjedu.sexam.model.exam.EClassStudent;
15 16
 import com.xhkjedu.sexam.model.exam.ESubject;
16 17
 import com.xhkjedu.sexam.model.paper.EPaper;
18
+import com.xhkjedu.sexam.model.paper.EPaperQtypeQuestion;
17 19
 import com.xhkjedu.sexam.model.paperstudent.EPaperStudent;
20
+import com.xhkjedu.sexam.model.paperstudent.EPaperStudentQuestion;
18 21
 import com.xhkjedu.sexam.vo.exam.EBaseVo;
19 22
 import com.xhkjedu.sexam.vo.system.UserVo;
20 23
 import com.xhkjedu.utils.N_Utils;
@@ -49,6 +52,8 @@ public class EBaseService {
49 52
     private EPaperStudentMapper ePaperStudentMapper;
50 53
     @Resource
51 54
     private EBaseMacMapper eBaseMacMapper;
55
+    @Resource
56
+    private EPaperQtypeMapper ePaperQtypeMapper;
52 57
 
53 58
     /**
54 59
      * 发起考试
@@ -173,7 +178,7 @@ public class EBaseService {
173 178
 
174 179
     //发布考试
175 180
     @Transactional(rollbackFor = Exception.class)
176
-    public void updateExamStateStart(Integer examid, String examcomm, List<UserVo> students) {
181
+    public void updateExamStateStart(Integer examid, String examcomm, List<UserVo> students,Integer exammode) {
177 182
         //更改考试状态
178 183
         eBaseMapper.postExam(examid, examcomm);
179 184
         //发布考试,获取考试试卷题量和分值
@@ -206,6 +211,29 @@ public class EBaseService {
206 211
             }
207 212
         }
208 213
         ePaperStudentMapper.insertList(studentList);//保存考试学生信息
214
+
215
+        if(exammode == 2){
216
+            //代表线下考试,生成学生和试题的关联关系
217
+            List<EPaperStudentQuestion> stuqlist = new ArrayList<>();
218
+            for (EPaper paper : papers) {
219
+                Integer epid = paper.getEpid();
220
+                //获取试卷中所有试题
221
+                List<EPaperQtypeQuestion> queslist = ePaperQtypeMapper.listQuestionsByEpid(epid);
222
+                for (EPaperStudent ps : studentList) {
223
+                    for(EPaperQtypeQuestion q : queslist){
224
+                        EPaperStudentQuestion epsq = new EPaperStudentQuestion();
225
+                        epsq.setClassid(ps.getClassid());
226
+                        epsq.setStudentid(ps.getStudentid());
227
+                        epsq.setEpid(ps.getEpid());
228
+                        epsq.setEpsid(ps.getId());
229
+                        epsq.setEptqid(q.getEptqid());
230
+
231
+                    }
232
+                }
233
+            }
234
+
235
+
236
+        }
209 237
     }
210 238
 
211 239
     //结束考试

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

@@ -423,21 +423,28 @@ public class EPaperStudentService {
423 423
      **/
424 424
     @Transactional(rollbackFor = Exception.class)
425 425
     public void saveCommitPaperForScantron(PaperStudentWebVo pswvo) throws Exception{
426
+        if(N_Utils.isEmptyInteger(pswvo.getEpid()) || N_Utils.isEmpty(pswvo.getExamno())){
427
+            updateScanErrorInfo(4,pswvo);
428
+            return;
429
+        }
430
+
426 431
         //更加学生姓名和准考证号找到对应学生
427 432
         Integer userid = userMapper.getUseridByExamno(pswvo.getExamno());
428 433
         if(!N_Utils.isTrueInteger(userid)){
429 434
             updateScanErrorInfo(2,pswvo);
435
+            return;
430 436
 //            throw new Exception("考号有误");
431 437
         }
432 438
         //获取学生试卷
433 439
         EPaperStudent ps = ePaperStudentMapper.getPaperStudentByStuidAndEpid(pswvo.getEpid(),userid);
434
-        pswvo.setEpsid(ps.getEpsid());
435 440
 
436 441
         //试卷不存在
437 442
         if(ps == null) {
438 443
             updateScanErrorInfo(3,pswvo);
444
+            return;
439 445
 //            throw new Exception("学生试卷不存在");
440 446
         }
447
+        pswvo.setEpsid(ps.getEpsid());
441 448
 
442 449
         if(pswvo.getSstate() == 3){
443 450
             //说明学生缺考更新状态
@@ -553,6 +560,7 @@ public class EPaperStudentService {
553 560
         List<Map> qtypeques = null;
554 561
         if(ptype == 1){
555 562
             qtypeques = ePaperStudentQuestionMapper.listQStuQuestionScore(epsid);
563
+            setQuestionsForPaper(qtypeques);
556 564
         }else{
557 565
             qtypeques = ePaperStudentQuestionMapper.listFjStuQuestionScore(epsid);
558 566
         }
@@ -573,14 +581,26 @@ public class EPaperStudentService {
573 581
                     Map sque = sonqlst.get(0);
574 582
                     Map mque = new HashMap();
575 583
                     mque.put("questionid",sque.get("mquestionid").toString());
584
+                    mque.put("qlevel",2);
576 585
                     mque.put("qstem",sque.get("mqstem").toString());
577 586
                     mque.put("ctype",Integer.parseInt(sque.get("mctype").toString()));
578 587
                     mque.put("qtypeid",sque.get("mqtypeid").toString());
579 588
                     mque.put("qtypename",sque.get("mqtypename").toString());
589
+                    mque.put("qorder",sque.get("qorder").toString());
580 590
                     mque.put("qn",sque.get("qn").toString());
581
-
591
+                    mque.put("snum",Integer.parseInt(sque.get("snum").toString()));
592
+                    if(ctype == 12 && sque.get("mhearfile")!=null){
593
+                        mque.put("hearfile",sque.get("mhearfile").toString());
594
+                    }else{
595
+                        mque.put("hearfile","");
596
+                    }
597
+                    mque.put("score",sontotalsocre);
598
+                    mque.put("sonques",sonqlst);
599
+                    mqlist.add(mque);
582 600
                 }
583 601
 
602
+                mt.put("questions",mqlist);
603
+
584 604
             }
585 605
         }
586 606
     }

+ 2
- 0
sexam/src/main/java/com/xhkjedu/sexam/vo/exam/EBaseVo.java View File

@@ -39,4 +39,6 @@ public class EBaseVo {
39 39
 
40 40
     //考试开始时间
41 41
     private Integer begintime;
42
+
43
+    private Integer exammode;
42 44
 }

+ 1
- 1
sexam/src/main/resources/mapper/exam/EBaseMapper.xml View File

@@ -61,7 +61,7 @@
61 61
     </select>
62 62
     <!--根据考试id获取考试状态-->
63 63
     <select id="getExamStateById" resultType="com.xhkjedu.sexam.vo.exam.EBaseVo">
64
-        select eb.examid,eb.examname,eb.gradeid,eb.examstate,eb.schoolid
64
+        select eb.examid,eb.examname,eb.gradeid,eb.examstate,eb.schoolid,eb.exammode
65 65
         ,count(case when es.esstate!=1 then es.esid else null end)wwcnum,min(ep.answered)answered
66 66
         ,min(ifnull(UNIX_TIMESTAMP(concat(es.sdate,' ',es.begintime)),0))begintime
67 67
         from e_base eb left join e_subject es on eb.examid = es.examid

+ 1
- 2
sexam/src/main/resources/mapper/paperstudent/EPaperStudentQuestionMapper.xml View File

@@ -172,7 +172,6 @@
172 172
             <result column="qtypename" property="qtypename"></result>
173 173
             <result column="qctype" property="ctype"></result>
174 174
             <result column="qstem" property="qstem"></result>
175
-            <result column="hearfile" property="hearfile"></result>
176 175
             <result column="qoption" property="qoption"></result>
177 176
             <result column="qlevel" property="qlevel"></result>
178 177
             <result column="sorder" property="sorder"></result>
@@ -189,7 +188,7 @@
189 188
     <select id="listQStuQuestionScore" resultMap="qtypesQuestion">
190 189
         select pt.ctype,pt.eptname,pt.eptnum,pt.eptorder,pt.eptscore,
191 190
                psq.epsqid,psq.questionid,psq.qorder,psq.qn,ptq.score,ptq.answer,psq.answered,psq.answertype,psq.stuanswer,
192
-               psq.stuanswertxt,psq.eptqid,psq.stuscore,q.qstem,q.qoption,q.ctype qctype,q.hearfile,q.qtypeid,
191
+               psq.stuanswertxt,psq.eptqid,psq.stuscore,q.qstem,q.qoption,q.ctype qctype,q.qtypeid,
193 192
                q.qtypename,q.qlevel,q.snum,q.sorder,q.questionpid,mq.questionid mquestionid,mq.qstem mqstem,
194 193
                mq.qoption mqoption,mq.ctype mctype,mq.qtypeid mqtypeid,mq.qtypename mqtypename,mq.hearfile mhearfile
195 194
         from e_paper_student_question psq left join e_paper_qtype_question ptq on psq.eptqid=ptq.eptqid

Loading…
Cancel
Save