Pre Merge pull request !230 from wuKong/fix(social)-应对支付回调与订单信息上传之间的时间差
commit
154f6ab130
|
|
@ -65,6 +65,8 @@ import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen;
|
import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen;
|
||||||
|
|
@ -371,6 +373,24 @@ public class SocialClientServiceImpl implements SocialClientService {
|
||||||
try {
|
try {
|
||||||
WxMaOrderShippingInfoBaseResponse response = service.getWxMaOrderShippingService().upload(request);
|
WxMaOrderShippingInfoBaseResponse response = service.getWxMaOrderShippingService().upload(request);
|
||||||
if (response.getErrCode() != 0) {
|
if (response.getErrCode() != 0) {
|
||||||
|
if (ObjUtil.equals(response.getErrCode(),10060001)) {
|
||||||
|
// 错误代码:10060001, 错误信息:支付单不存在
|
||||||
|
// 收到支付回调时同步订单到微信,很大概率会出现10060001
|
||||||
|
// 应对支付回调与订单信息上传之间的时间差
|
||||||
|
CompletableFuture.delayedExecutor(1000, TimeUnit.MILLISECONDS).execute(() -> {
|
||||||
|
try {
|
||||||
|
WxMaOrderShippingInfoBaseResponse delayedResponse = service.getWxMaOrderShippingService().upload(request);
|
||||||
|
if (delayedResponse.getErrCode() != 0) {
|
||||||
|
log.error("[uploadWxaOrderShippingInfo][上传微信小程序发货信息失败:request({}) response({})]", request, delayedResponse);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log.info("[uploadWxaOrderShippingInfo][上传微信小程序发货信息成功:request({}) response({})]", request, delayedResponse);
|
||||||
|
} catch (WxErrorException ex) {
|
||||||
|
log.error("[uploadWxaOrderShippingInfo][上传微信小程序发货信息失败:request({})]", request, ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
log.error("[uploadWxaOrderShippingInfo][上传微信小程序发货信息失败:request({}) response({})]", request, response);
|
log.error("[uploadWxaOrderShippingInfo][上传微信小程序发货信息失败:request({}) response({})]", request, response);
|
||||||
throw exception(SOCIAL_CLIENT_WEIXIN_MINI_APP_ORDER_UPLOAD_SHIPPING_INFO_ERROR, response.getErrMsg());
|
throw exception(SOCIAL_CLIENT_WEIXIN_MINI_APP_ORDER_UPLOAD_SHIPPING_INFO_ERROR, response.getErrMsg());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue