|  | @@ -125,8 +125,11 @@ public class CommSendService {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //
 | 
	
		
			
				|  |  |          Sim s = simService.uniqueBySimNum(simNum);
 | 
	
		
			
				|  |  | -        if (s == null || !Sim.State.ONLINE.equals(s.getSimState())) {
 | 
	
		
			
				|  |  | -            return AjaxResult.error("未连接维修模拟器,请检查连接!");
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            AjaxResult arE3 = checkOneSimStateActive(s);
 | 
	
		
			
				|  |  | +            if (arE3.isError()) {
 | 
	
		
			
				|  |  | +                return arE3;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          // todo: aj改造
 | 
	
		
			
				|  |  |          readOneSimAtLastByDebug(s);
 | 
	
	
		
			
				|  | @@ -140,7 +143,6 @@ public class CommSendService {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | -     *
 | 
	
		
			
				|  |  |       * 计算减分(不包括超时)。汇总到deduction_total_score字段。
 | 
	
		
			
				|  |  |       *
 | 
	
		
			
				|  |  |       * @param realExamId
 | 
	
	
		
			
				|  | @@ -156,7 +158,6 @@ public class CommSendService {
 | 
	
		
			
				|  |  |          realExamService.updateOneState(realExamId, RealExam.State.GOT_REPORT);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * todo:????
 | 
	
		
			
				|  |  |       * 定时任务。
 | 
	
	
		
			
				|  | @@ -246,6 +247,21 @@ public class CommSendService {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | +     * 主动更新模拟器状态。
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +     * @param s
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    public AjaxResult checkOneSimStateActive(final Sim s) {
 | 
	
		
			
				|  |  | +        checkOneSimState(s, true);
 | 
	
		
			
				|  |  | +        // 如果模拟器离线
 | 
	
		
			
				|  |  | +        if (s == null || !Sim.State.ONLINE.equals(s.getSimState())) {
 | 
	
		
			
				|  |  | +            return AjaxResult.error("未连接模拟器,请检查连接!");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return AjaxResult.success();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  |       * @param s
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      public void checkOneSimState(final Sim s, final boolean important) {
 | 
	
	
		
			
				|  | @@ -398,6 +414,12 @@ public class CommSendService {
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      public AjaxResult debugClearAllFaultBySimNum(final String simNum) {
 | 
	
		
			
				|  |  |          Sim s = simService.uniqueBySimNum(simNum);
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            AjaxResult arE3 = checkOneSimStateActive(s);
 | 
	
		
			
				|  |  | +            if (arE3.isError()) {
 | 
	
		
			
				|  |  | +                return arE3;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          if (s == null) {
 | 
	
		
			
				|  |  |              return AjaxResult.error("清除失败,对应simNum模拟器不存在!");
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -471,7 +493,8 @@ public class CommSendService {
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      public List<SimMsg> debugWriteAllFault(final String simNum) {
 | 
	
		
			
				|  |  |          List<SimMsg> list = new ArrayList<>();
 | 
	
		
			
				|  |  | -        String simType = simService.uniqueBySimNum(simNum).getSimType();
 | 
	
		
			
				|  |  | +        Sim s = simService.uniqueBySimNum(simNum);
 | 
	
		
			
				|  |  | +        String simType = s.getSimType();
 | 
	
		
			
				|  |  |          for (String b : getGZBWBySimType(simType)) {
 | 
	
		
			
				|  |  |              list.add(debugWriteOneFault(simNum, b));
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -504,10 +527,9 @@ public class CommSendService {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          // Step 1 主动查询一次模拟器状态。
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            checkOneSimState(s, true);
 | 
	
		
			
				|  |  | -            // 如果模拟器离线
 | 
	
		
			
				|  |  | -            if (s == null || !Sim.State.ONLINE.equals(s.getSimState())) {
 | 
	
		
			
				|  |  | -                return AjaxResult.error("未连接模拟器,请检查连接!");
 | 
	
		
			
				|  |  | +            AjaxResult arE3 = checkOneSimStateActive(s);
 | 
	
		
			
				|  |  | +            if (arE3.isError()) {
 | 
	
		
			
				|  |  | +                return arE3;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          // Step 2
 |