Procházet zdrojové kódy

学生开始考试,提交试卷、试题去除考试状态限制

tags/正式版本
雍文秀 před 2 roky
rodič
revize
177df86a6c

+ 1
- 1
sapi/src/main/resources/mapper/itemtool/StudentTodoMapper.xml Zobrazit soubor

@@ -151,7 +151,7 @@
151 151
                 select 'exam' todotype,count(distinct eps.epsid)num,#{todo.subjectid} subjectid
152 152
                 from e_paper_student eps left join e_subject es on eps.esid=es.esid
153 153
                 left join e_base e on eps.examid=e.examid
154
-                where e.deleted=1 and e.exammode=1 and eps.studentid=#{todo.studentid} and e.examstate=1
154
+                where e.deleted=1 and e.exammode=1 and eps.studentid=#{todo.studentid} and e.examstate>=1
155 155
                 and es.pstate!=2 and eps.sstate=0
156 156
                 <if test="todo.showtime!=null and todo.showtime!=0">
157 157
                     and UNIX_TIMESTAMP(concat(es.sdate,' ',es.begintime))>=#{todo.showtime}

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paperstudent/EPaperStudentMapper.java Zobrazit soubor

@@ -114,4 +114,7 @@ public interface EPaperStudentMapper extends TkMapper<EPaperStudent> {
114 114
 
115 115
     //获取学生考试结束时间戳
116 116
     EPaperStudent getEndTime(@Param("esid") Integer esid,@Param("studentid") Integer studentid);
117
+
118
+    //根据试卷学生id获取考试科目状态
119
+    Integer getSubjectStateByEpsid(@Param("epsid") Integer epsid);
117 120
 }

+ 11
- 22
sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EPaperStudentService.java Zobrazit soubor

@@ -108,10 +108,8 @@ public class EPaperStudentService {
108 108
        /* Integer examstate = ePaperStudentMapper.getExamStateByEpsId(epsid);
109 109
         if (2 <= examstate) throw new MissingParametersException("考试已结束禁止操作");*/
110 110
 
111
-        Map mapstate = ePaperStudentMapper.getExamStateSubjectStateByEpsid(epsid);
112
-        Integer examstate = Integer.parseInt(mapstate.get("examstate").toString());
113
-        Integer pstate = Integer.parseInt(mapstate.get("pstate").toString());
114
-        if(examstate >= 2 || pstate == 2) throw new MissingParametersException("考试已结束禁止操作");
111
+        Integer pstate = ePaperStudentMapper.getSubjectStateByEpsid(epsid);
112
+        if(pstate == 2) throw new MissingParametersException("考试已结束禁止操作");
115 113
 
116 114
         Map map = new HashMap();
117 115
         //获取试卷基本信息
@@ -172,11 +170,10 @@ public class EPaperStudentService {
172 170
     public Integer getExamstateSubjectState(Integer epsid){
173 171
         Integer rtnresult = 1;
174 172
         Map mapstate = ePaperStudentMapper.getExamStateSubjectStateByEpsid(epsid);
175
-        Integer examstate = Integer.parseInt(mapstate.get("examstate").toString());
176 173
         Integer pstate = Integer.parseInt(mapstate.get("pstate").toString());
177 174
         String begintime = mapstate.get("begintime").toString();
178 175
         String sdate = mapstate.get("sdate").toString();
179
-        if(examstate >= 2 || pstate == 2){
176
+        if(pstate == 2){
180 177
             rtnresult = 2;//考试已结束
181 178
         }else{
182 179
             String beginstr = sdate + " " + begintime + ":00";
@@ -210,10 +207,8 @@ public class EPaperStudentService {
210 207
         Integer epsid = eps.getEpsid();
211 208
 //        Integer examstate = ePaperStudentMapper.getExamStateByEpsId(epsid);
212 209
 //        if (2 <= examstate) throw new MissingParametersException("考试已结束禁止操作");
213
-        Map mapstate = ePaperStudentMapper.getExamStateSubjectStateByEpsid(epsid);
214
-        Integer examstate = Integer.parseInt(mapstate.get("examstate").toString());
215
-        Integer pstate = Integer.parseInt(mapstate.get("pstate").toString());
216
-        if(examstate >= 2 || pstate == 2) throw new MissingParametersException("考试已结束禁止操作");
210
+        Integer pstate = ePaperStudentMapper.getSubjectStateByEpsid(epsid);
211
+        if(pstate == 2) throw new MissingParametersException("考试已结束禁止操作");
217 212
 
218 213
         //获取试卷基本信息
219 214
         EPaperStudentVo psvo = ePaperStudentMapper.getExamSubjectByEpsid(epsid);
@@ -365,10 +360,8 @@ public class EPaperStudentService {
365 360
        /* Integer examstate = ePaperStudentMapper.getExamStateByEpsId(epsid);
366 361
         if (2 <= examstate) throw new MissingParametersException("考试已结束禁止操作");*/
367 362
         Integer epsid = paperStudent.getEpsid();
368
-        Map mapstate = ePaperStudentMapper.getExamStateSubjectStateByEpsid(epsid);
369
-        Integer examstate = Integer.parseInt(mapstate.get("examstate").toString());
370
-        Integer pstate = Integer.parseInt(mapstate.get("pstate").toString());
371
-        if(examstate >= 2 || pstate == 2){
363
+        Integer pstate = ePaperStudentMapper.getSubjectStateByEpsid(epsid);
364
+        if(pstate == 2){
372 365
             return new ResultVo(0,"考试已结束");
373 366
         }
374 367
         /*EPaperStudent ps = ePaperStudentMapper.selectByPrimaryKey(epsid);
@@ -441,10 +434,8 @@ public class EPaperStudentService {
441 434
     public ResultVo saveCommitPaperForWeb(PaperStudentWebVo pswvo) {
442 435
         /*Integer examstate = ePaperStudentMapper.getExamStateByEpsId(pswvo.getEpsid());
443 436
         if (2 <= examstate) throw new MissingParametersException("考试已结束禁止操作");*/
444
-        Map mapstate = ePaperStudentMapper.getExamStateSubjectStateByEpsid(pswvo.getEpsid());
445
-        Integer examstate = Integer.parseInt(mapstate.get("examstate").toString());
446
-        Integer pstate = Integer.parseInt(mapstate.get("pstate").toString());
447
-        if(examstate >= 2 || pstate == 2) {
437
+        Integer pstate = ePaperStudentMapper.getSubjectStateByEpsid(pswvo.getEpsid());
438
+        if(pstate == 2) {
448 439
             return new ResultVo(0,"考试已结束");
449 440
         }
450 441
         List<EPaperStudentQuestion> sqlist = pswvo.getQuestions();//学生提交试卷中试题
@@ -746,10 +737,8 @@ public class EPaperStudentService {
746 737
     public void updateSstate(Integer epsid, Integer sstate) {
747 738
         /*Integer examstate = ePaperStudentMapper.getExamStateByEpsId(epsid);
748 739
         if (2 <= examstate) throw new MissingParametersException("考试已结束禁止操作");*/
749
-        Map mapstate = ePaperStudentMapper.getExamStateSubjectStateByEpsid(epsid);
750
-        Integer examstate = Integer.parseInt(mapstate.get("examstate").toString());
751
-        Integer pstate = Integer.parseInt(mapstate.get("pstate").toString());
752
-        if(examstate >= 2 || pstate == 2) throw new MissingParametersException("考试已结束禁止操作");
740
+        Integer pstate = ePaperStudentMapper.getSubjectStateByEpsid(epsid);
741
+        if(pstate == 2) throw new MissingParametersException("考试已结束禁止操作");
753 742
 
754 743
         ePaperStudentMapper.updateSstate(epsid, sstate);
755 744
     }

+ 2
- 2
sexam/src/main/resources/mapper/exam/ESubjectMapper.xml Zobrazit soubor

@@ -109,7 +109,7 @@
109 109
     <update id="startPaper">
110 110
         update e_base eb left join e_subject es on eb.examid = es.examid
111 111
         set es.pstate=1
112
-        where eb.examstate=1 and eb.deleted=1 and eb.exammode=1
112
+        where eb.examstate>=1 and eb.deleted=1 and eb.exammode=1
113 113
         and es.pstate=0 and concat(es.sdate,' ',es.begintime)&lt;=now()
114 114
     </update>
115 115
     <!--试卷结束考试-->
@@ -118,7 +118,7 @@
118 118
         left join e_paper_student eps on es.esid=eps.esid and eps.sstate in(0,1)
119 119
         set es.pstate=2,eps.sstate=(case when eps.sstate=0 then 3 else 2 end)
120 120
         ,eps.endtime=(case when eps.sstate=1 then unix_timestamp() else eps.endtime end)
121
-        where eb.examstate=1 and eb.deleted=1 and eb.exammode=1
121
+        where eb.examstate>=1 and eb.deleted=1 and eb.exammode=1
122 122
         and es.pstate=1 and unix_timestamp(concat(es.sdate,' ',es.endtime))+300 &lt;unix_timestamp()
123 123
     </update>
124 124
 </mapper>

+ 5
- 1
sexam/src/main/resources/mapper/paperstudent/EPaperStudentMapper.xml Zobrazit soubor

@@ -338,6 +338,10 @@
338 338
         left join e_base b on b.examid = eps.examid left join e_subject s on eps.esid=s.esid
339 339
         where eps.epsid=#{epsid}
340 340
     </select>
341
+    <!--根据试卷学生id获取考试科目状态-->
342
+    <select id="getSubjectStateByEpsid" resultType="java.lang.Integer">
343
+        select s.pstate from e_paper_student eps left join e_subject s on eps.esid=s.esid where eps.epsid=#{epsid}
344
+    </select>
341 345
     <!--缺考详情-->
342 346
     <select id="listQkDetail" resultType="java.util.Map">
343 347
         select ec.classid,ec.classname,ec.classnum
@@ -350,7 +354,7 @@
350 354
     <!--当天进行中考试列表-->
351 355
     <select id="listExam" resultType="java.util.Map">
352 356
         SELECT b.examname,s.* FROM e_subject s LEFT JOIN e_base b ON s.examid=b.examid
353
-        WHERE s.sdate=DATE_FORMAT(now(),'%Y-%m-%d') AND b.examstate=1 and s.pstate=1
357
+        WHERE s.sdate=DATE_FORMAT(now(),'%Y-%m-%d') AND b.examstate>=1 and s.pstate=1
354 358
     </select>
355 359
     <!--更新当天进行中考试已提交的学生状态为已进场-->
356 360
     <update id="updateSstateByEsIds">

Načítá se…
Zrušit
Uložit