|
@@ -278,34 +278,22 @@ public class RealExamService {
|
|
* @return RealExam
|
|
* @return RealExam
|
|
*/
|
|
*/
|
|
@Transactional
|
|
@Transactional
|
|
- public AjaxResult studentStartRealExam(Long examId) {
|
|
|
|
|
|
+ public AjaxResult studentStartRealExam(final Long examId) {
|
|
l.info("studentStartRealExam = {}", examId);
|
|
l.info("studentStartRealExam = {}", examId);
|
|
// todo: 暂时没有解决方案 检查 考试的sim和seat,是否正确对应。
|
|
// todo: 暂时没有解决方案 检查 考试的sim和seat,是否正确对应。
|
|
- // check
|
|
|
|
- // 检查 examId 是否正确存在
|
|
|
|
- {
|
|
|
|
- if (!exist(examId)) {
|
|
|
|
- return AjaxResult.error("对应考试Id不存在!");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- RealExam re = selectRealExamByExamId(examId);
|
|
|
|
- // 检查 seat_id 是否正确存在
|
|
|
|
- {
|
|
|
|
- if (!seatService.exist(re.getSeatId())) {
|
|
|
|
- return AjaxResult.error("对应座Id不存在!");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // 检查 sim_id 是否正确存在
|
|
|
|
- {
|
|
|
|
- if (!simService.exist(re.getSimId())) {
|
|
|
|
- return AjaxResult.error("对应模拟器Id不存在!");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
{
|
|
{
|
|
// todo:delete
|
|
// todo:delete
|
|
// re.setSimId(getFakeSimId(re));
|
|
// re.setSimId(getFakeSimId(re));
|
|
// l.info("fake re = {}", re);
|
|
// l.info("fake re = {}", re);
|
|
}
|
|
}
|
|
|
|
+ // check part.
|
|
|
|
+ {
|
|
|
|
+ AjaxResult arE1 = checkExamId(examId);
|
|
|
|
+ if (arE1.isError()) {
|
|
|
|
+ return arE1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ RealExam re = selectRealExamByExamId(examId);
|
|
// Step 1 读取对应一台模拟器 所有故障部位值。检查模拟器所有的 真实的 故障部位 是否异常 或者 空值。
|
|
// Step 1 读取对应一台模拟器 所有故障部位值。检查模拟器所有的 真实的 故障部位 是否异常 或者 空值。
|
|
|
|
|
|
// Step 2 清除对应一台模拟器 所有故障部位故障。
|
|
// Step 2 清除对应一台模拟器 所有故障部位故障。
|
|
@@ -329,6 +317,30 @@ public class RealExamService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public AjaxResult checkExamId(final Long examId) {
|
|
|
|
+ // check
|
|
|
|
+ // 检查 examId 是否正确存在
|
|
|
|
+ {
|
|
|
|
+ if (!exist(examId)) {
|
|
|
|
+ return AjaxResult.error("对应考试Id不存在!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ RealExam re = selectRealExamByExamId(examId);
|
|
|
|
+ // 检查 seat_id 是否正确存在
|
|
|
|
+ {
|
|
|
|
+ if (!seatService.exist(re.getSeatId())) {
|
|
|
|
+ return AjaxResult.error("对应座Id不存在!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 检查 sim_id 是否正确存在
|
|
|
|
+ {
|
|
|
|
+ if (!simService.exist(re.getSimId())) {
|
|
|
|
+ return AjaxResult.error("对应模拟器Id不存在!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 根据考试集合获得sim_id
|
|
* 根据考试集合获得sim_id
|
|
*
|
|
*
|
|
@@ -387,10 +399,18 @@ public class RealExamService {
|
|
// todo:delete
|
|
// todo:delete
|
|
// re.setSimId(getFakeSimId(re));
|
|
// re.setSimId(getFakeSimId(re));
|
|
}
|
|
}
|
|
|
|
+ // check part.
|
|
|
|
+ {
|
|
|
|
+ AjaxResult arE1 = checkExamId(examId);
|
|
|
|
+ if (arE1.isError()) {
|
|
|
|
+ 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);
|