catchException 避免商户通知时http连接异常导致不再发送;

This commit is contained in:
terrfly 2021-07-27 16:09:01 +08:00
parent eb1c12bd54
commit bafce0624b

View File

@ -15,6 +15,7 @@
*/
package com.jeequan.jeepay.pay.mq;
import cn.hutool.core.net.url.UrlBuilder;
import cn.hutool.http.HttpException;
import cn.hutool.http.HttpUtil;
import com.jeequan.jeepay.components.mq.model.PayOrderMchNotifyMQ;
@ -68,8 +69,9 @@ public class PayOrderMchNotifyMQReceiver implements PayOrderMchNotifyMQ.IMQRecei
String res = "";
try {
res = HttpUtil.createPost(notifyUrl).timeout(20000).execute().body();
} catch (HttpException e) {
} catch (Exception e) {
log.error("http error", e);
res = "连接["+ UrlBuilder.of(notifyUrl).getHost() +"]异常:【" + e.getMessage() + "";
}
if(currentCount == 1){ //第一次通知: 更新为已通知
@ -93,11 +95,11 @@ public class PayOrderMchNotifyMQReceiver implements PayOrderMchNotifyMQ.IMQRecei
// 通知延时次数
// 1 2 3 4 5 6
// 0 30 60 90 120 150
mqSender.send(PayOrderMchNotifyMQ.build(notifyId), currentCount * 30 * 1000);
mqSender.send(PayOrderMchNotifyMQ.build(notifyId), currentCount * 30);
return;
}catch (Exception e) {
log.error(e.getMessage());
log.error(e.getMessage(), e);
return;
}
}