|  | @@ -290,35 +290,31 @@ public class RealExamService {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | -     * [学生]开始考试
 | 
	
		
			
				|  |  | +     * [学生]开始考试、训练、练习
 | 
	
		
			
				|  |  |       *
 | 
	
		
			
				|  |  | -     * @param examId
 | 
	
		
			
				|  |  | -     * @param studentBindIp
 | 
	
		
			
				|  |  | +     * @param examId             考试Id
 | 
	
		
			
				|  |  | +     * @param studentBindIp      考试学员IP
 | 
	
		
			
				|  |  | +     * @param examCollectionType 考试集合类型
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    @Transactional
 | 
	
		
			
				|  |  |      public AjaxResult studentStartRealExam(final Long examId, final String studentBindIp, final String examCollectionType) {
 | 
	
		
			
				|  |  | -        l.info("studentStartRealExam = {}", examId);
 | 
	
		
			
				|  |  |          // todo: 暂时没有解决方案 检查 考试的sim和seat,是否正确对应。
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -            // todo:delete
 | 
	
		
			
				|  |  | -            // re.setSimId(getFakeSimId(re));
 | 
	
		
			
				|  |  | -            // l.info("fake re = {}", re);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        // check id data.
 | 
	
		
			
				|  |  | -        // Step :检查参数examId有效性
 | 
	
		
			
				|  |  |          // Step :检查参数studentBindIp有效性
 | 
	
		
			
				|  |  |          // Step :检查参数examCollectionType有效性
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // Check:检查参数examId有效性
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            AjaxResult ar01 = checkExamId(examId);
 | 
	
		
			
				|  |  | -            if (ar01.isError()) {
 | 
	
		
			
				|  |  | -                return ar01;
 | 
	
		
			
				|  |  | +            AjaxResult ar = checkExamId(examId);
 | 
	
		
			
				|  |  | +            if (ar.isError()) {
 | 
	
		
			
				|  |  | +                return ar;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        // todo:examCollectionType 类型对应
 | 
	
		
			
				|  |  | +        // Check:检查studentBindIp有效性
 | 
	
		
			
				|  |  |          if (StringUtils.isBlank(studentBindIp)) {
 | 
	
		
			
				|  |  | -            return AjaxResult.error("ip地址无效。");
 | 
	
		
			
				|  |  | +            return AjaxResult.error("IP地址无效");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        // todo:examCollectionType 类型对应
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          RealExam re = selectRealExamByExamId(examId);
 | 
	
		
			
				|  |  |          Seat seat = seatService.uniqueByBindIp(studentBindIp);
 | 
	
		
			
				|  |  |          {
 | 
	
	
		
			
				|  | @@ -439,69 +435,25 @@ public class RealExamService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      public AjaxResult studentRefreshSimState(final String studentBindIp) {
 | 
	
		
			
				|  |  |          Seat seat = seatService.uniqueByBindIp(studentBindIp);
 | 
	
		
			
				|  |  | +        // Check:Seat有效性。
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  |              if (seat == null) {
 | 
	
		
			
				|  |  | -                throw new IllegalArgumentException("XXX");
 | 
	
		
			
				|  |  | +                return AjaxResult.error("没有IP对应座次数据!");
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        AjaxResult ar = commCheckService.checkOneSeatState(seat, true);
 | 
	
		
			
				|  |  | -        return ar;
 | 
	
		
			
				|  |  | -//                return AjaxResult.success("QWERT-nihao");
 | 
	
		
			
				|  |  | +        return commCheckService.checkOneSeatState(seat, true);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      public AjaxResult checkExamId(final Long examId) {
 | 
	
		
			
				|  |  | -        // check
 | 
	
		
			
				|  |  | -        // 检查 examId 是否正确存在
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -            if (!exist(examId)) {
 | 
	
		
			
				|  |  | -                return AjaxResult.error("对应考试Id不存在!");
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        RealExam re = selectRealExamByExamId(examId);
 | 
	
		
			
				|  |  | -        // 检查 seat_id 是否正确存在
 | 
	
		
			
				|  |  | -        // Java后端处理填写,不检查。
 | 
	
		
			
				|  |  | -        if (false) {
 | 
	
		
			
				|  |  | -            if (!seatService.exist(re.getSeatId())) {
 | 
	
		
			
				|  |  | -                return AjaxResult.error("对应座Id不存在!");
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        // Java后端处理填写,不检查。
 | 
	
		
			
				|  |  | -        // 检查 sim_id 是否正确存在
 | 
	
		
			
				|  |  | -        if (false) {
 | 
	
		
			
				|  |  | -            if (!simService.existBySimId(re.getSimId())) {
 | 
	
		
			
				|  |  | -                return AjaxResult.error("对应模拟器Id不存在!");
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        return AjaxResult.success();
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    /**
 | 
	
		
			
				|  |  | -     * 根据考试集合获得sim_id
 | 
	
		
			
				|  |  | -     *
 | 
	
		
			
				|  |  | -     * @param exam
 | 
	
		
			
				|  |  | -     * @return
 | 
	
		
			
				|  |  | -     */
 | 
	
		
			
				|  |  | -    @Deprecated
 | 
	
		
			
				|  |  | -    public long getFakeSimId(RealExam exam) {
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -            RealExamCollection coll = realExamCollectionService.selectRealExamCollectionByExamCollectionId(exam.getExamCollectionId());
 | 
	
		
			
				|  |  | -            String simType = coll.getSimType();
 | 
	
		
			
				|  |  | -            switch (simType) {
 | 
	
		
			
				|  |  | -                case Sim.TYPE_0001 -> {
 | 
	
		
			
				|  |  | -                    return 11L;
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -                case Sim.TYPE_0002 -> {
 | 
	
		
			
				|  |  | -                    return 12L;
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -                case Sim.TYPE_0003 -> {
 | 
	
		
			
				|  |  | -                    return 31L;
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | +        // Check:检查 examId 是否正确存在
 | 
	
		
			
				|  |  | +        if (!exist(examId)) {
 | 
	
		
			
				|  |  | +            return AjaxResult.error("对应考试Id不存在!");
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            return AjaxResult.success();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        return 0L;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * [轮询][学生]正在考试界面。
 | 
	
		
			
				|  |  |       *
 | 
	
	
		
			
				|  | @@ -530,14 +482,9 @@ public class RealExamService {
 | 
	
		
			
				|  |  |      @Transactional
 | 
	
		
			
				|  |  |      public AjaxResult studentSubmitRealExam(final Long examId, final String studentBindIp, final String examCollectionType) {
 | 
	
		
			
				|  |  |          RealExam re = selectRealExamByExamId(examId);
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -            // todo:delete
 | 
	
		
			
				|  |  | -            // re.setSimId(getFakeSimId(re));
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  |          // Step :检查参数examId有效性
 | 
	
		
			
				|  |  |          // Step :检查参数studentBindIp有效性
 | 
	
		
			
				|  |  |          // Step :检查参数examCollectionType有效性
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          // check part.
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  |              AjaxResult arE1 = checkExamId(examId);
 |