From 0bd7b2413ceab894133184e2f43dc25797c5d89b Mon Sep 17 00:00:00 2001 From: xhxu Date: Fri, 2 Jun 2023 10:56:30 +0800 Subject: [PATCH] //.. --- .../api/order/impl/TtWebOrderServiceImpl.java | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/api/order/impl/TtWebOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/douyin/web/api/order/impl/TtWebOrderServiceImpl.java index 8ca67e388..16bcaab86 100644 --- a/mallinkService/src/main/java/com/iformall/douyin/web/api/order/impl/TtWebOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/douyin/web/api/order/impl/TtWebOrderServiceImpl.java @@ -16,6 +16,8 @@ import com.iformall.douyin.web.api.order.TtWebOrderService; import com.iformall.douyin.web.api.order.TtWebPayService; import com.iformall.douyin.web.api.web.*; import com.iformall.douyin.web.bean.*; +import com.iformall.enums.EnumPayStatus; +import com.iformall.service.pay.service.pay.entity.PayQueryAdapterResult; import lombok.AllArgsConstructor; import me.chanjar.weixin.common.error.WxError; import me.chanjar.weixin.common.error.WxErrorException; @@ -48,8 +50,17 @@ public class TtWebOrderServiceImpl implements TtWebOrderService { public TtPayOrderQueryV2Result queryOrderV2(TtPayOrderQueryV2Request request) throws WxErrorException { final TtWebPostRequestExecutor executor = new TtWebPostRequestExecutor(this.service.getRequestHttp()); String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.QUERY_ORDER; - String result = this.service.execute(executor, apiUrl, GSON.toJson(request)); - return GSON.fromJson(result, TtPayOrderQueryV2Result.class); + + try{ + String result = this.service.execute(executor, apiUrl, GSON.toJson(request)); + return GSON.fromJson(result, TtPayOrderQueryV2Result.class); + }catch(WxErrorException e){ + //处理无订单 + if(e.getError() != null && e.getError().getErrorCode() == 2191002) { + return null; + } + throw e; + } } @Override @@ -60,8 +71,17 @@ public class TtWebOrderServiceImpl implements TtWebOrderService { request.setOrderId(StringUtils.trimToNull(orderId)); String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.QUERY_CPS; - String result = this.service.execute(executor, apiUrl, GSON.toJson(request)); - return GSON.fromJson(result, TtPayCpsOrderQueryV2Result.class); + try{ + String result = this.service.execute(executor, apiUrl, GSON.toJson(request)); + return GSON.fromJson(result, TtPayCpsOrderQueryV2Result.class); + }catch(WxErrorException e){ + //处理无订单 + if(e.getError() != null && e.getError().getErrorCode() == 2191002) { + return null; + } + throw e; + } + } @Override