Browse Source

studentSubmitRealExam改造。

tom 1 tuần trước cách đây
mục cha
commit
ce255dff3c

+ 96 - 39
ruoyi-sim/src/main/java/com/ruoyi/sim/constant/ErrorConst.java

@@ -36,25 +36,30 @@ public interface ErrorConst {
     Integer BACK_END_SERVER_LOST = 10105;
 
 
+    Integer T10011 = 10011;
+
+    String M10011 = "回复报文格式错误!<br/>系统自动尝试重新连接,请3秒后重新尝试!";
+
+    Integer T10012 = 10012;
+
+    String M10012 = "回复报文不匹配!<br/>系统自动尝试重新连接,请3秒后重新尝试!";
+
     /**
-     * 20xxx 模拟器状态相关
+     * 2xxxx 模拟器状态相关
      **/
-    Integer T_20001 = 20001;
+    Integer T20001 = 20001;
 
-    String M_20001 = "座号[{0}]-模拟器[{1}]型[{2}]在线";
+    String M20001 = "座号[{0}]-模拟器[{1}]型[{2}]在线";
     ;
 
-    Integer T_20002 = 20002;
+    Integer T20002 = 20002;
 
-    String M_20002 = "座号[{0}]-没有连接任何接模拟器,检查线缆开关和线缆连接!";
+    String M20002 = "座号[{0}]-没有连接任何接模拟器,检查线缆开关和线缆连接!";
 
-    /** 201xx 0001型模拟器状态相关 **/
-    /**
-     * 模拟器类型错误
-     */
-    Integer T_20003 = 20003;
+    Integer T20003 = 20003;
+
+    String M20003 = "没有连接任何接模拟器,<br>检查线缆开关和线缆连接!";
 
-    String M_20003 = "连接模拟器类型或序列号不正确!<br>应该连接模拟器型号:<br>";
 
     /**
      * 充电时间不足。
@@ -69,6 +74,11 @@ public interface ErrorConst {
     Integer T20005 = 20005;
 
     /**
+     * 其他情况 通过报文内容 逻辑判断 可换件不存在
+     */
+    Integer T20007 = 20007;
+
+    /**
      * 可换件 ID小于MIN
      */
     Integer T20011 = 20011;
@@ -83,9 +93,24 @@ public interface ErrorConst {
     String M20012 = "可换件id异常";
 
     /**
-     * 其他情况 通过报文内容 逻辑判断 可换件不存在
+     * 模拟器类型错误
      */
-    Integer T20007 = 20007;
+    Integer T20013 = 20003;
+
+    String M20013 = "连接模拟器类型或序列号不正确!<br>应该连接模拟器型号:<br>";
+
+    /**
+     * 模拟器被手动禁用
+     */
+    Integer T20014 = 20014;
+
+    String M20014 = "";
+
+    /**
+     * 21xxx 0001型模拟器状态相关
+     **/
+
+    Integer T21001 = 21001;
 
     /**
      * 0002型 09
@@ -101,16 +126,24 @@ public interface ErrorConst {
 
     String M24001 = "请检查 显控报警板与主板连接线 连接情况!";
 
+    Integer T24002 = 24002;
+
+    String M24002 = "电池舱盖没有关闭 或 电池接触不良。<br/>请关闭电池舱盖 并 正确安装电池后重试。";
+
+    Integer T24003 = 24003;
+
+    String M24003 = "电池接触不良,请安装后重试。";
+
     /**
      * 40xxx 基础数据问题
      **/
-    Integer T_40001 = 40001;
+    Integer T40001 = 40001;
 
-    String M_40001 = "IP地址无效";
+    String M40001 = "IP地址无效";
 
-    Integer T_40002 = 40002;
+    Integer T40002 = 40002;
 
-    String M_40002 = "没有IP对应座次数据!";
+    String M40002 = "没有IP对应座次数据!";
 
     Integer T_40003 = 40003;
 
@@ -126,13 +159,13 @@ public interface ErrorConst {
 
     Integer T_40009 = 40009;
 
-    Integer T_40010 = 40010;
+    Integer T40010 = 40010;
 
-    String M_40010 = "座次数据空!<br/>请向教员说明情况。";
+    String M40010 = "座次数据空!<br/>请向教员说明情况。";
 
-    Integer T_40011 = 40011;
+    Integer T40011 = 40011;
 
-    String M_40011 = "模拟器数据空!<br/>请向教员说明情况。";
+    String M40011 = "模拟器数据空!<br/>请向教员说明情况。";
 
     /** 50xxx 报文内容问题 **/
 
@@ -140,37 +173,33 @@ public interface ErrorConst {
      * 60xxx 考试相关问题
      **/
 
-    Integer T_60001 = 60001;
+    Integer T60001 = 60001;
 
-    String M_60001 = "存在打开的考试,无法开启训练!<br/>请向教员说明情况。";
+    String M60001 = "存在打开的考试,无法开启训练!<br/>请向教员说明情况。";
 
-    Integer T_60002 = 60002;
+    Integer T60002 = 60002;
 
-    String M_60002 = "存在打开的考试,无法开启练习!<br/>请向教员说明情况。";
+    String M60002 = "存在打开的考试,无法开启练习!<br/>请向教员说明情况。";
 
-    Integer T_60003 = 60003;
+    Integer T60003 = 60003;
 
-    String M_60003 = "存在打开的训练,无法开启练习!<br/>请向教员说明情况。";
+    String M60003 = "存在打开的训练,无法开启练习!<br/>请向教员说明情况。";
 
-    Integer T_60004 = 60004;
+    Integer T60004 = 60004;
 
-    String M_60004 = "对应考试Id不存在!";
+    String M60004 = "对应考试不存在!";
 
-    Integer T_60005 = 60005;
+    Integer T60005 = 60005;
 
-    String M_60005 = "已经交卷,禁止重复开始考试!";
+    String M60005 = "已经交卷,禁止重复开始考试!";
 
-    Integer T_60006 = 60006;
+    Integer T60006 = 60006;
 
-    String M_60006 = "考试集合数据不存在!";
+    String M60006 = "对应考试集合不存在!";
 
-    Integer T_60007 = 60007;
+    Integer T60008 = 60008;
 
-    String M_60007 = "教师端对应考试/训练尚未打开!<br/>请向教员说明情况。";
-
-    Integer T_60008 = 60008;
-
-    String M_60008 = "考试集合类型不对应!";
+    String M60008 = "考试集合类型不对应!";
 
     Integer T60009 = 60009;
 
@@ -179,4 +208,32 @@ public interface ErrorConst {
     Integer T60010 = 60010;
 
     String M60010 = "考试数据空!<br/>请向教员说明情况。";
+
+    Integer T60011 = 60011;
+
+    String M60011 = "教师端对应考试/训练尚未打开!<br/>请向教员说明情况。";
+
+    Integer T60012 = 60012;
+
+    String M60012 = "考试开始时间异常!";
+
+    Integer T60013 = 60013;
+
+    String M60013 = "已经交卷,禁止重复交卷,<br/>请刷新自动结束考试!";
+
+    Integer T60014 = 60014;
+
+    String M60014 = "考试时间已经超时,自动结束考试!";
+
+    Integer T60015 = 60015;
+
+    Integer T60016 = 60016;
+
+    Integer T60017 = 60017;
+
+    String M60017 = "已经成功交卷,跳过交卷!";
+
+    Integer T60018 = 60018;
+
+    String M60018 = "交卷失败!考试数据不完整。";
 }

+ 5 - 2
ruoyi-sim/src/main/java/com/ruoyi/sim/domain/SimMsg.java

@@ -5,12 +5,15 @@ import java.util.Objects;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.sim.constant.ArBuilder;
 import com.ruoyi.sim.service.impl.CommParseUtils;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
 
+import static com.ruoyi.sim.constant.ErrorConst.*;
+
 /**
  * 模拟器报文对象 sim_sim_msg
  *
@@ -272,9 +275,9 @@ public class SimMsg extends BaseEntity {
         } else if (Objects.equals(this.result, Result.READ_TIMEOUT_EXCEPTION)) {
             return AjaxResult.error("模拟器通信超时!");
         } else if (Objects.equals(this.result, Result.RECEIVE_CHECK_FAIL)) {
-            return AjaxResult.error("回复报文格式错误!<br/>系统自动尝试重新连接,请3秒后重新尝试开始考试!");
+            return ArBuilder.error(T10011, M10011);
         } else if (Objects.equals(this.result, Result.RECEIVE_NOT_MATCH)) {
-            return AjaxResult.error("回复报文不匹配!<br/>系统自动尝试重新连接,请3秒后重新尝试开始考试!");
+            return ArBuilder.error(T10012, M10012);
         } else {
             // throw new IllegalArgumentException("参数错误!");
         }

+ 9 - 9
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/CommCheckService.java

@@ -155,10 +155,10 @@ public class CommCheckService {
             // 查询出最新的Sim对象
             sim = simService.uniqueBySimNum(simNum);
             //
-            String msg = MessageFormat.format(M_20001, seat.getSeatNum(), Sim.TYPE_NAME_MAP.get(sim.getSimType()), sim.getSimNum());
+            String msg = MessageFormat.format(M20001, seat.getSeatNum(), Sim.TYPE_NAME_MAP.get(sim.getSimType()), sim.getSimNum());
             String msgSpec = checkOneSeatStateSpecBySimType(sim);
             // 成功的话,Obj为Sim对象。
-            return ArBuilder.success(T_20001, msg + msgSpec, sim);
+            return ArBuilder.success(T20001, msg + msgSpec, sim);
         } else if (Objects.equals(result, SimMsg.Result.READ_TIMEOUT_EXCEPTION)) { // 正常情况:模拟器离线
             // 更新Sim状态 更新当前座上sim的状态。
             if (!seat.getCurrentSimId().equals(Sim.ID_0)) {
@@ -167,12 +167,12 @@ public class CommCheckService {
             }
             // 更新座上SimId
             seatService.updateCurrentSimIdBySeatNum(seat.getSeatNum(), Sim.ID_0);
-            String msg = MessageFormat.format(M_20002, seat.getSeatNum());
+            String msg = MessageFormat.format(M20002, seat.getSeatNum());
             // 构造一个假的Sim对象,用来返回结果。不知道之前模拟器的状态。
             Sim simFake = new Sim();
             simFake.setSimState(Sim.State.OFFLINE);
             // 成功的话,Obj为虚拟构建Sim对象。
-            return ArBuilder.success(T_20002, msg, simFake);
+            return ArBuilder.success(T20002, msg, simFake);
         } else if (Objects.equals(result, SimMsg.Result.RECEIVE_CHECK_FAIL)) {
             return smR.getDefaultErrorAR();
         } else if (Objects.equals(result, SimMsg.Result.RECEIVE_NOT_MATCH)) {
@@ -223,7 +223,7 @@ public class CommCheckService {
      */
     public AjaxResult checkOneSimOnlineState(final Long simId) {
         if (simId == null || simId <= 0) {
-            return AjaxResult.error("没有连接任何接模拟器,<br>检查线缆开关和线缆连接!");
+            return ArBuilder.error(T20003, M20003);
         }
         Sim sim = simService.selectSimBySimId(simId);
         if (sim != null) {
@@ -235,7 +235,7 @@ public class CommCheckService {
                     return AjaxResult.success("模拟器[" + sim.getSimNum() + "]离线!");
                 }
                 case Sim.State.DISABLE: {
-                    return AjaxResult.error("模拟器[" + sim.getSimNum() + "]禁用!");
+                    return ArBuilder.error(T20014, "模拟器[" + sim.getSimNum() + "]禁用!");
                 }
             }
         }
@@ -280,21 +280,21 @@ public class CommCheckService {
                     if (content.startsWith(CommConst.TYPE_0001_SN_PREFIX) && content.endsWith(sim.getSimNum())) {
                         return AjaxResult.success(msgOk);
                     } else {
-                        return ArBuilder.error(ErrorConst.T_20003, M_20003 + Sim.TYPE_NAME_MAP.get(targetSimType));
+                        return ArBuilder.error(ErrorConst.T20013, M20013 + Sim.TYPE_NAME_MAP.get(targetSimType));
                     }
                 }
                 case Sim.TYPE_0002 -> {
                     if (content.startsWith(CommConst.TYPE_0002_SN_PREFIX) && content.endsWith(sim.getSimNum())) {
                         return AjaxResult.success(msgOk);
                     } else {
-                        return ArBuilder.error(ErrorConst.T_20003, M_20003 + Sim.TYPE_NAME_MAP.get(targetSimType));
+                        return ArBuilder.error(ErrorConst.T20013, M20013 + Sim.TYPE_NAME_MAP.get(targetSimType));
                     }
                 }
                 case Sim.TYPE_0003 -> {
                     if (content.startsWith(CommConst.TYPE_0003_SN_PREFIX) && content.endsWith(sim.getSimNum())) {
                         return AjaxResult.success(msgOk);
                     } else {
-                        return ArBuilder.error(ErrorConst.T_20003, M_20003 + Sim.TYPE_NAME_MAP.get(targetSimType));
+                        return ArBuilder.error(ErrorConst.T20013, M20013 + Sim.TYPE_NAME_MAP.get(targetSimType));
                     }
                 }
                 default -> throw new IllegalStateException("Unexpected value: " + targetSimType);

+ 4 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/CommReceiveService.java

@@ -215,8 +215,12 @@ public class CommReceiveService {
             if (StringUtils.equals(CONTENT_BLANK, contentData)) {
                 String eMsg = "[" + f.getReplaceName() + "]可换件异常;<br>";
                 l.info(eMsg);
+                l.info("fault {}", f);
                 vo.setErrorMsg(eMsg);
                 vo.setCheckOk(false);
+                if (StringUtils.equals(FaultIdConst.T0001.F01, f.getFaultId())) {
+                    return ArBuilder.error(T21001, eMsg + "检查电池安装情况。可能电池接触不良,请按紧后重试!", vo);
+                }
                 return ArBuilder.error(T20005, eMsg, vo);
             }
         }

+ 14 - 22
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/CommSendService.java

@@ -12,6 +12,7 @@ import com.ruoyi.sim.domain.vo.FaultCheckVo;
 import com.ruoyi.sim.domain.vo.ScanSeatVo;
 import com.ruoyi.sim.domain.vo.SimSocketParamVo;
 import com.ruoyi.sim.util.SimDateUtil;
+import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
@@ -825,25 +826,21 @@ public class CommSendService {
                     l.info("put key = {}", vo.getFault().getFaultId());
                 }
                 l.info("debug@FaultCheckVo = {}", vo);
-                if (StringUtils.equals(
-                        Objects.requireNonNull(vo).getFault().getFaultId(),
-                        FaultIdConst.T0001.F09)) {
+                if (StringUtils.equals(Objects.requireNonNull(vo).getFault().getFaultId(), FaultIdConst.T0001.F09)) {
                     if (!StringUtils.equals(vo.getSimMsgReceive().getReceiveSubContentData(), "00000002")) {
-                        return AjaxResult.error("电池舱盖没有关闭 或 电池接触不良。<br/>请关闭电池舱盖 并 正确安装电池后重试。");
+                        return ArBuilder.error(T24002, M24002);
                     }
                 }
             }
-            if (
-                    mapE.containsKey(FaultIdConst.T0001.F01) &&
-                            mapE.containsKey(FaultIdConst.T0001.F02) &&
-                            mapE.containsKey(FaultIdConst.T0001.F03) &&
-                            mapE.containsKey(FaultIdConst.T0001.F04) &&
-                            mapE.containsKey(FaultIdConst.T0001.F06) &&
-                            mapE.containsKey(FaultIdConst.T0001.F07) &&
-                            mapE.containsKey(FaultIdConst.T0001.F08) &&
-                            mapE.containsKey(FaultIdConst.T0001.F0A)
-            ) {
-                return AjaxResult.error("电池接触不良,请安装后重试。");
+            if (mapE.containsKey(FaultIdConst.T0001.F01) &&
+                    mapE.containsKey(FaultIdConst.T0001.F02) &&
+                    mapE.containsKey(FaultIdConst.T0001.F03) &&
+                    mapE.containsKey(FaultIdConst.T0001.F04) &&
+                    mapE.containsKey(FaultIdConst.T0001.F06) &&
+                    mapE.containsKey(FaultIdConst.T0001.F07) &&
+                    mapE.containsKey(FaultIdConst.T0001.F08) &&
+                    mapE.containsKey(FaultIdConst.T0001.F0A)) {
+                return ArBuilder.error(T24003, M24003);
             }
         }
         return AjaxResult.success("检查成功!");
@@ -882,11 +879,7 @@ public class CommSendService {
 //
 //                }
 //            }
-            if (setNG.contains(FaultIdConst.T0003.F03) &&
-                    setNG.contains(FaultIdConst.T0003.F04) &&
-                    setNG.contains(FaultIdConst.T0003.F0B) &&
-                    setNG.contains(FaultIdConst.T0003.F0E)
-            ) {
+            if (setNG.contains(FaultIdConst.T0003.F03) && setNG.contains(FaultIdConst.T0003.F04) && setNG.contains(FaultIdConst.T0003.F0B) && setNG.contains(FaultIdConst.T0003.F0E)) {
                 return ArBuilder.error(T24001, M24001);
             }
         }
@@ -904,8 +897,7 @@ public class CommSendService {
         SimMsg smS = commBuildService.buildSendMsgReadFaultResistance(vo.getSim().getSimNum(), vo.getFault().getBindHardwareMsg());
         SimMsg smR = send(smS, vo.getSeat(), vo.getSim(), RETRY_COUNT_CHECK_ONE_FAULT, commStrategy.getSleepLong());
         if (smR.isResultNotOk()) {
-            if (Objects.equals(smR.getResult(), SimMsg.Result.RECEIVE_CHECK_FAIL) ||
-                    (Objects.equals(smR.getResult(), SimMsg.Result.RECEIVE_NOT_MATCH))) {
+            if (Objects.equals(smR.getResult(), SimMsg.Result.RECEIVE_CHECK_FAIL) || (Objects.equals(smR.getResult(), SimMsg.Result.RECEIVE_NOT_MATCH))) {
                 l.info("reset connection!");
                 String ip = vo.getSeat().getSeatRs485Ip();
                 Integer port = vo.getSeat().getSeatRs485Port();

+ 32 - 32
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/RealExamService.java

@@ -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);
         }
     }