From a82b831b8b2b96dfa5791808f1207500e16697cf Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期三, 04 一月 2023 10:39:40 +0800 Subject: [PATCH] 优化设备状态保持,自动记录心跳间隔,三次心跳失败则设备离线,不在使用设备有效期字段作为唯一判断标准,提高容错能力和稳定性。 --- src/main/java/com/genersoft/iot/vmp/conf/GlobalExceptionHandler.java | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/conf/GlobalExceptionHandler.java b/src/main/java/com/genersoft/iot/vmp/conf/GlobalExceptionHandler.java index 0c7c3d2..728afb9 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/GlobalExceptionHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/GlobalExceptionHandler.java @@ -1,12 +1,12 @@ package com.genersoft.iot.vmp.conf; import com.genersoft.iot.vmp.conf.exception.ControllerException; -import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEventListener; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; @@ -40,8 +40,8 @@ */ @ExceptionHandler(ControllerException.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) - public WVPResult<String> exceptionHandler(ControllerException e) { - return WVPResult.fail(e.getCode(), e.getMsg()); + public ResponseEntity<WVPResult<String>> exceptionHandler(ControllerException e) { + return new ResponseEntity<>(WVPResult.fail(e.getCode(), e.getMsg()), HttpStatus.OK); } /** @@ -51,7 +51,7 @@ */ @ExceptionHandler(BadCredentialsException.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) - public WVPResult<String> exceptionHandler(BadCredentialsException e) { - return WVPResult.fail(ErrorCode.ERROR100.getCode(), e.getMessage()); + public ResponseEntity<WVPResult<String>> exceptionHandler(BadCredentialsException e) { + return new ResponseEntity<>(WVPResult.fail(ErrorCode.ERROR100.getCode(), e.getMessage()), HttpStatus.OK); } } -- Gitblit v1.8.0