diff --git a/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/exception/service/BusinessExceptionHandlerAdviceDefault.java b/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/exception/service/BusinessExceptionHandlerAdviceDefault.java index 3e49e62..5a2f137 100644 --- a/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/exception/service/BusinessExceptionHandlerAdviceDefault.java +++ b/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/exception/service/BusinessExceptionHandlerAdviceDefault.java @@ -15,6 +15,7 @@ import org.springframework.dao.DataAccessException; import org.springframework.dao.DuplicateKeyException; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.http.HttpStatus; +import org.springframework.transaction.TransactionSystemException; import org.springframework.validation.BindException; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; @@ -34,7 +35,6 @@ import com.chinaunicom.mall.ebtp.common.util.JsonUtils; import cn.hutool.core.convert.Convert; import cn.hutool.core.exceptions.ExceptionUtil; import io.seata.core.context.RootContext; -import io.seata.core.exception.BranchTransactionException; import io.seata.core.exception.RmTransactionException; import lombok.Getter; import lombok.Setter; @@ -258,10 +258,10 @@ public class BusinessExceptionHandlerAdviceDefault { return BaseResponse.fail(HttpStatus.INTERNAL_SERVER_ERROR.value(), "系统异常", Convert.toStr(body)); } - @ExceptionHandler({ BranchTransactionException.class }) + @ExceptionHandler({ TransactionSystemException.class, RmTransactionException.class }) @ResponseStatus(HttpStatus.BAD_REQUEST) public BaseResponse handleTransactionSystemException(HttpServletRequest request, - BranchTransactionException exception) { + TransactionSystemException exception) { log.info(ExceptionUtil.stacktraceToString(exception)); if (((String) Objects.requireNonNull(exception.getMessage())).contains("may be has finished")) { String xid = RootContext.getXID(); diff --git a/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/exception/service/BusinessExceptionHandlerAdvicePro.java b/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/exception/service/BusinessExceptionHandlerAdvicePro.java index 6c65027..d364d37 100644 --- a/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/exception/service/BusinessExceptionHandlerAdvicePro.java +++ b/uboot-common/src/main/java/com/chinaunicom/mall/ebtp/common/exception/service/BusinessExceptionHandlerAdvicePro.java @@ -35,9 +35,7 @@ import com.chinaunicom.mall.ebtp.common.util.JsonUtils; import cn.hutool.core.convert.Convert; import cn.hutool.core.exceptions.ExceptionUtil; import io.seata.core.context.RootContext; -import io.seata.core.exception.BranchTransactionException; import io.seata.core.exception.RmTransactionException; -import io.seata.core.exception.TransactionException; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; @@ -258,10 +256,10 @@ public class BusinessExceptionHandlerAdvicePro { return BaseResponse.fail(HttpStatus.INTERNAL_SERVER_ERROR.value(), "系统异常", Convert.toStr(body)); } - @ExceptionHandler({ BranchTransactionException.class }) + @ExceptionHandler({ TransactionSystemException.class, RmTransactionException.class }) @ResponseStatus(HttpStatus.BAD_REQUEST) public BaseResponse handleTransactionSystemException(HttpServletRequest request, - BranchTransactionException exception) { + TransactionSystemException exception) { log.info(ExceptionUtil.stacktraceToString(exception)); if (((String) Objects.requireNonNull(exception.getMessage())).contains("may be has finished")) { String xid = RootContext.getXID();