| @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.enums.EnumPayVersion; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.exception.BizMessageException; | |||
| import com.iformall.exception.BizException; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.pay.WxPayment; | |||
| import com.iformall.service.MailService; | |||
| @@ -83,7 +83,7 @@ public class WxPayBillController extends BaseController { | |||
| String response = wxPayBillService.notify(getTenantId(attach),paramMap, EnumPayWay.PAY_WAY_WECHAT); | |||
| logger.info("微信支付回调, notify success, req : " + resultxml + ", resp: " + response.toString()); | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| } catch (BizException e) { | |||
| if (paramMap == null) { | |||
| logger.error("微信支付回调, order create error, e: " + e.getMessage()); | |||
| } else { | |||
| @@ -136,7 +136,7 @@ public class WxPayBillController extends BaseController { | |||
| response = wxRefundOrderService.notify(paramMap, EnumPayWay.PAY_WAY_WECHAT,EnumPayVersion.WX_PAY_V2); | |||
| logger.info("refund wxpay, notify success, req : " + xml + ", resp: " + response.toString()); | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| } catch (BizException e) { | |||
| logger.error("refund wxpay, notify error, req: " + xml + ", e:" + e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| @@ -185,7 +185,7 @@ public class WxPayBillController extends BaseController { | |||
| // response = wxPayBillService.notify(paramMap, EnumPayWay.PAY_WAY_WECHAT); | |||
| logger.info("share wxpay, notify success, req : " + xml + ", resp: " + response.toString()); | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| } catch (BizException e) { | |||
| logger.error("share wxpay, notify error, req: " + xml + ", e:" + e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| @@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.msg.FmInsideNotifyRefundSuccessMsg; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.BizMessageException; | |||
| import com.iformall.exception.BizException; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.pay.WxPayment; | |||
| @@ -165,7 +165,7 @@ public class WxPayController extends BaseController { | |||
| logger.info("refund wxpay, notify success, req : " + xml + ", resp: " + response.toString()); | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| } catch (BizException e) { | |||
| logger.error("refund wxpay, notify error, req: " + xml + ", e:" + e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| @@ -230,7 +230,7 @@ public class WxPayController extends BaseController { | |||
| logger.info("refund wxpay, notify success, req : " + json + ", resp: " + response.toString()); | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| } catch (BizException e) { | |||
| logger.error("refund wxpay, notify error, req: " + json + ", e:" + e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("code", "FAIL"); | |||
| @@ -279,7 +279,7 @@ public class WxPayController extends BaseController { | |||
| // response = wxPayOrderService.shareNotify(paramMap, EnumPayWay.PAY_WAY_WECHAT,EnumPayVersion.WX_PAY_V2); | |||
| logger.info("share wxpay, notify success, req : " + xml + ", resp: " + response.toString()); | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| } catch (BizException e) { | |||
| logger.error("share wxpay, notify error, req: " + xml + ", e:" + e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| @@ -319,7 +319,7 @@ public class WxPayController extends BaseController { | |||
| response = wxPayOrderService.shareNotify(paramMap, EnumPayWay.PAY_WAY_WECHAT,EnumPayVersion.WX_PAY_V3); | |||
| logger.info("share wxpay, notify success, req : " + xml + ", resp: " + response.toString()); | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| } catch (BizException e) { | |||
| logger.error("share wxpay, notify error, req: " + xml + ", e:" + e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("code", "FAIL"); | |||
| @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON; | |||
| import com.iformall.controller.callback.car.WxParkCallBackBaseController; | |||
| import com.iformall.domain.po.msg.FmInsideNotifyCarPaidSuccessMsg; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.BizMessageException; | |||
| import com.iformall.exception.BizException; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.pay.WxPayment; | |||
| @@ -101,7 +101,7 @@ public class WxCarPaidCallBackController extends WxParkCallBackBaseController { | |||
| logger.info("carPaid wxpay, notify success, req : " + xml + ", resp: " + response.toString()); | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| } catch (BizException e) { | |||
| logger.error("carPaid wxpay, notify error, req: " + xml + ", e:" + e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.common; | |||
| import com.iformall.exception.BizException; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.MailService; | |||
| import org.apache.shiro.authz.AuthorizationException; | |||
| @@ -71,17 +72,23 @@ public class GlobalDefultExceptionHandler { | |||
| } | |||
| } | |||
| @ResponseBody | |||
| @ExceptionHandler(value = BizException.class) | |||
| public ResultData bizExceptionHandler(BizException e, HttpServletRequest request) { | |||
| log(e, request); | |||
| return new ResultData(e.getCode(), e.getMsg()); | |||
| } | |||
| private void log(Exception ex, HttpServletRequest request) { | |||
| logger.error("************************异常开始*******************************"); | |||
| if(checkExceptionType(ex)) { | |||
| // 特殊异常不打印堆栈 | |||
| logger.error(ex.getMessage()); | |||
| logger.error("message:"+ ex); | |||
| logger.error("************************异常结束*******************************"); | |||
| return; | |||
| } | |||
| logger.error("请求地址:" + request.getRequestURL()); | |||
| logger.error("message:"+ ex.getMessage()); | |||
| logger.error("message:"+ ex); | |||
| Enumeration enumeration = request.getParameterNames(); | |||
| logger.error("请求参数"); | |||
| while (enumeration.hasMoreElements()) { | |||
| @@ -0,0 +1,34 @@ | |||
| package com.iformall.exception; | |||
| import com.iformall.common.ErrorCode; | |||
| /** | |||
| * 业务异常,该异常不发送邮件 | |||
| * @author xmzhao71 | |||
| * @date 2023-09-12 | |||
| */ | |||
| public class BizException extends RuntimeException { | |||
| private int code; | |||
| private String msg; | |||
| public BizException(int code, String msg) { | |||
| super(msg); | |||
| this.code = code; | |||
| this.msg = msg; | |||
| } | |||
| public BizException(ErrorCode errCode) { | |||
| super(errCode.getMessage()); | |||
| this.code = errCode.getCode(); | |||
| this.msg = errCode.getMessage(); | |||
| } | |||
| public int getCode() { | |||
| return code; | |||
| } | |||
| public String getMsg() { | |||
| return msg; | |||
| } | |||
| } | |||
| @@ -1,14 +0,0 @@ | |||
| package com.iformall.exception; | |||
| /** | |||
| * Created by Stormeye on 2018/8/10. | |||
| */ | |||
| public class BizMessageException extends RuntimeException { | |||
| public BizMessageException() { | |||
| super(); | |||
| } | |||
| public BizMessageException(String bizMessage) { | |||
| super(bizMessage); | |||
| } | |||
| } | |||
| @@ -13,8 +13,6 @@ import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.GetMessageChannelVO; | |||
| import com.iformall.enums.EnumMsgModelStatus; | |||
| import com.iformall.enums.EnumVerifyCode; | |||
| import com.iformall.exception.BizMessageException; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxMsgConfigMapper; | |||
| import com.iformall.mapper.WxMsgModelMapper; | |||
| import com.iformall.service.WxMsgModelService; | |||