mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
移除资金管理中可能抛出的PayException改为ServiceException,便于后期国际化管理
This commit is contained in:
-16
@@ -3,7 +3,6 @@ package com.cf.imes.framework.web.core.handler;
|
|||||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.text.CharSequenceUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
import com.cf.imes.framework.common.exception.PayException;
|
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
import com.cf.imes.framework.common.util.monitor.TracerUtils;
|
import com.cf.imes.framework.common.util.monitor.TracerUtils;
|
||||||
@@ -99,9 +98,6 @@ public class GlobalExceptionHandler {
|
|||||||
if (ex instanceof HttpMessageNotReadableException) {
|
if (ex instanceof HttpMessageNotReadableException) {
|
||||||
return httpMessageNotReadableExceptionHandler(request, (HttpMessageNotReadableException) ex);
|
return httpMessageNotReadableExceptionHandler(request, (HttpMessageNotReadableException) ex);
|
||||||
}
|
}
|
||||||
if (ex instanceof PayException) {
|
|
||||||
return payExceptionHandler((PayException) ex);
|
|
||||||
}
|
|
||||||
return defaultExceptionHandler(request, ex);
|
return defaultExceptionHandler(request, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,18 +260,6 @@ public class GlobalExceptionHandler {
|
|||||||
return CommonResult.error(ex.getCode(), ex.getMessage());
|
return CommonResult.error(ex.getCode(), ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 支付异常 PayException
|
|
||||||
*
|
|
||||||
* @param ex
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@ExceptionHandler(value = PayException.class)
|
|
||||||
public CommonResult payExceptionHandler(PayException ex) {
|
|
||||||
log.error(String.format("==========[payExceptionHandler]==========,%s", ex));
|
|
||||||
return CommonResult.error(ex.getCode(), ex.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理数据库DuplicateKeyException,违反唯一约束异常
|
* 处理数据库DuplicateKeyException,违反唯一约束异常
|
||||||
*
|
*
|
||||||
|
|||||||
+4
-5
@@ -21,7 +21,6 @@ import com.cf.imes.framework.redis.constants.RedisKeyConstants;
|
|||||||
import com.cf.imes.framework.redis.util.RedisLockUtil;
|
import com.cf.imes.framework.redis.util.RedisLockUtil;
|
||||||
import com.cf.imes.module.system.controller.admin.funds.delay.vo.PreviouProductDelayRespVO;
|
import com.cf.imes.module.system.controller.admin.funds.delay.vo.PreviouProductDelayRespVO;
|
||||||
import com.cf.imes.module.system.controller.admin.pay.vo.PayOrderUnifiedReqDTO;
|
import com.cf.imes.module.system.controller.admin.pay.vo.PayOrderUnifiedReqDTO;
|
||||||
import com.cf.imes.framework.common.exception.PayException;
|
|
||||||
import com.cf.imes.framework.pay.core.enums.order.PayOrderStatusRespEnum;
|
import com.cf.imes.framework.pay.core.enums.order.PayOrderStatusRespEnum;
|
||||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import com.cf.imes.module.system.controller.admin.funds.products.vo.product.ProductProcessorRespVO;
|
import com.cf.imes.module.system.controller.admin.funds.products.vo.product.ProductProcessorRespVO;
|
||||||
@@ -208,7 +207,7 @@ public class PayOrderServiceImpl implements PayOrderService {
|
|||||||
if(e instanceof ServiceException) {
|
if(e instanceof ServiceException) {
|
||||||
throw (ServiceException) e;
|
throw (ServiceException) e;
|
||||||
} else {
|
} else {
|
||||||
throw new PayException(PAY_ORDER_SUBMIT_CHANNEL_ERROR);
|
throw new ServiceException(PAY_ORDER_SUBMIT_CHANNEL_ERROR);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
// 软件购买锁解锁
|
// 软件购买锁解锁
|
||||||
@@ -359,11 +358,11 @@ public class PayOrderServiceImpl implements PayOrderService {
|
|||||||
|
|
||||||
boolean paySuccess = PayOrderStatusRespEnum.SUCCESS.getStatus().equals(payOrderRespDTO.getStatus());
|
boolean paySuccess = PayOrderStatusRespEnum.SUCCESS.getStatus().equals(payOrderRespDTO.getStatus());
|
||||||
if (!paySuccess) {
|
if (!paySuccess) {
|
||||||
throw new PayException(PAY_ORDER_CHANNEL_QUERY_NOT_EXIST);
|
throw new ServiceException(PAY_ORDER_CHANNEL_QUERY_NOT_EXIST);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
log.error("渠道方查询支付订单异常", e);
|
log.error("渠道方查询支付订单异常", e);
|
||||||
throw new PayException(PAY_ORDER_CHANNEL_QUERY_NOT_EXIST);
|
throw new ServiceException(PAY_ORDER_CHANNEL_QUERY_NOT_EXIST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,7 +380,7 @@ public class PayOrderServiceImpl implements PayOrderService {
|
|||||||
this.notifyOrder(payOrderRespDTO);
|
this.notifyOrder(payOrderRespDTO);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
log.error("[parseOrderNotify][客户端({}) params({}) body({}) headers({}) 解析失败]", channelCode, params, body, headers, e);
|
log.error("[parseOrderNotify][客户端({}) params({}) body({}) headers({}) 解析失败]", channelCode, params, body, headers, e);
|
||||||
throw new PayException(PAY_ORDER_NOTIFY_DATA_PARSE_ERROR);
|
throw new ServiceException(PAY_ORDER_NOTIFY_DATA_PARSE_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
package com.cf.imes.module.system.service.pay.factory;
|
package com.cf.imes.module.system.service.pay.factory;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.cf.imes.framework.common.exception.PayException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.module.system.service.pay.factory.impl.alipay.AlipayPcPayHandler;
|
import com.cf.imes.module.system.service.pay.factory.impl.alipay.AlipayPcPayHandler;
|
||||||
import com.cf.imes.module.system.service.pay.factory.impl.AbstractPayHandler;
|
import com.cf.imes.module.system.service.pay.factory.impl.AbstractPayHandler;
|
||||||
import com.cf.imes.module.system.service.pay.factory.impl.wechat.WechatNativePayHandler;
|
import com.cf.imes.module.system.service.pay.factory.impl.wechat.WechatNativePayHandler;
|
||||||
@@ -36,7 +36,7 @@ public class PayHandlerFactory {
|
|||||||
public AbstractPayHandler getPayHandler(int channelCode) {
|
public AbstractPayHandler getPayHandler(int channelCode) {
|
||||||
PayChannelCodeEnum payChannelCodeEnum = PayChannelCodeEnum.fromType(channelCode);
|
PayChannelCodeEnum payChannelCodeEnum = PayChannelCodeEnum.fromType(channelCode);
|
||||||
if (ObjectUtil.isNull(payChannelCodeEnum)) {
|
if (ObjectUtil.isNull(payChannelCodeEnum)) {
|
||||||
throw new PayException(PAY_CHANNEL_NOT_SUPPORT);
|
throw new ServiceException(PAY_CHANNEL_NOT_SUPPORT);
|
||||||
}
|
}
|
||||||
switch (payChannelCodeEnum) {
|
switch (payChannelCodeEnum) {
|
||||||
// 支付宝电脑支付
|
// 支付宝电脑支付
|
||||||
@@ -46,7 +46,7 @@ public class PayHandlerFactory {
|
|||||||
case WECHAT_NATIVE:
|
case WECHAT_NATIVE:
|
||||||
return applicationContext.getBean(WechatNativePayHandler.class);
|
return applicationContext.getBean(WechatNativePayHandler.class);
|
||||||
default:
|
default:
|
||||||
throw new PayException(PAY_CHANNEL_NOT_SUPPORT);
|
throw new ServiceException(PAY_CHANNEL_NOT_SUPPORT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user