|  | @@ -298,7 +298,7 @@ public class RealExamService {
 | 
											
												
													
														|  |              // re.setSimId(getFakeSimId(re));
 |  |              // re.setSimId(getFakeSimId(re));
 | 
											
												
													
														|  |              // l.info("fake re = {}", re);
 |  |              // l.info("fake re = {}", re);
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        // check part.
 |  | 
 | 
											
												
													
														|  | 
 |  | +        // check id data.
 | 
											
												
													
														|  |          {
 |  |          {
 | 
											
												
													
														|  |              AjaxResult arE1 = checkExamId(examId);
 |  |              AjaxResult arE1 = checkExamId(examId);
 | 
											
												
													
														|  |              if (arE1.isError()) {
 |  |              if (arE1.isError()) {
 | 
											
										
											
												
													
														|  | @@ -306,28 +306,36 @@ public class RealExamService {
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          RealExam re = selectRealExamByExamId(examId);
 |  |          RealExam re = selectRealExamByExamId(examId);
 | 
											
												
													
														|  | -        // Step 1 读取对应一台模拟器 所有故障部位值。检查模拟器所有的 真实的 故障部位 是否异常 或者 空值。
 |  | 
 | 
											
												
													
														|  | 
 |  | +        Sim s = simService.selectSimBySimId(re.getSimId());
 | 
											
												
													
														|  | 
 |  | +        // Step 1 主动查询一次模拟器状态
 | 
											
												
													
														|  | 
 |  | +        {
 | 
											
												
													
														|  | 
 |  | +            commSendService.checkOneSimState(s, true);
 | 
											
												
													
														|  | 
 |  | +            // 如果模拟器离线
 | 
											
												
													
														|  | 
 |  | +            if (s == null || !Sim.State.ONLINE.equals(s.getSimState())) {
 | 
											
												
													
														|  | 
 |  | +                return AjaxResult.error("未连接模拟器,请检查连接!");
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        // Step 2 读取对应一台模拟器 所有故障部位值。检查模拟器所有的 真实的 故障部位 是否异常 或者 空值。
 | 
											
												
													
														|  |          if (SimDebugConfig.CHECK_REPLACE_EMPTY) {
 |  |          if (SimDebugConfig.CHECK_REPLACE_EMPTY) {
 | 
											
												
													
														|  | -            Sim sim = simService.selectSimBySimId(re.getSimId());
 |  | 
 | 
											
												
													
														|  | -            AjaxResult arE2 = commSendService.readOneSimAllFaultCheck(sim);
 |  | 
 | 
											
												
													
														|  | 
 |  | +            AjaxResult arE2 = commSendService.readOneSimAllFaultCheck(s);
 | 
											
												
													
														|  |              if (arE2.isError()) {
 |  |              if (arE2.isError()) {
 | 
											
												
													
														|  |                  return arE2;
 |  |                  return arE2;
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        // Step 2 清除对应一台模拟器 所有故障部位故障。
 |  | 
 | 
											
												
													
														|  | 
 |  | +        // Step 3 清除对应一台模拟器 所有故障部位故障。
 | 
											
												
													
														|  |          {
 |  |          {
 | 
											
												
													
														|  |              commSendService.clearOneSimAllFaultByExam(re);
 |  |              commSendService.clearOneSimAllFaultByExam(re);
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        // Step 3 下发对应一台模拟器 出题选中的 故障位置故障。
 |  | 
 | 
											
												
													
														|  | 
 |  | +        // Step 4 下发对应一台模拟器 出题选中的 故障位置故障。
 | 
											
												
													
														|  |          {
 |  |          {
 | 
											
												
													
														|  |              commSendService.writeOneSimAllSelectFaultByExam(re);
 |  |              commSendService.writeOneSimAllSelectFaultByExam(re);
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        // Step 4 读取对应一台模拟器 所有的 真实的 故障部位 电阻值 作为出题值。
 |  | 
 | 
											
												
													
														|  | 
 |  | +        // Step 5 读取对应一台模拟器 所有的 真实的 故障部位 电阻值 作为出题值。
 | 
											
												
													
														|  |          // 修改关联状态
 |  |          // 修改关联状态
 | 
											
												
													
														|  |          {
 |  |          {
 | 
											
												
													
														|  |              commSendService.readOneSimAllFaultFirstTimeByExam(re);
 |  |              commSendService.readOneSimAllFaultFirstTimeByExam(re);
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        // Step 5 修改Exam状态
 |  | 
 | 
											
												
													
														|  | 
 |  | +        // Step 6 修改Exam状态
 | 
											
												
													
														|  |          if (realExamFaultService.isType2ExamPrepareStartOk(re.getExamId())) {
 |  |          if (realExamFaultService.isType2ExamPrepareStartOk(re.getExamId())) {
 | 
											
												
													
														|  |              updateOneState(re.getExamId(), RealExam.State.SIM_PREPARE_OK);
 |  |              updateOneState(re.getExamId(), RealExam.State.SIM_PREPARE_OK);
 | 
											
												
													
														|  |              updateOneState(re.getExamId(), RealExam.State.ANSWERING);
 |  |              updateOneState(re.getExamId(), RealExam.State.ANSWERING);
 | 
											
										
											
												
													
														|  | @@ -429,11 +437,11 @@ public class RealExamService {
 | 
											
												
													
														|  |                  return arE1;
 |  |                  return arE1;
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        // 最后检查一下模拟器状态。
 |  | 
 | 
											
												
													
														|  | 
 |  | +        // 检查一下模拟器状态。
 | 
											
												
													
														|  |          Sim s = simService.selectSimBySimId(re.getSimId());
 |  |          Sim s = simService.selectSimBySimId(re.getSimId());
 | 
											
												
													
														|  |          // 如果模拟器离线
 |  |          // 如果模拟器离线
 | 
											
												
													
														|  |          if (s == null || !Sim.State.ONLINE.equals(s.getSimState())) {
 |  |          if (s == null || !Sim.State.ONLINE.equals(s.getSimState())) {
 | 
											
												
													
														|  | -            return AjaxResult.error("未连接维修模拟器,请检查连接!");
 |  | 
 | 
											
												
													
														|  | 
 |  | +            return AjaxResult.error("未连接模拟器,请检查连接!");
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          // 最后读取一下模拟器电阻值。
 |  |          // 最后读取一下模拟器电阻值。
 | 
											
												
													
														|  |          commSendService.readOneExamAtLast(re);
 |  |          commSendService.readOneExamAtLast(re);
 |