Commit 40e3697f by lixian7

绑定接口异常返回调整

parent 43598534
...@@ -57,10 +57,11 @@ public class BindInfoControlller extends BaseController { ...@@ -57,10 +57,11 @@ public class BindInfoControlller extends BaseController {
} catch ( DistributedLockException e ) { } catch ( DistributedLockException e ) {
log.error("分布式锁超时"); log.error("分布式锁超时");
return ResultGenerator.fail(StatusCode.REPEAT_SUBMIT); return ResultGenerator.fail(StatusCode.REPEAT_SUBMIT);
} catch ( Exception e ) {
log.error("系统异常:{}", e);
return ResultGenerator.fail(StatusCode.SYSTEM_ERROR);
} }
// catch ( Exception e ) {
// log.error("系统异常:{}", e);
// return ResultGenerator.fail(StatusCode.SYSTEM_ERROR);
// }
return response; return response;
} }
...@@ -73,7 +74,13 @@ public class BindInfoControlller extends BaseController { ...@@ -73,7 +74,13 @@ public class BindInfoControlller extends BaseController {
@BodyDecryptAnnotation @BodyDecryptAnnotation
@ResponseEncryptAnnotation @ResponseEncryptAnnotation
public Result<BindInfoRes> bindSmsValid(@RequestBody @Validated BindSmsValidReq req) { public Result<BindInfoRes> bindSmsValid(@RequestBody @Validated BindSmsValidReq req) {
return service.bindSmsValid(req); Result result = null;
try {
result = service.bindSmsValid(req);
} catch ( DistributedLockException e ) {
return ResultGenerator.fail(StatusCode.REPEAT_SUBMIT);
}
return result;
} }
...@@ -94,9 +101,6 @@ public class BindInfoControlller extends BaseController { ...@@ -94,9 +101,6 @@ public class BindInfoControlller extends BaseController {
result = service.unbindInfo(req); result = service.unbindInfo(req);
} catch ( DistributedLockException e ) { } catch ( DistributedLockException e ) {
return ResultGenerator.fail(StatusCode.REPEAT_SUBMIT); return ResultGenerator.fail(StatusCode.REPEAT_SUBMIT);
} catch ( Exception e ) {
log.error("系统异常:{}", e);
return ResultGenerator.fail(StatusCode.SYSTEM_ERROR);
} }
return result; return result;
} }
...@@ -115,9 +119,6 @@ public class BindInfoControlller extends BaseController { ...@@ -115,9 +119,6 @@ public class BindInfoControlller extends BaseController {
result = service.adminUnbind(req); result = service.adminUnbind(req);
} catch ( DistributedLockException e ) { } catch ( DistributedLockException e ) {
return ResultGenerator.fail(StatusCode.REPEAT_SUBMIT); return ResultGenerator.fail(StatusCode.REPEAT_SUBMIT);
} catch ( Exception e ) {
log.error("系统异常:{}", e);
return ResultGenerator.fail(StatusCode.SYSTEM_ERROR);
} }
return result; return result;
} }
...@@ -136,9 +137,6 @@ public class BindInfoControlller extends BaseController { ...@@ -136,9 +137,6 @@ public class BindInfoControlller extends BaseController {
result = service.adminUnbindSmsValid(req); result = service.adminUnbindSmsValid(req);
} catch ( DistributedLockException e ) { } catch ( DistributedLockException e ) {
return ResultGenerator.fail(StatusCode.REPEAT_SUBMIT); return ResultGenerator.fail(StatusCode.REPEAT_SUBMIT);
} catch ( Exception e ) {
log.error("系统异常:{}", e);
return ResultGenerator.fail(StatusCode.SYSTEM_ERROR);
} }
return result; return result;
} }
......
...@@ -90,7 +90,7 @@ public class GlobalExceptionHandler { ...@@ -90,7 +90,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler({BusinessException.class}) @ExceptionHandler({BusinessException.class})
@ResponseBody @ResponseBody
public Response<Object> handle(BusinessException e) { public Response<Object> handle(BusinessException e) {
log.warn(e.toString(), e); log.error(e.toString(), e);
return ResponseGenerator.fail(e.getCode(), e.getMsg(), e.getErrorMsg(), e.getParam()); return ResponseGenerator.fail(e.getCode(), e.getMsg(), e.getErrorMsg(), e.getParam());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment