From 317ccada3683e9dda4129a53301babd01485c9d9 Mon Sep 17 00:00:00 2001 From: wzkris <1439804473@qq.com> Date: Fri, 30 Aug 2024 10:21:46 +0000 Subject: [PATCH] =?UTF-8?q?:bug:=E3=80=90=E5=BE=AE=E4=BF=A1=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E3=80=91=E4=BF=AE=E5=A4=8D=E5=95=86=E5=AE=B6=E8=BD=AC?= =?UTF-8?q?=E8=B4=A6=E5=88=B0=E9=9B=B6=E9=92=B1-=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=89=B9=E6=AC=A1=E5=8D=95needQueryDetail=E4=B8=BAfalse?= =?UTF-8?q?=E6=97=B6=E9=9D=9E=E5=BF=85=E4=BC=A0=E5=8F=82=E6=95=B0=E4=B8=BA?= =?UTF-8?q?null=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/TransferServiceImpl.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/TransferServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/TransferServiceImpl.java index b328ded73..749551b12 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/TransferServiceImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/TransferServiceImpl.java @@ -38,8 +38,15 @@ public class TransferServiceImpl implements TransferService { @Override public QueryTransferBatchesResult transferBatchesBatchId(QueryTransferBatchesRequest request) throws WxPayException { - String url = String.format("%s/v3/transfer/batches/batch-id/%s?need_query_detail=%s&offset=%s&limit=%s&detail_status=%s", - this.payService.getPayBaseUrl(), request.getBatchId(), request.getNeedQueryDetail(), request.getOffset(), request.getLimit(), request.getDetailStatus()); + String url; + if (request.getNeedQueryDetail()) { + url = String.format("%s/v3/transfer/batches/batch-id/%s?need_query_detail=true&offset=%s&limit=%s&detail_status=%s", + this.payService.getPayBaseUrl(), request.getBatchId(), request.getOffset(), request.getLimit(), request.getDetailStatus()); + } + else { + url = String.format("%s/v3/transfer/batches/batch-id/%s?need_query_detail=false", + this.payService.getPayBaseUrl(), request.getBatchId()); + } String result = this.payService.getV3(url); return GSON.fromJson(result, QueryTransferBatchesResult.class); } @@ -53,8 +60,15 @@ public class TransferServiceImpl implements TransferService { @Override public QueryTransferBatchesResult transferBatchesOutBatchNo(QueryTransferBatchesRequest request) throws WxPayException { - String url = String.format("%s/v3/transfer/batches/out-batch-no/%s?need_query_detail=%s&offset=%s&limit=%s&detail_status=%s", - this.payService.getPayBaseUrl(), request.getOutBatchNo(), request.getNeedQueryDetail(), request.getOffset(), request.getLimit(), request.getDetailStatus()); + String url; + if (request.getNeedQueryDetail()) { + url = String.format("%s/v3/transfer/batches/out-batch-no/%s?need_query_detail=true&offset=%s&limit=%s&detail_status=%s", + this.payService.getPayBaseUrl(), request.getOutBatchNo(), request.getOffset(), request.getLimit(), request.getDetailStatus()); + } + else { + url = String.format("%s/v3/transfer/batches/out-batch-no/%s?need_query_detail=false", + this.payService.getPayBaseUrl(), request.getOutBatchNo()); + } String result = this.payService.getV3(url); return GSON.fromJson(result, QueryTransferBatchesResult.class); }