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
      **/
177
      **/
178
     public Map startPaperForAndroid(EPaperStudent eps) throws Exception {
178
     public Map startPaperForAndroid(EPaperStudent eps) throws Exception {
179
         Integer epsid = eps.getEpsid();
179
         Integer epsid = eps.getEpsid();
180
-        /*Integer pstate = ePaperStudentMapper.getSubjectStateByEpsid(epsid);
181
-        if(pstate == 2) throw new MissingParametersException("考试已结束禁止操作");
182
-*/
180
+
183
         Map ssmap = ePaperStudentMapper.getSubjectStateAndSstageByEpsid(epsid);
181
         Map ssmap = ePaperStudentMapper.getSubjectStateAndSstageByEpsid(epsid);
184
         Integer pstate = Integer.parseInt(ssmap.get("pstate").toString());
182
         Integer pstate = Integer.parseInt(ssmap.get("pstate").toString());
185
         if(pstate == 2) throw new MissingParametersException("考试已结束禁止操作");
183
         if(pstate == 2) throw new MissingParametersException("考试已结束禁止操作");
187
         Integer sstate = Integer.parseInt(ssmap.get("sstate").toString());
185
         Integer sstate = Integer.parseInt(ssmap.get("sstate").toString());
188
         if(sstate >= 2) throw new MissingParametersException("试卷已提交");
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
         Map rtnmap = new HashMap();
199
         Map rtnmap = new HashMap();
191
         //获取试卷基本信息
200
         //获取试卷基本信息
192
         EPaperStudentVo psvo = ePaperStudentMapper.getExamSubjectByEpsid(epsid);
201
         EPaperStudentVo psvo = ePaperStudentMapper.getExamSubjectByEpsid(epsid);
258
      **/
267
      **/
259
     public Map startPaperForWeb(EPaperStudent eps) throws Exception {
268
     public Map startPaperForWeb(EPaperStudent eps) throws Exception {
260
         Integer epsid = eps.getEpsid();
269
         Integer epsid = eps.getEpsid();
261
-//        Integer examstate = ePaperStudentMapper.getExamStateByEpsId(epsid);
262
-//        if (2 <= examstate) throw new MissingParametersException("考试已结束禁止操作");
263
         Map ssmap = ePaperStudentMapper.getSubjectStateAndSstageByEpsid(epsid);
270
         Map ssmap = ePaperStudentMapper.getSubjectStateAndSstageByEpsid(epsid);
264
         Integer pstate = Integer.parseInt(ssmap.get("pstate").toString());
271
         Integer pstate = Integer.parseInt(ssmap.get("pstate").toString());
265
         if(pstate == 2) throw new MissingParametersException("考试已结束禁止操作");
272
         if(pstate == 2) throw new MissingParametersException("考试已结束禁止操作");
267
         Integer sstate = Integer.parseInt(ssmap.get("sstate").toString());
274
         Integer sstate = Integer.parseInt(ssmap.get("sstate").toString());
268
         if(sstate >= 2) throw new MissingParametersException("试卷已提交");
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
 //        EPaperStudentVo psvo = ePaperStudentMapper.getExamSubjectByEpsid(epsid);
289
 //        EPaperStudentVo psvo = ePaperStudentMapper.getExamSubjectByEpsid(epsid);
272
         Map map = ePaperStudentMapper.getExamSubjectPaperByEpsid(epsid);
290
         Map map = ePaperStudentMapper.getExamSubjectPaperByEpsid(epsid);

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

346
     </select>
346
     </select>
347
     <!--根据试卷学生id获取考试科目状态和学生试卷状态-->
347
     <!--根据试卷学生id获取考试科目状态和学生试卷状态-->
348
     <select id="getSubjectStateAndSstageByEpsid" resultType="java.util.Map">
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
     </select>
350
     </select>
351
     <!--缺考详情-->
351
     <!--缺考详情-->
352
     <select id="listQkDetail" resultType="java.util.Map">
352
     <select id="listQkDetail" resultType="java.util.Map">

Loading…
Cancel
Save