提交 bb1e81e9 authored 作者: 000516's avatar 000516

暂存代码

上级 4e5ff5e9
package com.wangxiaolu.promotion.common.constant;
/**
* @author : liqiulin
* @date : 2025-05-27 19
* @describe :
*/
public class ServiceNameConstants {
public static final String WXL_SFA_OPERATION_SERVICE = "wangxiaolu-sfa-operation";
}
...@@ -4,16 +4,14 @@ import com.wangxiaolu.promotion.exception.APIException; ...@@ -4,16 +4,14 @@ import com.wangxiaolu.promotion.exception.APIException;
import com.wangxiaolu.promotion.exception.DataException; import com.wangxiaolu.promotion.exception.DataException;
import com.wangxiaolu.promotion.exception.FlowException; import com.wangxiaolu.promotion.exception.FlowException;
import com.wangxiaolu.promotion.exception.ParamException; import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.result.basedata.R; import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.result.basedata.RCode;
import org.apache.ibatis.exceptions.TooManyResultsException; import org.apache.ibatis.exceptions.TooManyResultsException;
import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.sql.SQLIntegrityConstraintViolationException;
/** /**
* @author : liqiulin * @author : liqiulin
* @date : 2024-03-28 19 * @date : 2024-03-28 19
...@@ -25,22 +23,22 @@ public class ControllerExceptionAdvice { ...@@ -25,22 +23,22 @@ public class ControllerExceptionAdvice {
@ExceptionHandler({ParamException.class}) @ExceptionHandler({ParamException.class})
public R paramExceptionHandler(ParamException e) { public R paramExceptionHandler(ParamException e) {
return new R(e.getCode(), e.getMsg(), e.getMessage()); return new R(e.getCode(), e.getMsg());
} }
@ExceptionHandler({FlowException.class}) @ExceptionHandler({FlowException.class})
public R flowExceptionHandler(FlowException e) { public R flowExceptionHandler(FlowException e) {
return new R(e.getCode(), e.getMsg(), e.getMessage()); return new R(e.getCode(), e.getMsg());
} }
@ExceptionHandler({APIException.class}) @ExceptionHandler({APIException.class})
public R apiExceptionHandler(APIException e) { public R apiExceptionHandler(APIException e) {
return new R(e.getCode(), e.getMsg(), e.getMessage()); return new R(e.getCode(), e.getMsg());
} }
@ExceptionHandler({DataException.class}) @ExceptionHandler({DataException.class})
public R dataExceptionHandler(DataException e) { public R dataExceptionHandler(DataException e) {
return new R(e.getCode(), e.getMsg(), e.getMessage()); return new R(e.getCode(), e.getMsg());
} }
@ExceptionHandler({MethodArgumentNotValidException.class}) @ExceptionHandler({MethodArgumentNotValidException.class})
...@@ -51,8 +49,7 @@ public class ControllerExceptionAdvice { ...@@ -51,8 +49,7 @@ public class ControllerExceptionAdvice {
@ExceptionHandler({DataIntegrityViolationException.class}) @ExceptionHandler({DataIntegrityViolationException.class})
public R dataIntegrityViolationExceptionHandler(DataIntegrityViolationException e) { public R dataIntegrityViolationExceptionHandler(DataIntegrityViolationException e) {
String msg = e.getMessage(); return new R(RCode.API_DATA_ERROR.getCode(), RCode.API_DATA_ERROR.getMsg());
return new R(RCode.API_DATA_ERROR.getCode(), RCode.API_DATA_ERROR.getMsg(), msg);
} }
@ExceptionHandler({TooManyResultsException.class}) @ExceptionHandler({TooManyResultsException.class})
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论