From bee6fca3471aa069b702e02ab7ac72ac970249e7 Mon Sep 17 00:00:00 2001 From: qiushengjie Date: Tue, 29 Aug 2023 11:41:46 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E5=87=A0=E4=B8=AA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../callback/DsMessageCallbackService.java | 36 +++++++++++++++++++ .../MemberAuthCallback.java} | 6 ++-- .../spi/callback/OpenMsgConsumerService.java | 31 ++++++++++++++++ .../spi/callback/ShopAuthCallbackService.java | 36 +++++++++++++++++++ 4 files changed, 106 insertions(+), 3 deletions(-) create mode 100644 ms-biz/src/main/java/com/ms/api/spi/callback/DsMessageCallbackService.java rename ms-biz/src/main/java/com/ms/api/spi/{common/CallBackMessageService.java => callback/MemberAuthCallback.java} (81%) create mode 100644 ms-biz/src/main/java/com/ms/api/spi/callback/OpenMsgConsumerService.java create mode 100644 ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java diff --git a/ms-biz/src/main/java/com/ms/api/spi/callback/DsMessageCallbackService.java b/ms-biz/src/main/java/com/ms/api/spi/callback/DsMessageCallbackService.java new file mode 100644 index 00000000..aeb8f1ff --- /dev/null +++ b/ms-biz/src/main/java/com/ms/api/spi/callback/DsMessageCallbackService.java @@ -0,0 +1,36 @@ +package com.ms.api.spi.callback; + +import com.alibaba.fastjson.JSON; +import com.jinritemai.cloud.base.api.BaseRequest; +import com.jinritemai.cloud.base.api.BaseResponse; +import com.jinritemai.cloud.base.api.ExtensionService; +import com.jinritemai.cloud.base.api.ExtensionServiceHandler; +import com.ms.api.common.R; +import com.ms.api.common.SPIBaseService; +import com.ms.api.dto.auth.PlatformAuthCallBackRequestDTO; +import com.ms.api.tool.CommonTool; +import lombok.extern.slf4j.Slf4j; + +import java.util.Map; + +/** + * 1688分销采购单消息 + */ +@ExtensionService("dsMessageCallback") +@Slf4j +public class DsMessageCallbackService extends SPIBaseService implements ExtensionServiceHandler> { + + @Override + public BaseResponse> handle(BaseRequest req) { + // ----参数校验---- + PlatformAuthCallBackRequestDTO fields = req.getData(); + log.info("receive callback: " + JSON.toJSONString(fields)); + + // ----逻辑校验---- + + // ----业务处理---- + + // ----结果返回---- + return R.ok(CommonTool.successResult()); + } +} diff --git a/ms-biz/src/main/java/com/ms/api/spi/common/CallBackMessageService.java b/ms-biz/src/main/java/com/ms/api/spi/callback/MemberAuthCallback.java similarity index 81% rename from ms-biz/src/main/java/com/ms/api/spi/common/CallBackMessageService.java rename to ms-biz/src/main/java/com/ms/api/spi/callback/MemberAuthCallback.java index 7d630223..1a1baf32 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/common/CallBackMessageService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/callback/MemberAuthCallback.java @@ -1,4 +1,4 @@ -package com.ms.api.spi.common; +package com.ms.api.spi.callback; import com.alibaba.fastjson.JSON; import com.jinritemai.cloud.base.api.BaseRequest; @@ -16,9 +16,9 @@ import java.util.Map; /** * 获取授权1688授权回调地址 */ -@ExtensionService("callBackMessage") +@ExtensionService("memberAuthCallBack") @Slf4j -public class CallBackMessageService extends SPIBaseService implements ExtensionServiceHandler> { +public class MemberAuthCallback extends SPIBaseService implements ExtensionServiceHandler> { @Override public BaseResponse> handle(BaseRequest req) { diff --git a/ms-biz/src/main/java/com/ms/api/spi/callback/OpenMsgConsumerService.java b/ms-biz/src/main/java/com/ms/api/spi/callback/OpenMsgConsumerService.java new file mode 100644 index 00000000..5d8d3c56 --- /dev/null +++ b/ms-biz/src/main/java/com/ms/api/spi/callback/OpenMsgConsumerService.java @@ -0,0 +1,31 @@ +package com.ms.api.spi.callback; + +import com.alibaba.fastjson.JSON; +import com.jinritemai.cloud.base.api.BaseRequest; +import com.jinritemai.cloud.base.api.BaseResponse; +import com.jinritemai.cloud.base.api.ExtensionService; +import com.jinritemai.cloud.base.api.ExtensionServiceHandler; +import com.ms.api.common.R; +import com.ms.api.common.SPIBaseService; +import com.ms.api.dto.auth.PlatformAuthCallBackRequestDTO; +import lombok.extern.slf4j.Slf4j; + +import java.util.List; + +/** + * 抖店消息推送,固定的key:CloudOpenMsgConsumer + */ +@ExtensionService("CloudOpenMsgConsumer") +@Slf4j +public class OpenMsgConsumerService extends SPIBaseService implements ExtensionServiceHandler, Void> { + + @Override + public BaseResponse handle(BaseRequest> req) { + // ----参数校验---- + + // ----逻辑校验---- + + // ----业务处理---- + return R.ok(); + } +} diff --git a/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java b/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java new file mode 100644 index 00000000..7da035bb --- /dev/null +++ b/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java @@ -0,0 +1,36 @@ +package com.ms.api.spi.callback; + +import com.alibaba.fastjson.JSON; +import com.jinritemai.cloud.base.api.BaseRequest; +import com.jinritemai.cloud.base.api.BaseResponse; +import com.jinritemai.cloud.base.api.ExtensionService; +import com.jinritemai.cloud.base.api.ExtensionServiceHandler; +import com.ms.api.common.R; +import com.ms.api.common.SPIBaseService; +import com.ms.api.dto.auth.PlatformAuthCallBackRequestDTO; +import com.ms.api.tool.CommonTool; +import lombok.extern.slf4j.Slf4j; + +import java.util.Map; + +/** + * 抖店授权回调地址 + */ +@ExtensionService("shopAuthCallback") +@Slf4j +public class ShopAuthCallbackService extends SPIBaseService implements ExtensionServiceHandler> { + + @Override + public BaseResponse> handle(BaseRequest req) { + // ----参数校验---- + PlatformAuthCallBackRequestDTO fields = req.getData(); + log.info("receive callback: " + JSON.toJSONString(fields)); + + // ----逻辑校验---- + + // ----业务处理---- + + // ----结果返回---- + return R.ok(CommonTool.successResult()); + } +} From b4d150c6c4f4669f2ed6f3ccf38256f7fbce9b21 Mon Sep 17 00:00:00 2001 From: qiushengjie Date: Tue, 29 Aug 2023 11:43:46 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E5=A4=96=E9=83=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ms/api/DsTestJavaRequestService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java index b81f369c..2b68e2f3 100644 --- a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java +++ b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java @@ -35,10 +35,10 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler mapStringString = new HashMap<>(); - mapStringString.put("A","mapStringString1"); - mapStringString.put("B","mapStringString2"); - params.add("mapStringString", mapStringString); +// HashMap mapStringString = new HashMap<>(); +// mapStringString.put("A","mapStringString1"); +// mapStringString.put("B","mapStringString2"); +// params.add("mapStringString", mapStringString); // // List arrayInt64 = new ArrayList(); // arrayInt64.add(10000); From eab6a3abac95b7974fab874f3466ba3d61ad2e49 Mon Sep 17 00:00:00 2001 From: qiushengjie Date: Tue, 29 Aug 2023 12:42:41 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E5=A4=96=E9=83=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ms/api/DsTestJavaRequestService.java | 6 +++--- .../main/java/com/ms/api/tool/DsJsonRequestTemplate.java | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java index 2b68e2f3..dd958de6 100644 --- a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java +++ b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java @@ -28,7 +28,7 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler handle(BaseRequest req) { - MultiValueMap params = new UniqueKeyMultiValueMap<>(); + HashMap params = new HashMap<>(); // List arrayString = new ArrayList(); // arrayString.add("arrayString1"); @@ -38,7 +38,7 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler mapStringString = new HashMap<>(); // mapStringString.put("A","mapStringString1"); // mapStringString.put("B","mapStringString2"); -// params.add("mapStringString", mapStringString); +// params.put("mapStringString", mapStringString); // // List arrayInt64 = new ArrayList(); // arrayInt64.add(10000); @@ -49,7 +49,7 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler params = (UniqueKeyMultiValueMap)body; + HashMap params = (HashMap)body; // 构建签名 Set keySet = params.keySet(); String[] keyArray = keySet.toArray(new String[0]); @@ -69,7 +68,7 @@ public class DsJsonRequestTemplate { StringBuilder sb = new StringBuilder(); sb.append(dsToken); for (String s : keyArray) { - sb.append(s).append(JSON.toJSONString(params.getFirst(s))); + sb.append(s).append(JSON.toJSONString(params.get(s))); } sb.append(dsToken); String sign = SecureUtil.md5(sb.toString()); From ffca1ee7ec04b9fa6beb602318d3b9552b17c382 Mon Sep 17 00:00:00 2001 From: qiushengjie Date: Tue, 29 Aug 2023 13:25:04 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E5=A4=96=E9=83=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ms/api/DsTestJavaRequestService.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java index dd958de6..4b0af615 100644 --- a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java +++ b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java @@ -14,7 +14,9 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.MultiValueMap; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; @ExtensionService("dsTestJavaRequest") @Slf4j @@ -30,10 +32,10 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler handle(BaseRequest req) { HashMap params = new HashMap<>(); -// List arrayString = new ArrayList(); -// arrayString.add("arrayString1"); -// arrayString.add("arrayString2"); -// params.add("arrayString", JSON.toJSONString(arrayString)); + List arrayString = new ArrayList<>(); + arrayString.add("arrayString1"); + arrayString.add("arrayString2"); + params.put("arrayString", arrayString); // HashMap mapStringString = new HashMap<>(); // mapStringString.put("A","mapStringString1"); From 7b227b9c9ce86690e7aa27a8159a40aa11e18ee5 Mon Sep 17 00:00:00 2001 From: qiushengjie Date: Tue, 29 Aug 2023 13:44:49 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E5=A4=96=E9=83=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ms/api/DsTestJavaRequestService.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java index 4b0af615..3c29549a 100644 --- a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java +++ b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java @@ -37,7 +37,7 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler mapStringString = new HashMap<>(); +// HashMap mapStringString = new HashMap<>(); // mapStringString.put("A","mapStringString1"); // mapStringString.put("B","mapStringString2"); // params.put("mapStringString", mapStringString); @@ -47,10 +47,10 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler Date: Tue, 29 Aug 2023 14:12:46 +0800 Subject: [PATCH 06/16] =?UTF-8?q?=E5=A4=96=E9=83=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ms/api/DsTestJavaRequestService.java | 2 +- .../com/ms/api/spi/callback/ShopAuthCallbackService.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java index 3c29549a..6cb46fe9 100644 --- a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java +++ b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java @@ -50,7 +50,7 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler> { +public class ShopAuthCallbackService extends SPIBaseService implements ExtensionServiceHandler> { @Override - public BaseResponse> handle(BaseRequest req) { + public BaseResponse> handle(BaseRequest req) { // ----参数校验---- - PlatformAuthCallBackRequestDTO fields = req.getData(); + log.info("receive callback: " + JSON.toJSONString(req)); + Object fields = req.getData(); log.info("receive callback: " + JSON.toJSONString(fields)); // ----逻辑校验---- From 49836990fbe82dd6629daf13e4334314a6716d1f Mon Sep 17 00:00:00 2001 From: qiushengjie Date: Tue, 29 Aug 2023 14:15:44 +0800 Subject: [PATCH 07/16] =?UTF-8?q?=E5=A4=96=E9=83=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java index 6cb46fe9..f4d395de 100644 --- a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java +++ b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java @@ -45,14 +45,14 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler(); // arrayInt64.add(10000); // arrayInt64.add(10000); -// params.add("arrayInt64", JSON.toJSONString(arrayInt64)); +// params.add("arrayInt64", arrayInt64); // params.put("int16", 10000); params.put("int32", 10000); params.put("int64", 10000); // params.put("double", 10.1); params.put("string", "test"); -// params.put("boolean", JSON.toJSONString(true)); +// params.put("boolean", true); // params.put("struct", ); // params.put("arrayStruct", ); From 4d3d6ef1dfb442f62855916f77e59078c0a0f93b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cxxxxxxx=E8=AF=A6?= <286460656@qq.com> Date: Tue, 29 Aug 2023 15:45:25 +0800 Subject: [PATCH 08/16] =?UTF-8?q?=E5=A4=96=E9=83=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java index f4d395de..df0dbb53 100644 --- a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java +++ b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java @@ -49,7 +49,7 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler Date: Tue, 29 Aug 2023 15:53:19 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=E5=A4=96=E9=83=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ms/api/DsTestJavaRequestService.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java index df0dbb53..247cd67d 100644 --- a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java +++ b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java @@ -42,14 +42,14 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler(); -// arrayInt64.add(10000); -// arrayInt64.add(10000); -// params.add("arrayInt64", arrayInt64); + List arrayInt64 = new ArrayList(); + arrayInt64.add(10000); + arrayInt64.add(10000); + params.put("arrayInt64", arrayInt64); // params.put("int16", 10000); params.put("int32", 10000); -// params.put("int64", 10000); + params.put("int64", 10000); // params.put("double", 10.1); params.put("string", "test"); // params.put("boolean", true); From 99d292b8248ecb2610ef75ef2fa8594a0f365e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cxxxxxxx=E8=AF=A6?= <286460656@qq.com> Date: Tue, 29 Aug 2023 16:18:24 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E5=A4=96=E9=83=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ms/api/DsTestJavaRequestService.java | 8 ++++---- .../ms/api/spi/callback/ShopAuthCallbackService.java | 11 ++++++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java index 247cd67d..eb7e3484 100644 --- a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java +++ b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java @@ -37,10 +37,10 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler mapStringString = new HashMap<>(); -// mapStringString.put("A","mapStringString1"); -// mapStringString.put("B","mapStringString2"); -// params.put("mapStringString", mapStringString); + HashMap mapStringString = new HashMap<>(); + mapStringString.put("A","mapStringString1"); + mapStringString.put("B","mapStringString2"); + params.put("mapStringString", mapStringString); // List arrayInt64 = new ArrayList(); arrayInt64.add(10000); diff --git a/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java b/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java index a2348481..6b5851bd 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java @@ -1,6 +1,9 @@ package com.ms.api.spi.callback; import com.alibaba.fastjson.JSON; +import com.doudian.open.api.token_create.TokenCreateRequest; +import com.doudian.open.api.token_create.TokenCreateResponse; +import com.doudian.open.api.token_create.param.TokenCreateParam; import com.jinritemai.cloud.base.api.BaseRequest; import com.jinritemai.cloud.base.api.BaseResponse; import com.jinritemai.cloud.base.api.ExtensionService; @@ -27,8 +30,14 @@ public class ShopAuthCallbackService extends SPIBaseService implements Extension Object fields = req.getData(); log.info("receive callback: " + JSON.toJSONString(fields)); - // ----逻辑校验---- + // ----逻辑校验---- + TokenCreateRequest request = new TokenCreateRequest(); + TokenCreateParam param = request.getParam(); + param.setCode("82bdc687-eff1-4f63-8444-0b43086c25fd"); + param.setGrantType("authorization_code"); + TokenCreateResponse response = request.execute(); + log.info("receive callback: " + response.getData()); // ----业务处理---- // ----结果返回---- From ee64c0ec4bd9e0513dae45e8a1b2ecf8a57e841e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cxxxxxxx=E8=AF=A6?= <286460656@qq.com> Date: Tue, 29 Aug 2023 16:54:14 +0800 Subject: [PATCH 11/16] 1 --- ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java index eb7e3484..dcc54de4 100644 --- a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java +++ b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java @@ -50,7 +50,7 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler Date: Tue, 29 Aug 2023 17:05:32 +0800 Subject: [PATCH 12/16] =?UTF-8?q?=E5=A4=96=E9=83=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ms/api/DsTestJavaRequestService.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java index dcc54de4..d710610b 100644 --- a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java +++ b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java @@ -41,18 +41,17 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler arrayInt64 = new ArrayList(); + + List arrayInt64 = new ArrayList<>(); arrayInt64.add(10000); arrayInt64.add(10000); params.put("arrayInt64", arrayInt64); -// + params.put("int16", 10000); params.put("int32", 10000); params.put("int64", 10000); - params.put("double", 10.1); +// params.put("double", 10.1); params.put("string", "test"); -// params.put("boolean", true); // params.put("struct", ); // params.put("arrayStruct", ); From 06c85ba02ea3fdc7aa7d636128efb10de2260b5f Mon Sep 17 00:00:00 2001 From: qiushengjie Date: Tue, 29 Aug 2023 17:23:58 +0800 Subject: [PATCH 13/16] =?UTF-8?q?=E5=A4=96=E9=83=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ms/api/DsTestJavaRequestService.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java index d710610b..4d98400d 100644 --- a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java +++ b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java @@ -7,6 +7,7 @@ import com.jinritemai.cloud.base.api.ExtensionService; import com.jinritemai.cloud.base.api.ExtensionServiceHandler; import com.ms.api.common.R; import com.ms.api.dto.ItemDTO; +import com.ms.api.dto.move.GetCurrentShopMoveSettingRequestDTO; import com.ms.api.tool.DsFormRequestTemplate; import com.ms.api.common.UniqueKeyMultiValueMap; import com.ms.api.tool.DsJsonRequestTemplate; @@ -50,10 +51,19 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler struct = new HashMap<>(); +// struct.put("A",mapStringString); +// struct.put("B",arrayString); +// struct.put("C",10000); +// struct.put("D","test"); +// params.put("struct", struct); + + +// params.put("struct", new GetCurrentShopMoveSettingRequestDTO()); + // params.put("arrayStruct", ); // params.put("mapStringStruct", ); From 9135154c3e3367e06ba1e0621b091519b201cdb3 Mon Sep 17 00:00:00 2001 From: qiushengjie Date: Tue, 29 Aug 2023 17:56:13 +0800 Subject: [PATCH 14/16] =?UTF-8?q?=E5=A4=96=E9=83=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java index 4d98400d..a9716996 100644 --- a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java +++ b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java @@ -51,7 +51,7 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler struct = new HashMap<>(); @@ -62,7 +62,7 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler Date: Tue, 29 Aug 2023 18:17:55 +0800 Subject: [PATCH 15/16] =?UTF-8?q?=E5=A4=96=E9=83=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ms/api/DsTestJavaRequestService.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java index a9716996..92cda5e8 100644 --- a/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java +++ b/ms-biz/src/main/java/com/ms/api/DsTestJavaRequestService.java @@ -7,7 +7,10 @@ import com.jinritemai.cloud.base.api.ExtensionService; import com.jinritemai.cloud.base.api.ExtensionServiceHandler; import com.ms.api.common.R; import com.ms.api.dto.ItemDTO; +import com.ms.api.dto.move.GetChoicenessSourceItemTagRequestDTO; import com.ms.api.dto.move.GetCurrentShopMoveSettingRequestDTO; +import com.ms.api.dto.move.GetMoveHistoryProductListRequestDTO; +import com.ms.api.dto.move.SaveBatchMoveTaskRequestDTO; import com.ms.api.tool.DsFormRequestTemplate; import com.ms.api.common.UniqueKeyMultiValueMap; import com.ms.api.tool.DsJsonRequestTemplate; @@ -15,9 +18,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.MultiValueMap; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; +import java.util.*; @ExtensionService("dsTestJavaRequest") @Slf4j @@ -54,18 +55,19 @@ public class DsTestJavaRequestService implements ExtensionServiceHandler struct = new HashMap<>(); -// struct.put("A",mapStringString); -// struct.put("B",arrayString); -// struct.put("C",10000); -// struct.put("D","test"); -// params.put("struct", struct); - - params.put("struct", new GetCurrentShopMoveSettingRequestDTO()); -// params.put("arrayStruct", ); -// params.put("mapStringStruct", ); + List arrayStruct = new LinkedList<>(); + arrayStruct.add(new GetCurrentShopMoveSettingRequestDTO()); + arrayStruct.add(new GetMoveHistoryProductListRequestDTO()); + arrayStruct.add(new SaveBatchMoveTaskRequestDTO()); + params.put("arrayStruct", arrayStruct); + + Map mapStringStruct = new HashMap<>(); + mapStringStruct.put("mapstruct1", new GetCurrentShopMoveSettingRequestDTO()); + mapStringStruct.put("mapstruct2", new GetMoveHistoryProductListRequestDTO()); + mapStringStruct.put("mapstruct3", new SaveBatchMoveTaskRequestDTO()); + params.put("mapStringStruct", mapStringStruct); String res = null; try { From ddd08c9a99626379dbaf60f48d93fccbd9832128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cxxxxxxx=E8=AF=A6?= <286460656@qq.com> Date: Tue, 29 Aug 2023 18:39:00 +0800 Subject: [PATCH 16/16] =?UTF-8?q?=E6=8E=88=E6=9D=83=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- .../spi/callback/ShopAuthCallbackService.java | 35 +++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 20127e45..cebd0154 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ curl --location --request POST 'localhost:8080/base/cloud/spi' \ --data-raw '{ "appId":"123456", "authId":"888999", -"method":"dsTestJavaRequest", +"method":"shopAuthCallback", "data":"{\"userId\":\"30459766\",\"\":\"\"}" }' diff --git a/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java b/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java index 6b5851bd..00da691a 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java @@ -3,6 +3,7 @@ package com.ms.api.spi.callback; import com.alibaba.fastjson.JSON; import com.doudian.open.api.token_create.TokenCreateRequest; import com.doudian.open.api.token_create.TokenCreateResponse; +import com.doudian.open.api.token_create.data.TokenCreateData; import com.doudian.open.api.token_create.param.TokenCreateParam; import com.jinritemai.cloud.base.api.BaseRequest; import com.jinritemai.cloud.base.api.BaseResponse; @@ -11,8 +12,11 @@ import com.jinritemai.cloud.base.api.ExtensionServiceHandler; import com.ms.api.common.R; import com.ms.api.common.SPIBaseService; import com.ms.api.dto.auth.PlatformAuthCallBackRequestDTO; +import com.ms.api.service.ShopService; import com.ms.api.tool.CommonTool; +import com.ms.dal.entity.Shop; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import java.util.Map; @@ -23,6 +27,9 @@ import java.util.Map; @Slf4j public class ShopAuthCallbackService extends SPIBaseService implements ExtensionServiceHandler> { + @Autowired + private ShopService shopService; + @Override public BaseResponse> handle(BaseRequest req) { // ----参数校验---- @@ -34,10 +41,34 @@ public class ShopAuthCallbackService extends SPIBaseService implements Extension // ----逻辑校验---- TokenCreateRequest request = new TokenCreateRequest(); TokenCreateParam param = request.getParam(); - param.setCode("82bdc687-eff1-4f63-8444-0b43086c25fd"); + param.setCode("df020f1c-37ed-41b5-8341-85d3d3b02250"); param.setGrantType("authorization_code"); + log.info("receive callback: " + JSON.toJSONString(param)); TokenCreateResponse response = request.execute(); - log.info("receive callback: " + response.getData()); + TokenCreateData data = new TokenCreateData(); + data = response.getData(); + Long shopId = data.getShopId(); + String accessToken = data.getAccessToken(); + Long expiresIn = data.getExpiresIn(); + String shopName = data.getShopName(); + String refreshToken = data.getRefreshToken(); + Shop shop = shopService.getDetailById(shopId); + if (shop == null) { + shop = new Shop(); + shop.setShopId(shopId); + // shop.setAccessToken(accessToken); // 加密 + // shop.setRefreshToken(refreshToken); // 加密 + shop.setExpiresIn(expiresIn.toString()); + shop.setShopName(shopName); + shopService.insert(shop); + } else { + // shop.setAccessToken(accessToken); // 加密 + // shop.setRefreshToken(refreshToken); // 加密 + shopService.updateByPrimaryKey(shop); + } + + + // log.info("receive callback: " + JSON.toJSONString(response.getData())); // ----业务处理---- // ----结果返回----