Commit 136f66d9 by 杨卫

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

- 新增MERCHANT_NOT_4S_STORE和MERCHANT_4S_DETAIL_ERROR两个业务异常枚举
- 修改4S店信息回显接口错误处理逻辑
- 使用自定义业务异常替换默认服务错误返回
- 优化商户类型验证失败时的异常抛出机制
1 parent 692af1d9
......@@ -59,6 +59,8 @@ public enum BusinessExceptionEnum implements ErrorEnum {
OWE_CUS_GROUP_EMPTY("13110042", "所属客户群体为空"),
EMPTY_FILE("13110043", "导入文件为空"),
CITY_LEVEL_ERROR("13110044", "市代商户不可挂靠在工厂下"),
MERCHANT_NOT_4S_STORE("13110045", "该商户非4S店类型,无法回显4S店信息"),
MERCHANT_4S_DETAIL_ERROR("13110046", "4S店信息回显失败,请稍后重试"),
;
......
......@@ -168,8 +168,7 @@ public class MerchantEditRemoteImpl implements MerchantEditRemote {
Integer merchantNo = request.getMerchantNo();
Integer merchantId = merchantMapper.findIdByMerchantNo(merchantNo);
if (merchantId == null) {
throw new RpcServiceException(BusinessExceptionEnum.MERCHANT_NOEXIT_EXCEPTION.getValue(),
BusinessExceptionEnum.MERCHANT_NOEXIT_EXCEPTION.getDisplayName());
throw new RpcServiceException(BusinessExceptionEnum.MERCHANT_NOEXIT_EXCEPTION.getValue(), BusinessExceptionEnum.MERCHANT_NOEXIT_EXCEPTION.getDisplayName());
}
MerchantRequest merchantRequest = new MerchantRequest();
......@@ -183,7 +182,8 @@ public class MerchantEditRemoteImpl implements MerchantEditRemote {
return RpcResponse.error(e);
} catch (Exception e) {
log.error("4S店信息回显异常,merchantNo={}", request.getMerchantNo(), e);
return RpcResponse.error(new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR.getValue(), "4S店信息回显异常"));
return RpcResponse.error(new RpcServiceException(BusinessExceptionEnum.MERCHANT_4S_DETAIL_ERROR.getValue(),
BusinessExceptionEnum.MERCHANT_4S_DETAIL_ERROR.getDisplayName()));
}
}
......@@ -228,7 +228,8 @@ public class MerchantEditRemoteImpl implements MerchantEditRemote {
Integer accountType = Optional.ofNullable(merchant.getAccountType())
.filter(r -> r.contains(Constants.ACCOUNT_TYPE_ID_4S + StrUtil.EMPTY))
.map(r -> Constants.ACCOUNT_TYPE_ID_4S)
.orElseThrow(() -> new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR.getValue(), "4S店信息回显异常"));
.orElseThrow(() -> new RpcServiceException(BusinessExceptionEnum.MERCHANT_NOT_4S_STORE.getValue(),
BusinessExceptionEnum.MERCHANT_NOT_4S_STORE.getDisplayName()));
response.setMerchantType(accountType);
response.setMerchantTypeName(Constants.ACCOUNT_TYPE_NAME_4S);
Integer accountLevel = merchant.getMerchantAccountLevel() != null ? merchant.getMerchantAccountLevel().intValue() : null;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!