|
@@ -298,7 +298,7 @@ public class RealExamService {
|
|
|
if (StringUtils.equals(RealExamCollection.Type.EXERCISE, examCollectionType)) {
|
|
|
// 已经open的考试。
|
|
|
if (realExamCollectionService.existOpenedByType(RealExamCollection.Type.EXAM)) {
|
|
|
- return ArBuilder.error(T_60001, M_60001);
|
|
|
+ return ArBuilder.error(T60001, M60001);
|
|
|
}
|
|
|
} else {
|
|
|
l.info("type EXERCISE,没有打开的考试,校验正确");
|
|
@@ -307,13 +307,13 @@ public class RealExamService {
|
|
|
if (StringUtils.equals(RealExamCollection.Type.SELF_EXERCISE, examCollectionType)) {
|
|
|
// 已经open的考试。
|
|
|
if (realExamCollectionService.existOpenedByType(RealExamCollection.Type.EXAM)) {
|
|
|
- return ArBuilder.error(T_60002, M_60002);
|
|
|
+ return ArBuilder.error(T60002, M60002);
|
|
|
} else {
|
|
|
l.info("type SELF_EXERCISE,没有打开的考试,校验正确");
|
|
|
}
|
|
|
// 已经open的训练。
|
|
|
if (realExamCollectionService.existOpenedByType(RealExamCollection.Type.EXERCISE)) {
|
|
|
- return ArBuilder.error(T_60003, M_60003);
|
|
|
+ return ArBuilder.error(T60003, M60003);
|
|
|
} else {
|
|
|
l.info("type SELF_EXERCISE,没有打开的训练,校验正确");
|
|
|
}
|
|
@@ -336,14 +336,14 @@ public class RealExamService {
|
|
|
if (StringUtils.equals(re.getExamStatus(), RealExam.State.SUBMITTED) ||
|
|
|
StringUtils.equals(re.getExamStatus(), RealExam.State.CALCULATING_SCORE) ||
|
|
|
StringUtils.equals(re.getExamStatus(), RealExam.State.GOT_REPORT)) {
|
|
|
- return ArBuilder.error(T_60005, M_60005);
|
|
|
+ return ArBuilder.error(T60005, M60005);
|
|
|
} else {
|
|
|
l.info("没有重复交卷校验正确");
|
|
|
}
|
|
|
RealExamCollection rec = realExamCollectionService.selectRealExamCollectionByExamCollectionId(re.getExamCollectionId());
|
|
|
// Check:考试集合数据有效性。
|
|
|
if (rec == null) {
|
|
|
- return ArBuilder.error(T_60006, M_60006);
|
|
|
+ return ArBuilder.error(T60006, M60006);
|
|
|
} else {
|
|
|
l.info("考试集合数据校验正确");
|
|
|
}
|
|
@@ -351,26 +351,26 @@ public class RealExamService {
|
|
|
if (StringUtils.equals(rec.getExamCollectionType(), RealExamCollection.Type.SELF_EXERCISE)) {
|
|
|
l.info("练习类型考试集合,不需要检查 考试集合 开关状态。");
|
|
|
} else {
|
|
|
- return ArBuilder.error(T_60007, M_60007);
|
|
|
+ return ArBuilder.error(T60011, M60011);
|
|
|
}
|
|
|
} else {
|
|
|
l.info("考试集合开启校验正确");
|
|
|
}
|
|
|
// Check:检查参数examCollectionType有效性
|
|
|
if (!StringUtils.equals(examCollectionType, rec.getExamCollectionType())) {
|
|
|
- return ArBuilder.error(T_60008, M_60008);
|
|
|
+ return ArBuilder.error(T60008, M60008);
|
|
|
} else {
|
|
|
l.info("考试集合类型校验正确");
|
|
|
}
|
|
|
// Check:检查参数studentBindIp有效性
|
|
|
if (StringUtils.isBlank(ip)) {
|
|
|
- return ArBuilder.error(T_40001, M_40001);
|
|
|
+ return ArBuilder.error(T40001, M40001);
|
|
|
} else {
|
|
|
l.info("IP地址检验正确");
|
|
|
}
|
|
|
Seat seat = seatService.uniqueByBindIp(ip);
|
|
|
if (seat == null) {
|
|
|
- return ArBuilder.error(T_40002, M_40002);
|
|
|
+ return ArBuilder.error(T40002, M40002);
|
|
|
} else {
|
|
|
l.info("座次数据检验正确");
|
|
|
}
|
|
@@ -451,10 +451,10 @@ public class RealExamService {
|
|
|
return ArBuilder.error(T60010, M60010);
|
|
|
}
|
|
|
if (reF.getSeatId() == null || reF.getSeatId() == 0L) {
|
|
|
- return ArBuilder.error(T_40010, M_40010);
|
|
|
+ return ArBuilder.error(T40010, M40010);
|
|
|
}
|
|
|
if (reF.getSimId() == null || reF.getSimId() == 0) {
|
|
|
- return ArBuilder.error(T_40011, M_40011);
|
|
|
+ return ArBuilder.error(T40011, M40011);
|
|
|
}
|
|
|
}
|
|
|
// Step:查询模拟器在线状态,纯DB查询。
|
|
@@ -561,7 +561,7 @@ public class RealExamService {
|
|
|
public AjaxResult checkExamId(final Long examId) {
|
|
|
// Check:检查 examId 是否正确存在
|
|
|
if (!exist(examId)) {
|
|
|
- return ArBuilder.error(T_60004, M_60004);
|
|
|
+ return ArBuilder.error(T60004, M60004);
|
|
|
} else {
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
@@ -606,21 +606,21 @@ public class RealExamService {
|
|
|
}
|
|
|
}
|
|
|
RealExam re = selectRealExamByExamId(examId);
|
|
|
- if (re == null ||
|
|
|
- re.getExamId() == 0L ||
|
|
|
- re.getSimId() == null ||
|
|
|
- re.getSimId() == 0L ||
|
|
|
- re.getExamCollectionId() == null ||
|
|
|
- re.getExamCollectionId() == 0L) {
|
|
|
- l.debug("RealExam = {}", re);
|
|
|
- return AjaxResult.error("交卷数据错误!");
|
|
|
+ if (re == null || re.getExamId() == 0L) {
|
|
|
+ return ArBuilder.error(T60004, M60004);
|
|
|
+ }
|
|
|
+ if (re.getSimId() == null || re.getSimId() == 0L) {
|
|
|
+ return ArBuilder.error(T40011, M40011);
|
|
|
+ }
|
|
|
+ if (re.getExamCollectionId() == null || re.getExamCollectionId() == 0L) {
|
|
|
+ return ArBuilder.error(T60006, M60006);
|
|
|
}
|
|
|
if (re.getStartTime() == null) {
|
|
|
- return AjaxResult.error("考试开始时间异常!");
|
|
|
+ return ArBuilder.error(T60012, M60012);
|
|
|
}
|
|
|
// check:考试状态
|
|
|
if (StringUtils.equals(re.getExamStatus(), RealExam.State.SUBMITTED)) {
|
|
|
- return AjaxResult.error("已经交卷,禁止重复交卷,<br/>请刷新自动结束考试!");
|
|
|
+ return ArBuilder.error(T60013, M60013);
|
|
|
}
|
|
|
// Check:已经超时的交卷。
|
|
|
if (checkRealExamIsTimeout(re.getExamId())) {
|
|
@@ -629,27 +629,27 @@ public class RealExamService {
|
|
|
// 修改真实考试结束时间。
|
|
|
re.setEndTime(DateUtils.getNowDate());
|
|
|
updateRealExam(re);
|
|
|
- return AjaxResult.success("考试时间已经超时,自动结束考试!");
|
|
|
+ return ArBuilder.error(T60014, M60014);
|
|
|
}
|
|
|
// Check:检查参数studentBindIp有效性
|
|
|
if (StringUtils.isBlank(studentBindIp)) {
|
|
|
- return AjaxResult.error("IP地址无效!");
|
|
|
+ return ArBuilder.error(T40001, M40001);
|
|
|
}
|
|
|
// 现在交卷的座次
|
|
|
Seat seatNow = seatService.uniqueByBindIp(studentBindIp);
|
|
|
// 开始考试的座次
|
|
|
Seat seatStart = seatService.selectSeatBySeatId(re.getSeatId());
|
|
|
if (seatNow == null || seatStart == null) {
|
|
|
- return AjaxResult.error("没有IP对应座次数据!");
|
|
|
+ return ArBuilder.error(T40002, M40002);
|
|
|
}
|
|
|
// Check:防止换座位交卷。
|
|
|
if (!Objects.equals(seatStart.getSeatId(), seatNow.getSeatId())) {
|
|
|
- return AjaxResult.error("没有在原始座次上交卷,请回到原座次[" + seatStart.getSeatNum() + "]上进行交卷!");
|
|
|
+ return ArBuilder.error(T60015, "没有在原始座次上交卷,请回到原座次[" + seatStart.getSeatNum() + "]上进行交卷!");
|
|
|
}
|
|
|
RealExamCollection rec = realExamCollectionService.selectRealExamCollectionByExamCollectionId(re.getExamCollectionId());
|
|
|
// Check:检查参数examCollectionType有效性
|
|
|
if (!StringUtils.equals(examCollectionType, rec.getExamCollectionType())) {
|
|
|
- return AjaxResult.error("考试集合类型不对应!");
|
|
|
+ return ArBuilder.error(T60008, M60008);
|
|
|
}
|
|
|
// Check:ping通 RS485。
|
|
|
{
|
|
@@ -697,17 +697,17 @@ public class RealExamService {
|
|
|
// Check:检查是否是出题值使用的模拟器。防止换机器交卷。
|
|
|
re = selectRealExamByExamId(examId);
|
|
|
if (!Objects.equals(re.getSimId(), seatNow.getCurrentSimId())) {
|
|
|
- return AjaxResult.error("没有使用原始模拟器交卷,请使用模拟器[" +
|
|
|
+ String msg = "没有使用原始模拟器交卷,请使用模拟器[" +
|
|
|
simService.selectSimBySimId(re.getSimId()).getSimNum() +
|
|
|
- "]进行交卷!");
|
|
|
+ "]进行交卷!";
|
|
|
+ return ArBuilder.error(T60016, msg);
|
|
|
}
|
|
|
// Check:检查考试状态
|
|
|
if (StringUtils.equals(re.getExamStatus(), RealExam.State.SUBMITTED)) {
|
|
|
- return AjaxResult.success("已经成功交卷,跳过交卷!");
|
|
|
+ return ArBuilder.error(T60017, M60017);
|
|
|
}
|
|
|
// todo:检查一下模拟器状态。
|
|
|
|
|
|
-
|
|
|
// Check:检查换学生端交卷的情况。
|
|
|
|
|
|
// Check:交卷报文信息检查
|
|
@@ -732,7 +732,7 @@ public class RealExamService {
|
|
|
simService.updateSimStateBySimId(re.getSimId(), Sim.State.OFFLINE);
|
|
|
return AjaxResult.success("交卷成功!");
|
|
|
} else {
|
|
|
- return AjaxResult.error("交卷失败!考试数据不完整。");
|
|
|
+ return ArBuilder.error(T60018, M60018);
|
|
|
}
|
|
|
}
|
|
|
|