refactor: Update pathParams

This commit is contained in:
felord
2021-06-05 13:28:37 +08:00
parent 53a34e6a71
commit 60fe80e615
2 changed files with 13 additions and 13 deletions

View File

@@ -140,13 +140,13 @@ public class WechatBatchTransferApi extends AbstractApi {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>(); WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.BATCH_TRANSFER_DETAIL_WECHAT, queryBatchTransferDetailParams) this.client().withType(WechatPayV3Type.BATCH_TRANSFER_DETAIL_WECHAT, queryBatchTransferDetailParams)
.function((type, params) -> { .function((type, params) -> {
Map<String, String> queryParams = new HashMap<>(2); Map<String, String> pathParams = new HashMap<>(2);
queryParams.put("batch_id", params.getBatchIdOrOutBatchNo()); pathParams.put("batch_id", params.getBatchIdOrOutBatchNo());
queryParams.put("detail_id", params.getDetailIdOrOutDetailNo()); pathParams.put("detail_id", params.getDetailIdOrOutDetailNo());
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA)) URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
.build() .build()
.expand(queryParams) .expand(pathParams)
.toUri(); .toUri();
return Get(uri); return Get(uri);
}) })
@@ -195,13 +195,13 @@ public class WechatBatchTransferApi extends AbstractApi {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>(); WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.BATCH_TRANSFER_DETAIL_MCH, queryBatchTransferDetailParams) this.client().withType(WechatPayV3Type.BATCH_TRANSFER_DETAIL_MCH, queryBatchTransferDetailParams)
.function((type, params) -> { .function((type, params) -> {
Map<String, String> queryParams = new HashMap<>(2); Map<String, String> pathParams = new HashMap<>(2);
queryParams.put("batch_id", params.getBatchIdOrOutBatchNo()); pathParams.put("batch_id", params.getBatchIdOrOutBatchNo());
queryParams.put("detail_id", params.getDetailIdOrOutDetailNo()); pathParams.put("detail_id", params.getDetailIdOrOutDetailNo());
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA)) URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
.build() .build()
.expand(queryParams) .expand(pathParams)
.toUri(); .toUri();
return Get(uri); return Get(uri);
}) })

View File

@@ -65,14 +65,14 @@ public class WechatPayScoreApi extends AbstractApi {
.function((wechatPayV3Type, userServiceStateParams) -> { .function((wechatPayV3Type, userServiceStateParams) -> {
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3(); WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
Map<String, String> expandParams = new HashMap<>(3); Map<String, String> pathParams = new HashMap<>(3);
expandParams.put("appid", v3.getAppId()); pathParams.put("appid", v3.getAppId());
expandParams.put("service_id", params.getServiceId()); pathParams.put("service_id", params.getServiceId());
expandParams.put("openid", params.getOpenId()); pathParams.put("openid", params.getOpenId());
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA)) URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
.build() .build()
.expand(expandParams) .expand(pathParams)
.toUri(); .toUri();
return Get(uri); return Get(uri);
}) })