From 6b4af840f682ee2115ac6e1700e8f9e51c31e275 Mon Sep 17 00:00:00 2001 From: wangchaoxu Date: Thu, 24 Aug 2023 21:12:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B0=83=E7=94=A8DS=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E7=9B=B8=E5=85=B3=E5=B7=A5=E5=85=B7=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ms/api/DsRequestService.java | 12 ++++++------ .../main/java/com/ms/api/spi/DsRequestTemplate.java | 9 ++++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/DsRequestService.java b/ms-biz/src/main/java/com/ms/api/DsRequestService.java index 84dfecb4..a040f1f7 100644 --- a/ms-biz/src/main/java/com/ms/api/DsRequestService.java +++ b/ms-biz/src/main/java/com/ms/api/DsRequestService.java @@ -22,13 +22,13 @@ public class DsRequestService implements ExtensionServiceHandler handle(BaseRequest req) { - MultiValueMap params = new LinkedMultiValueMap(); - params.add("platform", "ddMicroApp"); + Map params = new HashMap(); + params.put("platform", "ddMicroApp"); - params.add("platformOrderId", "2332"); - params.add("shopId", "78327"); - params.add("operateInfo", "{\"userId\":\"2332\", \"ip\": \"123.21.123.123\"}"); - params.add("platformSkuId", "123232"); + params.put("platformOrderId", "2332"); + params.put("shopId", "78327"); + params.put("operateInfo", "{\"userId\":\"2332\", \"ip\": \"123.21.123.123\"}"); + params.put("platformSkuId", "123232"); try { String res = dsRequestTemplate.execute("/order/cancelPurchaseOrderRelate", params); log.info(res); diff --git a/ms-biz/src/main/java/com/ms/api/spi/DsRequestTemplate.java b/ms-biz/src/main/java/com/ms/api/spi/DsRequestTemplate.java index 3884adcf..336cf347 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/DsRequestTemplate.java +++ b/ms-biz/src/main/java/com/ms/api/spi/DsRequestTemplate.java @@ -8,6 +8,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.stereotype.Component; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; import org.springframework.util.StringUtils; import java.util.Arrays; @@ -61,18 +63,23 @@ public class DsRequestTemplate { Set keySet = data.keySet(); String[] keyArray = keySet.toArray(new String[0]); Arrays.sort(keyArray); + + MultiValueMap params = new LinkedMultiValueMap(); StringBuilder sb = new StringBuilder(); sb.append(dsToken); for (int i = 0; i < keyArray.length; i++) { if (String.valueOf(data.get(keyArray[i])).length() > 0) { sb.append(keyArray[i]).append(data.get(keyArray[i])); + params.add(keyArray[i], data.get(keyArray[i])); } } sb.append(dsToken); +log.info("sdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsd"); +log.info(sb.toString()); String sign = SecureUtil.md5(sb.toString()); headers.set("x-dd-micro-app-sign", sign); - return cloudRequestTemplate.executePost(dsHost + url, body, headers); + return cloudRequestTemplate.executePost(dsHost + url, params, headers); } }