Commit f6afb129 by 杨卫

feat(merchant): 添加4S店信息回显功能的错误处理

- 新增MERCHANT_NOT_4S_STORE和MERCHANT_4S_DETAIL_ERROR两个业务异常枚举
- 修改4S店信息回显接口错误处理逻辑
- 使用自定义业务异常替换默认服务错误返回
- 优化商户类型验证失败时的异常抛出机制
1 parent 53bdee9f
...@@ -23,6 +23,8 @@ import io.swagger.annotations.ApiOperation; ...@@ -23,6 +23,8 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.util.Optional;
/** /**
* 4S店信息编辑Controller * 4S店信息编辑Controller
* *
...@@ -87,7 +89,11 @@ public class MerchantEditController { ...@@ -87,7 +89,11 @@ public class MerchantEditController {
RpcResponse<MerchantEditDetailRpcResponse> rpcResponse = merchantEditRemote.getMerchantDetail(rpcRequest); RpcResponse<MerchantEditDetailRpcResponse> rpcResponse = merchantEditRemote.getMerchantDetail(rpcRequest);
if (rpcResponse.isFailed()) { if (rpcResponse.isFailed()) {
log.error("4S店信息回显失败: {}", rpcResponse.getMessage()); log.error("4S店信息回显失败: {}", rpcResponse.getMessage());
throw new RpcServiceException(rpcResponse.getError(), rpcResponse.getMessage()); throw new RpcServiceException(
rpcResponse.getError(),
Optional.ofNullable(rpcResponse.getException()).map(RpcServiceException::getErrId).orElse(DefaultErrorEnum.SERVICE_ERROR.getValue()),
rpcResponse.getMessage()
);
} }
MerchantEditDetailRpcResponse rpcResult = rpcResponse.getResult(); MerchantEditDetailRpcResponse rpcResult = rpcResponse.getResult();
MerchantDetailResponse response = merchantEditConvert.toResponse(rpcResult); MerchantDetailResponse response = merchantEditConvert.toResponse(rpcResult);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!