增加用户登录超时异常

This commit is contained in:
ajaxfan
2021-05-06 15:06:19 +08:00
parent c63b0dfb01
commit f24554dc41
2 changed files with 48 additions and 43 deletions

View File

@ -6,6 +6,7 @@ import lombok.Getter;
/**
* 公共错误提示信息
*
* @author daixc
* @date 2020/10/10
*/
@ -44,8 +45,11 @@ public enum CommonExceptionEnum implements BusinessExceptionAssert {
/**
* 自定义输出内容
*/
FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR(100999, "");
FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR(100999, ""),
/**
* 登陆已超期
*/
LOGIN_EXPIRATION(90401, "登陆已超期");
/**
* 返回码

View File

@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
import com.chinaunicom.mall.ebtp.common.exception.common.CommonExceptionEnum;
import com.chinaunicom.mall.ebtp.common.exception.entity.AuthFailureException;
import com.chinaunicom.mall.ebtp.common.exception.entity.BusinessException;
import com.chinaunicom.mall.ebtp.common.util.JsonUtils;
@ -159,8 +160,8 @@ public class BusinessExceptionHandlerAdvice {
Map<String, Object> body = new HashMap<>();
body.put("errors", exception.getMessage());
body.put("error", HttpStatus.UNAUTHORIZED.getReasonPhrase());
// body.put("path", request.getRequestURI());
return BaseResponse.fail(HttpStatus.UNAUTHORIZED.value(), "登陆已超期", Convert.toStr(body));
return BaseResponse.fail(CommonExceptionEnum.LOGIN_EXPIRATION.getCode(), "登陆已超期", Convert.toStr(body));
}
/**