|  | @@ -11,8 +11,9 @@ import com.ruoyi.sim.domain.vo.RealExamVo;
 | 
											
												
													
														|  |  import com.ruoyi.sim.domain.vo.StudentRealExamIngVo;
 |  |  import com.ruoyi.sim.domain.vo.StudentRealExamIngVo;
 | 
											
												
													
														|  |  import com.ruoyi.sim.domain.vo.StudentRealExamPostVo;
 |  |  import com.ruoyi.sim.domain.vo.StudentRealExamPostVo;
 | 
											
												
													
														|  |  import com.ruoyi.sim.domain.vo.StudentRealExamPreVo;
 |  |  import com.ruoyi.sim.domain.vo.StudentRealExamPreVo;
 | 
											
												
													
														|  | 
 |  | +import org.slf4j.Logger;
 | 
											
												
													
														|  | 
 |  | +import org.slf4j.LoggerFactory;
 | 
											
												
													
														|  |  import org.springframework.beans.factory.annotation.Autowired;
 |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
											
												
													
														|  | -import org.springframework.scheduling.annotation.Async;
 |  | 
 | 
											
												
													
														|  |  import org.springframework.stereotype.Service;
 |  |  import org.springframework.stereotype.Service;
 | 
											
												
													
														|  |  import com.ruoyi.sim.mapper.RealExamMapper;
 |  |  import com.ruoyi.sim.mapper.RealExamMapper;
 | 
											
												
													
														|  |  import org.springframework.transaction.annotation.Transactional;
 |  |  import org.springframework.transaction.annotation.Transactional;
 | 
											
										
											
												
													
														|  | @@ -27,8 +28,6 @@ import org.springframework.transaction.annotation.Transactional;
 | 
											
												
													
														|  |  public class RealExamService {
 |  |  public class RealExamService {
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
												
													
														|  |      private RealExamMapper realExamMapper;
 |  |      private RealExamMapper realExamMapper;
 | 
											
												
													
														|  | -    @Autowired
 |  | 
 | 
											
												
													
														|  | -    private CommReceiveService commReceiveService;
 |  | 
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  |       * 查询考试
 |  |       * 查询考试
 | 
											
										
											
												
													
														|  | @@ -93,6 +92,10 @@ public class RealExamService {
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      // -------------------------------- tom add  --------------------------------
 |  |      // -------------------------------- tom add  --------------------------------
 | 
											
												
													
														|  | 
 |  | +    private static final Logger l = LoggerFactory.getLogger(CommSendService.class);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @Autowired
 | 
											
												
													
														|  | 
 |  | +    private CommReceiveService commReceiveService;
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
												
													
														|  |      private StudentService studentService;
 |  |      private StudentService studentService;
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
										
											
												
													
														|  | @@ -128,16 +131,16 @@ public class RealExamService {
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  |       * 交卷自动修改关联状态
 |  |       * 交卷自动修改关联状态
 | 
											
												
													
														|  |       *
 |  |       *
 | 
											
												
													
														|  | -     * @param id
 |  | 
 | 
											
												
													
														|  | 
 |  | +     * @param examId
 | 
											
												
													
														|  |       * @param state
 |  |       * @param state
 | 
											
												
													
														|  |       * @return
 |  |       * @return
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  |      @Transactional
 |  |      @Transactional
 | 
											
												
													
														|  | -    public int updateOneState(long id, final String state) {
 |  | 
 | 
											
												
													
														|  | -        RealExam q = selectRealExamByExamId(id);
 |  | 
 | 
											
												
													
														|  | 
 |  | +    public int updateOneState(long examId, final String state) {
 | 
											
												
													
														|  | 
 |  | +        RealExam q = selectRealExamByExamId(examId);
 | 
											
												
													
														|  |          if (RealExam.State.SUBMITTED.equals(state)) {
 |  |          if (RealExam.State.SUBMITTED.equals(state)) {
 | 
											
												
													
														|  |              // 关联故障list同步锁死。
 |  |              // 关联故障list同步锁死。
 | 
											
												
													
														|  | -            realExamFaultService.listAllType2YesLoopReadState(q.getExamId())
 |  | 
 | 
											
												
													
														|  | 
 |  | +            realExamFaultService.listAllType2LoopReadStateByExamId(q.getExamId())
 | 
											
												
													
														|  |                      .forEach(ref -> {
 |  |                      .forEach(ref -> {
 | 
											
												
													
														|  |                          ref.setRefState(RealExamFault.State.FINISH);
 |  |                          ref.setRefState(RealExamFault.State.FINISH);
 | 
											
												
													
														|  |                          realExamFaultService.updateRealExamFault(ref);
 |  |                          realExamFaultService.updateRealExamFault(ref);
 | 
											
										
											
												
													
														|  | @@ -174,13 +177,16 @@ public class RealExamService {
 | 
											
												
													
														|  |       *
 |  |       *
 | 
											
												
													
														|  |       * @return
 |  |       * @return
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  | -    public AjaxResult studentEnterRealExam(Long realExamId) {
 |  | 
 | 
											
												
													
														|  | -        RealExam re = selectRealExamByExamId(realExamId);
 |  | 
 | 
											
												
													
														|  | 
 |  | +    public AjaxResult studentEnterRealExam(Long examId) {
 | 
											
												
													
														|  | 
 |  | +        RealExam re = selectRealExamByExamId(examId);
 | 
											
												
													
														|  |          if (re == null) {
 |  |          if (re == null) {
 | 
											
												
													
														|  |              AjaxResult.error("realExamId error!");
 |  |              AjaxResult.error("realExamId error!");
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          // todo:应该在登录位置实现
 |  |          // todo:应该在登录位置实现
 | 
											
												
													
														|  | -        updateOneState(realExamId, RealExam.State.LOGGED_IN);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        // todo: temp
 | 
											
												
													
														|  | 
 |  | +        updateOneState(examId, RealExam.State.LOGGED_IN);
 | 
											
												
													
														|  | 
 |  | +        // todo: temp
 | 
											
												
													
														|  | 
 |  | +        realExamFaultService.resetAllType2(examId);
 | 
											
												
													
														|  |          return AjaxResult.success(re);
 |  |          return AjaxResult.success(re);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -191,6 +197,7 @@ public class RealExamService {
 | 
											
												
													
														|  |       * @return
 |  |       * @return
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  |      public AjaxResult studentLoopPrepareRealExam(Long realExamId) {
 |  |      public AjaxResult studentLoopPrepareRealExam(Long realExamId) {
 | 
											
												
													
														|  | 
 |  | +        l.info("studentLoopPrepareRealExam");
 | 
											
												
													
														|  |          // check
 |  |          // check
 | 
											
												
													
														|  |          if (realExamId == null || realExamId == 0) {
 |  |          if (realExamId == null || realExamId == 0) {
 | 
											
												
													
														|  |              // todo:
 |  |              // todo:
 | 
											
										
											
												
													
														|  | @@ -227,6 +234,7 @@ public class RealExamService {
 | 
											
												
													
														|  |              // 异步执行
 |  |              // 异步执行
 | 
											
												
													
														|  |              commSendService.clearListFaultByRealExamAsync(re);
 |  |              commSendService.clearListFaultByRealExamAsync(re);
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | 
 |  | +        l.info("vo = {}", vo);
 | 
											
												
													
														|  |          return AjaxResult.success(vo);
 |  |          return AjaxResult.success(vo);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -283,6 +291,7 @@ public class RealExamService {
 | 
											
												
													
														|  |          long remaining = (re.getStartTime().getTime() + rec.getLimitDuration() * 60 * 1000) - DateUtils.getNowDate().getTime();
 |  |          long remaining = (re.getStartTime().getTime() + rec.getLimitDuration() * 60 * 1000) - DateUtils.getNowDate().getTime();
 | 
											
												
													
														|  |          vo.setRemainingMilliseconds(remaining);
 |  |          vo.setRemainingMilliseconds(remaining);
 | 
											
												
													
														|  |          vo.setCompulsiveSubmit(remaining >= RealExam.EXAM_TIMEOUT_LIMIT);
 |  |          vo.setCompulsiveSubmit(remaining >= RealExam.EXAM_TIMEOUT_LIMIT);
 | 
											
												
													
														|  | 
 |  | +        l.info("studentLoopAnsweringRealExam vo = {}", vo);
 | 
											
												
													
														|  |          return AjaxResult.success(vo);
 |  |          return AjaxResult.success(vo);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 |