Browse Source

开考提前5分钟获取试卷限制

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

+ 23
- 5
sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EPaperStudentService.java View File

@@ -177,9 +177,7 @@ public class EPaperStudentService {
177 177
      **/
178 178
     public Map startPaperForAndroid(EPaperStudent eps) throws Exception {
179 179
         Integer epsid = eps.getEpsid();
180
-        /*Integer pstate = ePaperStudentMapper.getSubjectStateByEpsid(epsid);
181
-        if(pstate == 2) throw new MissingParametersException("考试已结束禁止操作");
182
-*/
180
+
183 181
         Map ssmap = ePaperStudentMapper.getSubjectStateAndSstageByEpsid(epsid);
184 182
         Integer pstate = Integer.parseInt(ssmap.get("pstate").toString());
185 183
         if(pstate == 2) throw new MissingParametersException("考试已结束禁止操作");
@@ -187,6 +185,17 @@ public class EPaperStudentService {
187 185
         Integer sstate = Integer.parseInt(ssmap.get("sstate").toString());
188 186
         if(sstate >= 2) throw new MissingParametersException("试卷已提交");
189 187
 
188
+        String sdate = ssmap.get("sdate").toString();
189
+        String sbegintime = ssmap.get("begintime").toString();
190
+        int nowstamp = N_Utils.getSecondTimestamp();
191
+        long beginstamp = ExamUtil.getTimestrToTimetamp(sdate + " " + sbegintime + " 00");
192
+        if(nowstamp < beginstamp){
193
+            long diff = (beginstamp - nowstamp)/60;
194
+            if(diff > 5){
195
+                throw new MissingParametersException("距离开考超过5分钟,请耐心等待");
196
+            }
197
+        }
198
+
190 199
         Map rtnmap = new HashMap();
191 200
         //获取试卷基本信息
192 201
         EPaperStudentVo psvo = ePaperStudentMapper.getExamSubjectByEpsid(epsid);
@@ -258,8 +267,6 @@ public class EPaperStudentService {
258 267
      **/
259 268
     public Map startPaperForWeb(EPaperStudent eps) throws Exception {
260 269
         Integer epsid = eps.getEpsid();
261
-//        Integer examstate = ePaperStudentMapper.getExamStateByEpsId(epsid);
262
-//        if (2 <= examstate) throw new MissingParametersException("考试已结束禁止操作");
263 270
         Map ssmap = ePaperStudentMapper.getSubjectStateAndSstageByEpsid(epsid);
264 271
         Integer pstate = Integer.parseInt(ssmap.get("pstate").toString());
265 272
         if(pstate == 2) throw new MissingParametersException("考试已结束禁止操作");
@@ -267,6 +274,17 @@ public class EPaperStudentService {
267 274
         Integer sstate = Integer.parseInt(ssmap.get("sstate").toString());
268 275
         if(sstate >= 2) throw new MissingParametersException("试卷已提交");
269 276
 
277
+        String sdate = ssmap.get("sdate").toString();
278
+        String sbegintime = ssmap.get("begintime").toString();
279
+        int nowstamp = N_Utils.getSecondTimestamp();
280
+        long beginstamp = ExamUtil.getTimestrToTimetamp(sdate + " " + sbegintime + ":00");
281
+        if(nowstamp < beginstamp){
282
+            long diff = beginstamp - nowstamp;
283
+            if(diff > 300){
284
+                throw new MissingParametersException("未到考试时间,请耐心等待");
285
+            }
286
+        }
287
+
270 288
         //获取试卷基本信息
271 289
 //        EPaperStudentVo psvo = ePaperStudentMapper.getExamSubjectByEpsid(epsid);
272 290
         Map map = ePaperStudentMapper.getExamSubjectPaperByEpsid(epsid);

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

@@ -346,7 +346,7 @@
346 346
     </select>
347 347
     <!--根据试卷学生id获取考试科目状态和学生试卷状态-->
348 348
     <select id="getSubjectStateAndSstageByEpsid" resultType="java.util.Map">
349
-        select eps.sstate,s.pstate,s.esid,eps.studentid from e_paper_student eps left join e_subject s on eps.esid=s.esid where eps.epsid=#{epsid}
349
+        select eps.sstate,s.pstate,s.esid,eps.studentid,s.sdate,s.begintime from e_paper_student eps left join e_subject s on eps.esid=s.esid where eps.epsid=#{epsid}
350 350
     </select>
351 351
     <!--缺考详情-->
352 352
     <select id="listQkDetail" resultType="java.util.Map">

Loading…
Cancel
Save