Merge branch 'develop_master' into FOTON

This commit is contained in:
396572590@qq.com
2022-06-27 17:21:01 +08:00
34 changed files with 595 additions and 166 deletions
@@ -13,11 +13,23 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import java.util.HashSet;
import java.util.Set;
@Slf4j
@ControllerAdvice
@Order(value=4)
public class AdcDaBaseExceptionAdvice {
private static Set<String> errMsg = new HashSet<>();
static {
errMsg.add("token已过期");
errMsg.add("未登录");
errMsg.add("token解析错误");
errMsg.add("员工不存在");
}
@ResponseStatus(HttpStatus.OK)
@ExceptionHandler(AdcDaBaseException.class)
@@ -34,8 +46,8 @@ public class AdcDaBaseExceptionAdvice {
log.error(exception.getMessage(), exception);
// TODO 在数据库中记录程序异常,这个地方的异常是未处理的异常,需要管理员查看并进行处理以防重复出现
if(exception.getStackTrace() != null){
if("token已过期".equals(exception.getMessage())){
return Result.error(ResponseMessageCodeEnum.ERROR_TOKEN.getCode(), "token已过期,请重新登录");
if(errMsg.contains(exception.getMessage())){
return Result.error(ResponseMessageCodeEnum.ERROR_TOKEN.getCode(), "token无效,请登录");
}
}
return Result.error(ResponseMessageCodeEnum.ERROR.getCode(), "程序异常,请重试。如果重复出现请联系管理员处理!");