From ddc709ede4f9611670c95a7358f2699592ace7ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=AD=E5=A6=82?= <8775@163.com> Date: Sun, 2 Feb 2025 15:51:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Erestful=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 5 +- .../example-payment/payment-api/pom.xml | 16 + .../gitee/sop/payment/api/PaymentService.java | 7 + .../{ => payment-service}/.gitignore | 0 .../example-payment/payment-service/pom.xml | 128 +++++ .../{ => payment-service}/push-doc.sh | 0 .../payment/ExamplePaymentApplication.java | 0 .../gitee/sop/payment/open/OpenPayment.java | 0 .../payment/open/impl/OpenPaymentImpl.java | 20 +- .../open/req/PayOrderSearchRequest.java | 5 +- .../open/req/PayTradeWapPayRequest.java | 0 .../open/resp/PayOrderSearchResponse.java | 35 ++ .../open/resp/PayTradeWapPayResponse.java | 0 .../main/resources/application-dev.properties | 0 .../resources/application-test.properties | 0 .../src/main/resources/application.properties | 10 + .../src/main/resources/doc.json | 0 .../resources/i18n/isp/bizerror_en.properties | 0 .../i18n/isp/bizerror_zh_CN.properties | 0 .../i18n/isp/goods_error_en.properties | 0 .../i18n/isp/goods_error_zh_CN.properties | 0 .../src/main/resources/smart-doc.json | 0 .../com/gitee/sop/payment/DocPushTest.java | 0 sop-example/example-payment/pom.xml | 120 +--- .../open/resp/PayOrderSearchResponse.java | 23 - sop-example/example-product/pom.xml | 16 + .../example-product/product-api/pom.xml | 16 + .../gitee/sop/story/api/ProductService.java | 12 + .../sop/story/api/resp/ProductResult.java | 51 ++ .../product-service}/.gitignore | 0 .../product-service}/pom.xml | 10 +- .../ExampleProductApplication.java} | 6 +- .../productweb}/message/StoryMessageEnum.java | 2 +- .../sop/productweb/open/OpenProduct.java | 92 +++ .../open/impl/OpenProductImpl.java} | 59 +- .../open/req/ProductSaveRequest.java} | 7 +- .../open/resp/ProductResponse.java} | 4 +- .../productweb/rpc/ProductServiceImpl.java | 28 + .../main/resources/application-dev.properties | 0 .../resources/application-test.properties | 0 .../src/main/resources/application.properties | 2 +- .../src/main/resources/doc.json | 0 .../src/main/resources/download.txt | 0 .../resources/i18n/bizerror_en.properties | 0 .../resources/i18n/bizerror_zh_CN.properties | 0 .../src/main/resources/smart-doc.json | 0 .../gitee/sop/productweb}/DocPushTest.java | 2 +- sop-example/example-rest/.gitignore | 33 ++ sop-example/example-rest/pom.xml | 133 +++++ .../examplerest/ExampleRestApplication.java | 15 + .../examplerest/rest/GoodsController.java | 16 + .../rest/impl/GoodsControllerImpl.java | 20 + .../rest/examplerest/rest/vo/GoodsVO.java | 15 + .../main/resources/application-dev.properties | 1 + .../src/main/resources/application.properties | 4 +- .../src/main/resources/static/index.html | 6 + .../ExampleRestApplicationTests.java | 13 + .../gitee/sop/storyweb/open/OpenStory.java | 92 --- sop-example/pom.xml | 3 +- sop-example/readme.md | 4 +- .../sop/gateway/common/SopConstants.java | 3 + .../gitee/sop/gateway/config/ApiConfig.java | 2 + .../sop/gateway/config/GatewayConfig.java | 74 +-- .../gateway/controller/IndexController.java | 77 ++- .../exception/impl/ExceptionExecutorImpl.java | 2 +- .../gateway/request/ApiRequestContext.java | 17 + .../request/ApiRequestContextFactory.java | 74 --- .../com/gitee/sop/gateway/service/Serde.java | 3 + .../service/impl/ParamExecutorImpl.java | 15 +- .../service/impl/RestRouteServiceImpl.java | 23 + .../service/impl/RouteServiceImpl.java | 43 +- .../service/validate/ApiValidator.java | 34 +- .../gateway/service/validate/Validator.java | 8 + .../src/main/resources/application.properties | 2 + sop-registry/pom.xml | 2 +- .../SDKCSharp/Model/GetStoryModel.cs | 11 +- sop-sdk/sdk-csharp/SDKCSharp/Program.cs | 8 +- .../SDKCSharp/Request/GetStoryRequest.cs | 15 - .../SDKCSharp/Response/GetStoryResponse.cs | 18 - .../sop/sdk/model/DemoFileUploadModel.java | 2 +- .../sdk/request/DemoFileUploadRequest.java | 6 +- .../sop/sdk/request/GetProductRequest.java | 11 + .../sop/sdk/request/GetStoryRequest.java | 11 - ...yResponse.java => GetProductResponse.java} | 2 +- .../test/java/com/gitee/sop/sdk/SdkTest.java | 18 +- sop-support/sop-service-support/pom.xml | 2 +- .../support/context/DefaultOpenContext.java | 8 +- .../sop/support/context/OpenContext.java | 29 +- .../dubbo/DubboProviderTraceFilter.java | 70 +++ .../sop/support/register/ApiRegister.java | 14 +- .../internal/org.apache.dubbo.rpc.Filter | 1 + sop-support/sop-spring-boot-starter/pom.xml | 2 +- .../main/java/com/gitee/sop/test/Client.java | 16 + .../gitee/sop/test/AlipayClientPostTest.java | 95 +--- .../java/com/gitee/sop/test/AllInOneTest.java | 68 ++- .../java/com/gitee/sop/test/TestBase.java | 10 +- sop.sql | 527 ++++++++++-------- 97 files changed, 1487 insertions(+), 867 deletions(-) create mode 100644 sop-example/example-payment/payment-api/pom.xml create mode 100644 sop-example/example-payment/payment-api/src/main/java/com/gitee/sop/payment/api/PaymentService.java rename sop-example/example-payment/{ => payment-service}/.gitignore (100%) create mode 100755 sop-example/example-payment/payment-service/pom.xml rename sop-example/example-payment/{ => payment-service}/push-doc.sh (100%) rename sop-example/example-payment/{ => payment-service}/src/main/java/com/gitee/sop/payment/ExamplePaymentApplication.java (100%) rename sop-example/example-payment/{ => payment-service}/src/main/java/com/gitee/sop/payment/open/OpenPayment.java (100%) rename sop-example/example-payment/{ => payment-service}/src/main/java/com/gitee/sop/payment/open/impl/OpenPaymentImpl.java (69%) rename sop-example/example-payment/{ => payment-service}/src/main/java/com/gitee/sop/payment/open/req/PayOrderSearchRequest.java (78%) rename sop-example/example-payment/{ => payment-service}/src/main/java/com/gitee/sop/payment/open/req/PayTradeWapPayRequest.java (100%) create mode 100755 sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/open/resp/PayOrderSearchResponse.java rename sop-example/example-payment/{ => payment-service}/src/main/java/com/gitee/sop/payment/open/resp/PayTradeWapPayResponse.java (100%) rename sop-example/example-payment/{ => payment-service}/src/main/resources/application-dev.properties (100%) rename sop-example/example-payment/{ => payment-service}/src/main/resources/application-test.properties (100%) create mode 100755 sop-example/example-payment/payment-service/src/main/resources/application.properties rename sop-example/example-payment/{ => payment-service}/src/main/resources/doc.json (100%) rename sop-example/example-payment/{ => payment-service}/src/main/resources/i18n/isp/bizerror_en.properties (100%) rename sop-example/example-payment/{ => payment-service}/src/main/resources/i18n/isp/bizerror_zh_CN.properties (100%) rename sop-example/example-payment/{ => payment-service}/src/main/resources/i18n/isp/goods_error_en.properties (100%) rename sop-example/example-payment/{ => payment-service}/src/main/resources/i18n/isp/goods_error_zh_CN.properties (100%) rename sop-example/example-payment/{ => payment-service}/src/main/resources/smart-doc.json (100%) rename sop-example/example-payment/{ => payment-service}/src/test/java/com/gitee/sop/payment/DocPushTest.java (100%) delete mode 100755 sop-example/example-payment/src/main/java/com/gitee/sop/payment/open/resp/PayOrderSearchResponse.java create mode 100755 sop-example/example-product/pom.xml create mode 100644 sop-example/example-product/product-api/pom.xml create mode 100644 sop-example/example-product/product-api/src/main/java/com/gitee/sop/story/api/ProductService.java create mode 100644 sop-example/example-product/product-api/src/main/java/com/gitee/sop/story/api/resp/ProductResult.java rename sop-example/{example-story => example-product/product-service}/.gitignore (100%) rename sop-example/{example-story => example-product/product-service}/pom.xml (93%) rename sop-example/{example-story/src/main/java/com/gitee/sop/storyweb/ExampleStoryApplication.java => example-product/product-service/src/main/java/com/gitee/sop/productweb/ExampleProductApplication.java} (66%) rename sop-example/{example-story/src/main/java/com/gitee/sop/storyweb => example-product/product-service/src/main/java/com/gitee/sop/productweb}/message/StoryMessageEnum.java (88%) create mode 100755 sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/open/OpenProduct.java rename sop-example/{example-story/src/main/java/com/gitee/sop/storyweb/impl/OpenStoryImpl.java => example-product/product-service/src/main/java/com/gitee/sop/productweb/open/impl/OpenProductImpl.java} (62%) rename sop-example/{example-story/src/main/java/com/gitee/sop/storyweb/open/req/StorySaveRequest.java => example-product/product-service/src/main/java/com/gitee/sop/productweb/open/req/ProductSaveRequest.java} (75%) rename sop-example/{example-story/src/main/java/com/gitee/sop/storyweb/open/resp/StoryResponse.java => example-product/product-service/src/main/java/com/gitee/sop/productweb/open/resp/ProductResponse.java} (76%) create mode 100644 sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/rpc/ProductServiceImpl.java rename sop-example/{example-story => example-product/product-service}/src/main/resources/application-dev.properties (100%) rename sop-example/{example-story => example-product/product-service}/src/main/resources/application-test.properties (100%) rename sop-example/{example-story => example-product/product-service}/src/main/resources/application.properties (81%) rename sop-example/{example-story => example-product/product-service}/src/main/resources/doc.json (100%) rename sop-example/{example-story => example-product/product-service}/src/main/resources/download.txt (100%) rename sop-example/{example-story => example-product/product-service}/src/main/resources/i18n/bizerror_en.properties (100%) rename sop-example/{example-story => example-product/product-service}/src/main/resources/i18n/bizerror_zh_CN.properties (100%) rename sop-example/{example-story => example-product/product-service}/src/main/resources/smart-doc.json (100%) rename sop-example/{example-story/src/test/java/com/gitee/sop/storyweb => example-product/product-service/src/test/java/com/gitee/sop/productweb}/DocPushTest.java (85%) create mode 100644 sop-example/example-rest/.gitignore create mode 100644 sop-example/example-rest/pom.xml create mode 100644 sop-example/example-rest/src/main/java/com/sop/example/rest/examplerest/ExampleRestApplication.java create mode 100644 sop-example/example-rest/src/main/java/com/sop/example/rest/examplerest/rest/GoodsController.java create mode 100644 sop-example/example-rest/src/main/java/com/sop/example/rest/examplerest/rest/impl/GoodsControllerImpl.java create mode 100644 sop-example/example-rest/src/main/java/com/sop/example/rest/examplerest/rest/vo/GoodsVO.java create mode 100755 sop-example/example-rest/src/main/resources/application-dev.properties rename sop-example/{example-payment => example-rest}/src/main/resources/application.properties (74%) mode change 100755 => 100644 create mode 100644 sop-example/example-rest/src/main/resources/static/index.html create mode 100644 sop-example/example-rest/src/test/java/com/sop/example/rest/examplerest/ExampleRestApplicationTests.java delete mode 100755 sop-example/example-story/src/main/java/com/gitee/sop/storyweb/open/OpenStory.java delete mode 100755 sop-gateway/src/main/java/com/gitee/sop/gateway/request/ApiRequestContextFactory.java create mode 100644 sop-gateway/src/main/java/com/gitee/sop/gateway/service/impl/RestRouteServiceImpl.java mode change 100755 => 100644 sop-sdk/sdk-csharp/SDKCSharp/Model/GetStoryModel.cs mode change 100755 => 100644 sop-sdk/sdk-csharp/SDKCSharp/Program.cs delete mode 100755 sop-sdk/sdk-csharp/SDKCSharp/Request/GetStoryRequest.cs delete mode 100755 sop-sdk/sdk-csharp/SDKCSharp/Response/GetStoryResponse.cs create mode 100755 sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/request/GetProductRequest.java delete mode 100755 sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/request/GetStoryRequest.java rename sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/response/{GetStoryResponse.java => GetProductResponse.java} (82%) create mode 100644 sop-support/sop-service-support/src/main/java/com/gitee/sop/support/dubbo/DubboProviderTraceFilter.java create mode 100644 sop-support/sop-service-support/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.Filter diff --git a/pom.xml b/pom.xml index edaac13b..24fa2bbe 100755 --- a/pom.xml +++ b/pom.xml @@ -39,7 +39,7 @@ 2021.0.5.0 - 3.2.12 + 3.2.16 4.11 2.5 @@ -207,6 +207,9 @@ ${java.version} ${java.version} UTF-8 + + -parameters + diff --git a/sop-example/example-payment/payment-api/pom.xml b/sop-example/example-payment/payment-api/pom.xml new file mode 100644 index 00000000..077adf1e --- /dev/null +++ b/sop-example/example-payment/payment-api/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + com.gitee.sop + payment-api + 5.0.0-SNAPSHOT + + + 8 + 8 + UTF-8 + + + \ No newline at end of file diff --git a/sop-example/example-payment/payment-api/src/main/java/com/gitee/sop/payment/api/PaymentService.java b/sop-example/example-payment/payment-api/src/main/java/com/gitee/sop/payment/api/PaymentService.java new file mode 100644 index 00000000..90310389 --- /dev/null +++ b/sop-example/example-payment/payment-api/src/main/java/com/gitee/sop/payment/api/PaymentService.java @@ -0,0 +1,7 @@ +package com.gitee.sop.payment.api; + +/** + * @author 六如 + */ +public interface PaymentService { +} diff --git a/sop-example/example-payment/.gitignore b/sop-example/example-payment/payment-service/.gitignore similarity index 100% rename from sop-example/example-payment/.gitignore rename to sop-example/example-payment/payment-service/.gitignore diff --git a/sop-example/example-payment/payment-service/pom.xml b/sop-example/example-payment/payment-service/pom.xml new file mode 100755 index 00000000..98436655 --- /dev/null +++ b/sop-example/example-payment/payment-service/pom.xml @@ -0,0 +1,128 @@ + + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.6.15 + + + + com.gitee.sop + payment-service + 5.0.0-SNAPSHOT + payment-service + + + 1.8 + + 3.2.16 + + + + + com.gitee.sop + payment-api + 5.0.0-SNAPSHOT + + + com.gitee.sop + product-api + 5.0.0-SNAPSHOT + + + + com.gitee.sop + sop-spring-boot-starter + 5.0.0-SNAPSHOT + + + + org.apache.dubbo + dubbo-nacos-spring-boot-starter + + + + org.apache.dubbo + dubbo-zookeeper-curator5-spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.projectlombok + lombok + 1.18.34 + provided + + + + + + + org.apache.dubbo + dubbo-bom + ${dubbo.version} + pom + import + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12.4 + + true + + + + org.springframework.boot + spring-boot-maven-plugin + + + + com.ly.smart-doc + smart-doc-maven-plugin + 3.0.9 + + + ./src/main/resources/smart-doc.json + + ${project.artifactId} + + + + com.gitee.sop + sop-service-support + 5.0.0-SNAPSHOT + + + + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + maven_central + Maven Central + https://repo.maven.apache.org/maven2/ + + + + diff --git a/sop-example/example-payment/push-doc.sh b/sop-example/example-payment/payment-service/push-doc.sh similarity index 100% rename from sop-example/example-payment/push-doc.sh rename to sop-example/example-payment/payment-service/push-doc.sh diff --git a/sop-example/example-payment/src/main/java/com/gitee/sop/payment/ExamplePaymentApplication.java b/sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/ExamplePaymentApplication.java similarity index 100% rename from sop-example/example-payment/src/main/java/com/gitee/sop/payment/ExamplePaymentApplication.java rename to sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/ExamplePaymentApplication.java diff --git a/sop-example/example-payment/src/main/java/com/gitee/sop/payment/open/OpenPayment.java b/sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/open/OpenPayment.java similarity index 100% rename from sop-example/example-payment/src/main/java/com/gitee/sop/payment/open/OpenPayment.java rename to sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/open/OpenPayment.java diff --git a/sop-example/example-payment/src/main/java/com/gitee/sop/payment/open/impl/OpenPaymentImpl.java b/sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/open/impl/OpenPaymentImpl.java similarity index 69% rename from sop-example/example-payment/src/main/java/com/gitee/sop/payment/open/impl/OpenPaymentImpl.java rename to sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/open/impl/OpenPaymentImpl.java index fc03d522..8b4838c8 100755 --- a/sop-example/example-payment/src/main/java/com/gitee/sop/payment/open/impl/OpenPaymentImpl.java +++ b/sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/open/impl/OpenPaymentImpl.java @@ -6,8 +6,12 @@ import com.gitee.sop.payment.open.req.PayTradeWapPayRequest; import com.gitee.sop.payment.open.resp.PayOrderSearchResponse; import com.gitee.sop.payment.open.resp.PayTradeWapPayResponse; import java.util.UUID; -import org.apache.dubbo.config.annotation.DubboService; +import com.gitee.sop.story.api.ProductService; +import com.gitee.sop.story.api.resp.ProductResult; +import org.apache.dubbo.config.annotation.DubboReference; +import org.apache.dubbo.config.annotation.DubboService; +import org.springframework.beans.factory.annotation.Value; /** @@ -18,6 +22,13 @@ import org.apache.dubbo.config.annotation.DubboService; @DubboService(validation = "true") public class OpenPaymentImpl implements OpenPayment { + @DubboReference + private ProductService storyService; + + @Value("${dubbo.labels:}") + private String env; + + @Override public PayTradeWapPayResponse tradeWapPay(PayTradeWapPayRequest request) { PayTradeWapPayResponse payTradeWapPayResponse = new PayTradeWapPayResponse(); @@ -32,6 +43,13 @@ public class OpenPaymentImpl implements OpenPayment { payOrderSearchResponse.setPayNo("xxxx"); payOrderSearchResponse.setPayUserId(111L); payOrderSearchResponse.setPayUserName("Jim"); + + try { + ProductResult storyResult = storyService.getById(1L); + payOrderSearchResponse.setRemark(storyResult + ",env:" + env); + } catch (Exception e) { + e.printStackTrace(); + } return payOrderSearchResponse; } } diff --git a/sop-example/example-payment/src/main/java/com/gitee/sop/payment/open/req/PayOrderSearchRequest.java b/sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/open/req/PayOrderSearchRequest.java similarity index 78% rename from sop-example/example-payment/src/main/java/com/gitee/sop/payment/open/req/PayOrderSearchRequest.java rename to sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/open/req/PayOrderSearchRequest.java index 3981427f..5347ed27 100755 --- a/sop-example/example-payment/src/main/java/com/gitee/sop/payment/open/req/PayOrderSearchRequest.java +++ b/sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/open/req/PayOrderSearchRequest.java @@ -10,7 +10,10 @@ import org.hibernate.validator.constraints.Length; @Data public class PayOrderSearchRequest { - @ApiModelProperty(value = "订单编号", required = true, example = "xxxx") + /** + * 订单编号 + * @mock xxxx + */ @Length(max = 64) // 最大长度 private String orderNo; diff --git a/sop-example/example-payment/src/main/java/com/gitee/sop/payment/open/req/PayTradeWapPayRequest.java b/sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/open/req/PayTradeWapPayRequest.java similarity index 100% rename from sop-example/example-payment/src/main/java/com/gitee/sop/payment/open/req/PayTradeWapPayRequest.java rename to sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/open/req/PayTradeWapPayRequest.java diff --git a/sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/open/resp/PayOrderSearchResponse.java b/sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/open/resp/PayOrderSearchResponse.java new file mode 100755 index 00000000..2714de7a --- /dev/null +++ b/sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/open/resp/PayOrderSearchResponse.java @@ -0,0 +1,35 @@ +package com.gitee.sop.payment.open.resp; + +import lombok.Data; + +/** + * @author 六如 + */ +@Data +public class PayOrderSearchResponse { + + /** + * 订单编号 + */ + private String orderNo; + + /** + * 支付编号 + */ + private String payNo; + + /** + * 支付人id + */ + private Long payUserId; + + /** + * 支付人姓名 + */ + private String payUserName; + + /** + * 备注 + */ + private String remark; +} diff --git a/sop-example/example-payment/src/main/java/com/gitee/sop/payment/open/resp/PayTradeWapPayResponse.java b/sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/open/resp/PayTradeWapPayResponse.java similarity index 100% rename from sop-example/example-payment/src/main/java/com/gitee/sop/payment/open/resp/PayTradeWapPayResponse.java rename to sop-example/example-payment/payment-service/src/main/java/com/gitee/sop/payment/open/resp/PayTradeWapPayResponse.java diff --git a/sop-example/example-payment/src/main/resources/application-dev.properties b/sop-example/example-payment/payment-service/src/main/resources/application-dev.properties similarity index 100% rename from sop-example/example-payment/src/main/resources/application-dev.properties rename to sop-example/example-payment/payment-service/src/main/resources/application-dev.properties diff --git a/sop-example/example-payment/src/main/resources/application-test.properties b/sop-example/example-payment/payment-service/src/main/resources/application-test.properties similarity index 100% rename from sop-example/example-payment/src/main/resources/application-test.properties rename to sop-example/example-payment/payment-service/src/main/resources/application-test.properties diff --git a/sop-example/example-payment/payment-service/src/main/resources/application.properties b/sop-example/example-payment/payment-service/src/main/resources/application.properties new file mode 100755 index 00000000..17ba6fa9 --- /dev/null +++ b/sop-example/example-payment/payment-service/src/main/resources/application.properties @@ -0,0 +1,10 @@ +spring.profiles.active=dev + +server.port=7072 +spring.application.name=payment-service + +dubbo.protocol.name=dubbo +dubbo.protocol.port=-1 +dubbo.application.qos-enable=false +dubbo.consumer.check=false +dubbo.registry.address=zookeeper://localhost:2181 diff --git a/sop-example/example-payment/src/main/resources/doc.json b/sop-example/example-payment/payment-service/src/main/resources/doc.json similarity index 100% rename from sop-example/example-payment/src/main/resources/doc.json rename to sop-example/example-payment/payment-service/src/main/resources/doc.json diff --git a/sop-example/example-payment/src/main/resources/i18n/isp/bizerror_en.properties b/sop-example/example-payment/payment-service/src/main/resources/i18n/isp/bizerror_en.properties similarity index 100% rename from sop-example/example-payment/src/main/resources/i18n/isp/bizerror_en.properties rename to sop-example/example-payment/payment-service/src/main/resources/i18n/isp/bizerror_en.properties diff --git a/sop-example/example-payment/src/main/resources/i18n/isp/bizerror_zh_CN.properties b/sop-example/example-payment/payment-service/src/main/resources/i18n/isp/bizerror_zh_CN.properties similarity index 100% rename from sop-example/example-payment/src/main/resources/i18n/isp/bizerror_zh_CN.properties rename to sop-example/example-payment/payment-service/src/main/resources/i18n/isp/bizerror_zh_CN.properties diff --git a/sop-example/example-payment/src/main/resources/i18n/isp/goods_error_en.properties b/sop-example/example-payment/payment-service/src/main/resources/i18n/isp/goods_error_en.properties similarity index 100% rename from sop-example/example-payment/src/main/resources/i18n/isp/goods_error_en.properties rename to sop-example/example-payment/payment-service/src/main/resources/i18n/isp/goods_error_en.properties diff --git a/sop-example/example-payment/src/main/resources/i18n/isp/goods_error_zh_CN.properties b/sop-example/example-payment/payment-service/src/main/resources/i18n/isp/goods_error_zh_CN.properties similarity index 100% rename from sop-example/example-payment/src/main/resources/i18n/isp/goods_error_zh_CN.properties rename to sop-example/example-payment/payment-service/src/main/resources/i18n/isp/goods_error_zh_CN.properties diff --git a/sop-example/example-payment/src/main/resources/smart-doc.json b/sop-example/example-payment/payment-service/src/main/resources/smart-doc.json similarity index 100% rename from sop-example/example-payment/src/main/resources/smart-doc.json rename to sop-example/example-payment/payment-service/src/main/resources/smart-doc.json diff --git a/sop-example/example-payment/src/test/java/com/gitee/sop/payment/DocPushTest.java b/sop-example/example-payment/payment-service/src/test/java/com/gitee/sop/payment/DocPushTest.java similarity index 100% rename from sop-example/example-payment/src/test/java/com/gitee/sop/payment/DocPushTest.java rename to sop-example/example-payment/payment-service/src/test/java/com/gitee/sop/payment/DocPushTest.java diff --git a/sop-example/example-payment/pom.xml b/sop-example/example-payment/pom.xml index 8182f257..79fc181c 100755 --- a/sop-example/example-payment/pom.xml +++ b/sop-example/example-payment/pom.xml @@ -1,122 +1,16 @@ - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.6.15 - - - com.gitee.sop example-payment 5.0.0-SNAPSHOT - example-payment - - - 1.8 - - 3.2.10 - - - - - - com.gitee.sop - sop-spring-boot-starter - 5.0.0-SNAPSHOT - - - - org.apache.dubbo - dubbo-nacos-spring-boot-starter - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - org.apache.dubbo - dubbo-dependencies-zookeeper-curator5 - ${dubbo.version} - pom - provided - - - - org.projectlombok - lombok - 1.18.34 - provided - - - - - - - org.apache.dubbo - dubbo-bom - ${dubbo.version} - pom - import - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.12.4 - - true - - - - org.springframework.boot - spring-boot-maven-plugin - - - - com.ly.smart-doc - smart-doc-maven-plugin - 3.0.9 - - - ./src/main/resources/smart-doc.json - - ${project.artifactId} - - - - com.gitee.sop - sop-service-support - 5.0.0-SNAPSHOT - - - - - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - - maven_central - Maven Central - https://repo.maven.apache.org/maven2/ - - + pom + + payment-api + payment-service + diff --git a/sop-example/example-payment/src/main/java/com/gitee/sop/payment/open/resp/PayOrderSearchResponse.java b/sop-example/example-payment/src/main/java/com/gitee/sop/payment/open/resp/PayOrderSearchResponse.java deleted file mode 100755 index 96d7c40b..00000000 --- a/sop-example/example-payment/src/main/java/com/gitee/sop/payment/open/resp/PayOrderSearchResponse.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.gitee.sop.payment.open.resp; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author 六如 - */ -@Data -public class PayOrderSearchResponse { - - @ApiModelProperty(value = "订单编号", example = "xxxx") - private String orderNo; - - @ApiModelProperty(value = "支付编号", example = "xxxx") - private String payNo; - - @ApiModelProperty(value = "支付人id", example = "111") - private Long payUserId; - - @ApiModelProperty(value = "支付人姓名", example = "Jim") - private String payUserName; -} diff --git a/sop-example/example-product/pom.xml b/sop-example/example-product/pom.xml new file mode 100755 index 00000000..943335f1 --- /dev/null +++ b/sop-example/example-product/pom.xml @@ -0,0 +1,16 @@ + + + + 4.0.0 + com.gitee.sop + example-product + 5.0.0-SNAPSHOT + pom + + + product-api + product-service + + diff --git a/sop-example/example-product/product-api/pom.xml b/sop-example/example-product/product-api/pom.xml new file mode 100644 index 00000000..47e43a79 --- /dev/null +++ b/sop-example/example-product/product-api/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + com.gitee.sop + product-api + 5.0.0-SNAPSHOT + + + 8 + 8 + UTF-8 + + + \ No newline at end of file diff --git a/sop-example/example-product/product-api/src/main/java/com/gitee/sop/story/api/ProductService.java b/sop-example/example-product/product-api/src/main/java/com/gitee/sop/story/api/ProductService.java new file mode 100644 index 00000000..a6552935 --- /dev/null +++ b/sop-example/example-product/product-api/src/main/java/com/gitee/sop/story/api/ProductService.java @@ -0,0 +1,12 @@ +package com.gitee.sop.story.api; + +import com.gitee.sop.story.api.resp.ProductResult; + +/** + * @author 六如 + */ +public interface ProductService { + + ProductResult getById(Long id); + +} diff --git a/sop-example/example-product/product-api/src/main/java/com/gitee/sop/story/api/resp/ProductResult.java b/sop-example/example-product/product-api/src/main/java/com/gitee/sop/story/api/resp/ProductResult.java new file mode 100644 index 00000000..581d949a --- /dev/null +++ b/sop-example/example-product/product-api/src/main/java/com/gitee/sop/story/api/resp/ProductResult.java @@ -0,0 +1,51 @@ +package com.gitee.sop.story.api.resp; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author 六如 + */ +public class ProductResult implements Serializable { + private static final long serialVersionUID = -3743413007549072654L; + + private Integer id; + + private String name; + + // 日期格式要用Date,暂不支持LocalDateTime + private Date addTime = new Date(); + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Date getAddTime() { + return addTime; + } + + public void setAddTime(Date addTime) { + this.addTime = addTime; + } + + @Override + public String toString() { + return "StoryResult{" + + "id=" + id + + ", name='" + name + '\'' + + ", addTime=" + addTime + + '}'; + } +} \ No newline at end of file diff --git a/sop-example/example-story/.gitignore b/sop-example/example-product/product-service/.gitignore similarity index 100% rename from sop-example/example-story/.gitignore rename to sop-example/example-product/product-service/.gitignore diff --git a/sop-example/example-story/pom.xml b/sop-example/example-product/product-service/pom.xml similarity index 93% rename from sop-example/example-story/pom.xml rename to sop-example/example-product/product-service/pom.xml index 0f530f69..a0d0b8d9 100755 --- a/sop-example/example-story/pom.xml +++ b/sop-example/example-product/product-service/pom.xml @@ -11,9 +11,9 @@ com.gitee.sop - example-story + product-service 5.0.0-SNAPSHOT - example-story + story-service 1.8 @@ -22,6 +22,12 @@ + + com.gitee.sop + product-api + 5.0.0-SNAPSHOT + + com.gitee.sop sop-spring-boot-starter diff --git a/sop-example/example-story/src/main/java/com/gitee/sop/storyweb/ExampleStoryApplication.java b/sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/ExampleProductApplication.java similarity index 66% rename from sop-example/example-story/src/main/java/com/gitee/sop/storyweb/ExampleStoryApplication.java rename to sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/ExampleProductApplication.java index af37857f..76f9419c 100755 --- a/sop-example/example-story/src/main/java/com/gitee/sop/storyweb/ExampleStoryApplication.java +++ b/sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/ExampleProductApplication.java @@ -1,4 +1,4 @@ -package com.gitee.sop.storyweb; +package com.gitee.sop.productweb; import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; import org.springframework.boot.SpringApplication; @@ -6,10 +6,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication @EnableDubbo -public class ExampleStoryApplication { +public class ExampleProductApplication { public static void main(String[] args) { - SpringApplication.run(ExampleStoryApplication.class, args); + SpringApplication.run(ExampleProductApplication.class, args); } } diff --git a/sop-example/example-story/src/main/java/com/gitee/sop/storyweb/message/StoryMessageEnum.java b/sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/message/StoryMessageEnum.java similarity index 88% rename from sop-example/example-story/src/main/java/com/gitee/sop/storyweb/message/StoryMessageEnum.java rename to sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/message/StoryMessageEnum.java index 02003dfd..a450894f 100755 --- a/sop-example/example-story/src/main/java/com/gitee/sop/storyweb/message/StoryMessageEnum.java +++ b/sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/message/StoryMessageEnum.java @@ -1,4 +1,4 @@ -package com.gitee.sop.storyweb.message; +package com.gitee.sop.productweb.message; import com.gitee.sop.support.message.I18nMessage; import lombok.AllArgsConstructor; diff --git a/sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/open/OpenProduct.java b/sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/open/OpenProduct.java new file mode 100755 index 00000000..788f8a22 --- /dev/null +++ b/sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/open/OpenProduct.java @@ -0,0 +1,92 @@ +package com.gitee.sop.productweb.open; + +import com.gitee.sop.productweb.open.req.ProductSaveRequest; +import com.gitee.sop.productweb.open.resp.ProductResponse; +import com.gitee.sop.support.annotation.Open; +import com.gitee.sop.support.context.OpenContext; +import com.gitee.sop.support.dto.FileData; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.List; + +/** + * 产品服务 + * + * @author 六如 + * @dubbo + */ +@Api("产品服务") +public interface OpenProduct { + + /** + * 新增故事 + * + * @param request 入参 + * @return 返回id + */ + @Open("product.save") + Integer save(ProductSaveRequest request); + + @Open("product.update") + Integer update(Integer id, ProductSaveRequest request); + + // 演示抛出异常 + @Open("product.updateError") + Integer updateError(Integer id); + + @ApiOperation(value = "根据id获取故事") + @Open("product.get") + ProductResponse getById(@NotNull(message = "id必填") Integer id); + + // 需要授权 + @Open(value = "product.get", version = "2.0", permission = true) + ProductResponse getByIdV2(Long id); + + @Open(value = "product.get.context") + ProductResponse getContext(Long id, OpenContext context); + + + // 默认方法,注解放在这里也有效 + @Open("product.find") + default ProductResponse getById(Integer id, String name) { + ProductResponse storyResponse = new ProductResponse(); + storyResponse.setId(id); + storyResponse.setName(name); + return storyResponse; + } + + // 默认方法,注解放在这里也有效 + @Open("alipay.story.find") + default ProductResponse findByName(String name) { + ProductResponse storyResponse = new ProductResponse(); + storyResponse.setName(name); + return storyResponse; + } + + // 演示单文件上传 + @Open("product.upload") + ProductResponse upload(ProductSaveRequest request, FileData file); + + // 演示多文件上传 + @Open("product.upload.more") + ProductResponse upload2( + ProductSaveRequest request, + @NotNull(message = "身份证正面必填") FileData idCardFront, + @NotNull(message = "身份证背面必填") FileData idCardBack + ); + + // 演示多文件上传 + @Open("product.upload.list") + ProductResponse upload3( + ProductSaveRequest request, + @Size(min = 2, message = "最少上传2个文件") + List files + ); + + // 下载 + @Open("product.download") + FileData download(Integer id); +} diff --git a/sop-example/example-story/src/main/java/com/gitee/sop/storyweb/impl/OpenStoryImpl.java b/sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/open/impl/OpenProductImpl.java similarity index 62% rename from sop-example/example-story/src/main/java/com/gitee/sop/storyweb/impl/OpenStoryImpl.java rename to sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/open/impl/OpenProductImpl.java index 0dbf5ebd..d501b5a6 100755 --- a/sop-example/example-story/src/main/java/com/gitee/sop/storyweb/impl/OpenStoryImpl.java +++ b/sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/open/impl/OpenProductImpl.java @@ -1,15 +1,16 @@ -package com.gitee.sop.storyweb.impl; +package com.gitee.sop.productweb.open.impl; -import com.gitee.sop.storyweb.message.StoryMessageEnum; -import com.gitee.sop.storyweb.open.OpenStory; -import com.gitee.sop.storyweb.open.req.StorySaveRequest; -import com.gitee.sop.storyweb.open.resp.StoryResponse; +import com.gitee.sop.productweb.message.StoryMessageEnum; +import com.gitee.sop.productweb.open.OpenProduct; +import com.gitee.sop.productweb.open.req.ProductSaveRequest; +import com.gitee.sop.productweb.open.resp.ProductResponse; import com.gitee.sop.support.context.OpenContext; import com.gitee.sop.support.dto.CommonFileData; import com.gitee.sop.support.dto.FileData; import com.gitee.sop.support.exception.OpenException; import org.apache.commons.io.IOUtils; import org.apache.dubbo.config.annotation.DubboService; +import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.ClassPathResource; import org.springframework.util.Assert; @@ -17,6 +18,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Objects; /** @@ -25,18 +27,21 @@ import java.util.List; * @author 六如 */ @DubboService(validation = "true") -public class OpenStoryImpl implements OpenStory { +public class OpenProductImpl implements OpenProduct { + + @Value("${dubbo.labels:}") + private String env; @Override - public Integer save(StorySaveRequest storySaveDTO) { + public Integer save(ProductSaveRequest request) { return 1; } @Override - public Integer update(Integer id, StorySaveRequest storySaveDTO) { - System.out.println("update, id:" + id + ", storySaveDTO=" + storySaveDTO); + public Integer update(Integer id, ProductSaveRequest request) { + System.out.println("update, id:" + id + ", storySaveDTO=" + request); return 1; } @@ -54,42 +59,46 @@ public class OpenStoryImpl implements OpenStory { } @Override - public StoryResponse getById(Integer id) { - StoryResponse storyResponse = new StoryResponse(); + public ProductResponse getById(Integer id) { + ProductResponse storyResponse = new ProductResponse(); storyResponse.setId(id); - storyResponse.setName("乌鸦喝水"); + storyResponse.setName("冰箱-" + env); return storyResponse; } @Override - public StoryResponse getByIdV2(Long id) { - StoryResponse storyResponse = new StoryResponse(); + public ProductResponse getByIdV2(Long id) { + ProductResponse storyResponse = new ProductResponse(); storyResponse.setId(2); - storyResponse.setName("乌鸦喝水2.0"); + storyResponse.setName("冰箱2.0"); return storyResponse; } // 演示获取上下文 @Override - public StoryResponse getContext(Long id, OpenContext context) { - StoryResponse storyResponse = new StoryResponse(); + public ProductResponse getContext(Long id, OpenContext context) { + ProductResponse storyResponse = new ProductResponse(); storyResponse.setId(3); storyResponse.setName(context.toString()); // 获取回调参数 String notifyUrl = context.getNotifyUrl(); System.out.println(notifyUrl); + // 方式2:使用OpenContext.current() + String notifyUrl1 = OpenContext.current().getNotifyUrl(); + System.out.println(Objects.equals(notifyUrl1, notifyUrl)); + return storyResponse; } @Override - public StoryResponse upload(StorySaveRequest storySaveDTO, FileData file) { + public ProductResponse upload(ProductSaveRequest storySaveDTO, FileData file) { System.out.println("getName:" + file.getName()); System.out.println("getOriginalFilename:" + file.getOriginalFilename()); checkFile(Arrays.asList(file)); - StoryResponse storyResponse = new StoryResponse(); + ProductResponse storyResponse = new ProductResponse(); storyResponse.setId(1); storyResponse.setName(file.getOriginalFilename()); return storyResponse; @@ -97,25 +106,25 @@ public class OpenStoryImpl implements OpenStory { @Override - public StoryResponse upload2(StorySaveRequest storySaveDTO, FileData idCardFront, FileData idCardBack) { + public ProductResponse upload2(ProductSaveRequest storySaveDTO, FileData idCardFront, FileData idCardBack) { System.out.println("upload:" + storySaveDTO); checkFile(Arrays.asList(idCardFront, idCardBack)); - StoryResponse storyResponse = new StoryResponse(); + ProductResponse storyResponse = new ProductResponse(); storyResponse.setId(1); - storyResponse.setName(storySaveDTO.getStoryName()); + storyResponse.setName(storySaveDTO.getProductName()); return storyResponse; } @Override - public StoryResponse upload3(StorySaveRequest storySaveDTO, List files) { + public ProductResponse upload3(ProductSaveRequest storySaveDTO, List files) { List list = new ArrayList<>(); list.add("upload:" + storySaveDTO); checkFile(files); - StoryResponse storyResponse = new StoryResponse(); + ProductResponse storyResponse = new ProductResponse(); storyResponse.setId(1); - storyResponse.setName(storySaveDTO.getStoryName()); + storyResponse.setName(storySaveDTO.getProductName()); return storyResponse; } diff --git a/sop-example/example-story/src/main/java/com/gitee/sop/storyweb/open/req/StorySaveRequest.java b/sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/open/req/ProductSaveRequest.java similarity index 75% rename from sop-example/example-story/src/main/java/com/gitee/sop/storyweb/open/req/StorySaveRequest.java rename to sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/open/req/ProductSaveRequest.java index d21ad5d6..7dfe0d20 100755 --- a/sop-example/example-story/src/main/java/com/gitee/sop/storyweb/open/req/StorySaveRequest.java +++ b/sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/open/req/ProductSaveRequest.java @@ -1,8 +1,7 @@ -package com.gitee.sop.storyweb.open.req; +package com.gitee.sop.productweb.open.req; import lombok.Data; import org.hibernate.validator.constraints.Length; -import org.springframework.context.annotation.Lazy; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; @@ -13,7 +12,7 @@ import java.util.Date; * @author 六如 */ @Data -public class StorySaveRequest implements Serializable { +public class ProductSaveRequest implements Serializable { private static final long serialVersionUID = -1214422742659231037L; /** @@ -21,7 +20,7 @@ public class StorySaveRequest implements Serializable { */ @NotBlank(message = "故事名称必填") @Length(max = 64) - private String storyName; + private String productName; /** * 添加时间 diff --git a/sop-example/example-story/src/main/java/com/gitee/sop/storyweb/open/resp/StoryResponse.java b/sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/open/resp/ProductResponse.java similarity index 76% rename from sop-example/example-story/src/main/java/com/gitee/sop/storyweb/open/resp/StoryResponse.java rename to sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/open/resp/ProductResponse.java index fbdacbfc..af004d09 100755 --- a/sop-example/example-story/src/main/java/com/gitee/sop/storyweb/open/resp/StoryResponse.java +++ b/sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/open/resp/ProductResponse.java @@ -1,4 +1,4 @@ -package com.gitee.sop.storyweb.open.resp; +package com.gitee.sop.productweb.open.resp; import lombok.Data; @@ -9,7 +9,7 @@ import java.util.Date; * @author 六如 */ @Data -public class StoryResponse implements Serializable { +public class ProductResponse implements Serializable { private static final long serialVersionUID = -3743413007549072654L; private Integer id; diff --git a/sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/rpc/ProductServiceImpl.java b/sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/rpc/ProductServiceImpl.java new file mode 100644 index 00000000..bbcf62f7 --- /dev/null +++ b/sop-example/example-product/product-service/src/main/java/com/gitee/sop/productweb/rpc/ProductServiceImpl.java @@ -0,0 +1,28 @@ +package com.gitee.sop.productweb.rpc; + +import com.gitee.sop.story.api.ProductService; +import com.gitee.sop.story.api.resp.ProductResult; +import org.apache.dubbo.config.annotation.DubboService; +import org.springframework.beans.factory.annotation.Value; + +import java.util.Date; + + +/** + * @author 六如 + */ +@DubboService +public class ProductServiceImpl implements ProductService { + @Value("${dubbo.labels:}") + private String env; + + @Override + public ProductResult getById(Long id) { + System.out.println("StoryService.getById, env=" + env); + ProductResult storyResult = new ProductResult(); + storyResult.setName("彩电-" + env); + storyResult.setId(id.intValue()); + storyResult.setAddTime(new Date()); + return storyResult; + } +} diff --git a/sop-example/example-story/src/main/resources/application-dev.properties b/sop-example/example-product/product-service/src/main/resources/application-dev.properties similarity index 100% rename from sop-example/example-story/src/main/resources/application-dev.properties rename to sop-example/example-product/product-service/src/main/resources/application-dev.properties diff --git a/sop-example/example-story/src/main/resources/application-test.properties b/sop-example/example-product/product-service/src/main/resources/application-test.properties similarity index 100% rename from sop-example/example-story/src/main/resources/application-test.properties rename to sop-example/example-product/product-service/src/main/resources/application-test.properties diff --git a/sop-example/example-story/src/main/resources/application.properties b/sop-example/example-product/product-service/src/main/resources/application.properties similarity index 81% rename from sop-example/example-story/src/main/resources/application.properties rename to sop-example/example-product/product-service/src/main/resources/application.properties index 4e678426..d889783d 100755 --- a/sop-example/example-story/src/main/resources/application.properties +++ b/sop-example/example-product/product-service/src/main/resources/application.properties @@ -1,7 +1,7 @@ spring.profiles.active=dev server.port=7071 -spring.application.name=story-service +spring.application.name=product-service dubbo.protocol.name=dubbo dubbo.protocol.port=-1 diff --git a/sop-example/example-story/src/main/resources/doc.json b/sop-example/example-product/product-service/src/main/resources/doc.json similarity index 100% rename from sop-example/example-story/src/main/resources/doc.json rename to sop-example/example-product/product-service/src/main/resources/doc.json diff --git a/sop-example/example-story/src/main/resources/download.txt b/sop-example/example-product/product-service/src/main/resources/download.txt similarity index 100% rename from sop-example/example-story/src/main/resources/download.txt rename to sop-example/example-product/product-service/src/main/resources/download.txt diff --git a/sop-example/example-story/src/main/resources/i18n/bizerror_en.properties b/sop-example/example-product/product-service/src/main/resources/i18n/bizerror_en.properties similarity index 100% rename from sop-example/example-story/src/main/resources/i18n/bizerror_en.properties rename to sop-example/example-product/product-service/src/main/resources/i18n/bizerror_en.properties diff --git a/sop-example/example-story/src/main/resources/i18n/bizerror_zh_CN.properties b/sop-example/example-product/product-service/src/main/resources/i18n/bizerror_zh_CN.properties similarity index 100% rename from sop-example/example-story/src/main/resources/i18n/bizerror_zh_CN.properties rename to sop-example/example-product/product-service/src/main/resources/i18n/bizerror_zh_CN.properties diff --git a/sop-example/example-story/src/main/resources/smart-doc.json b/sop-example/example-product/product-service/src/main/resources/smart-doc.json similarity index 100% rename from sop-example/example-story/src/main/resources/smart-doc.json rename to sop-example/example-product/product-service/src/main/resources/smart-doc.json diff --git a/sop-example/example-story/src/test/java/com/gitee/sop/storyweb/DocPushTest.java b/sop-example/example-product/product-service/src/test/java/com/gitee/sop/productweb/DocPushTest.java similarity index 85% rename from sop-example/example-story/src/test/java/com/gitee/sop/storyweb/DocPushTest.java rename to sop-example/example-product/product-service/src/test/java/com/gitee/sop/productweb/DocPushTest.java index fbe7c0ed..e7634170 100755 --- a/sop-example/example-story/src/test/java/com/gitee/sop/storyweb/DocPushTest.java +++ b/sop-example/example-product/product-service/src/test/java/com/gitee/sop/productweb/DocPushTest.java @@ -1,4 +1,4 @@ -package com.gitee.sop.storyweb; +package com.gitee.sop.productweb; import cn.torna.swaggerplugin.SwaggerPlugin; diff --git a/sop-example/example-rest/.gitignore b/sop-example/example-rest/.gitignore new file mode 100644 index 00000000..549e00a2 --- /dev/null +++ b/sop-example/example-rest/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/sop-example/example-rest/pom.xml b/sop-example/example-rest/pom.xml new file mode 100644 index 00000000..4397e12f --- /dev/null +++ b/sop-example/example-rest/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.sop.example.rest + example-rest + 0.0.1-SNAPSHOT + example-rest + Demo project for Spring Boot + + 1.8 + UTF-8 + UTF-8 + 2.6.13 + + 3.2.16 + + + + + com.gitee.sop + sop-spring-boot-starter + 5.0.0-SNAPSHOT + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.apache.dubbo + dubbo-nacos-spring-boot-starter + + + + + org.apache.dubbo + dubbo-zookeeper-curator5-spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.projectlombok + lombok + 1.18.34 + provided + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + org.apache.dubbo + dubbo-bom + ${dubbo.version} + pom + import + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + ${java.version} + ${java.version} + UTF-8 + + -parameters + + + + + + com.ly.smart-doc + smart-doc-maven-plugin + 3.0.9 + + + ./src/main/resources/smart-doc.json + + ${project.artifactId} + + + + com.gitee.sop + sop-service-support + 5.0.0-SNAPSHOT + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + com.sop.example.rest.examplerest.ExampleRestApplication + true + + + + repackage + + repackage + + + + + + + + diff --git a/sop-example/example-rest/src/main/java/com/sop/example/rest/examplerest/ExampleRestApplication.java b/sop-example/example-rest/src/main/java/com/sop/example/rest/examplerest/ExampleRestApplication.java new file mode 100644 index 00000000..85625402 --- /dev/null +++ b/sop-example/example-rest/src/main/java/com/sop/example/rest/examplerest/ExampleRestApplication.java @@ -0,0 +1,15 @@ +package com.sop.example.rest.examplerest; + +import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +@EnableDubbo +public class ExampleRestApplication { + + public static void main(String[] args) { + SpringApplication.run(ExampleRestApplication.class, args); + } + +} diff --git a/sop-example/example-rest/src/main/java/com/sop/example/rest/examplerest/rest/GoodsController.java b/sop-example/example-rest/src/main/java/com/sop/example/rest/examplerest/rest/GoodsController.java new file mode 100644 index 00000000..611a8a15 --- /dev/null +++ b/sop-example/example-rest/src/main/java/com/sop/example/rest/examplerest/rest/GoodsController.java @@ -0,0 +1,16 @@ +package com.sop.example.rest.examplerest.rest; + +import com.gitee.sop.support.annotation.Open; +import com.sop.example.rest.examplerest.rest.vo.GoodsVO; + +import javax.validation.constraints.NotNull; + +/** + * @author 六如 + */ +public interface GoodsController { + + @Open("/getGoodsById") + GoodsVO getById(@NotNull(message = "id必填") Integer id); + +} diff --git a/sop-example/example-rest/src/main/java/com/sop/example/rest/examplerest/rest/impl/GoodsControllerImpl.java b/sop-example/example-rest/src/main/java/com/sop/example/rest/examplerest/rest/impl/GoodsControllerImpl.java new file mode 100644 index 00000000..cdbd9580 --- /dev/null +++ b/sop-example/example-rest/src/main/java/com/sop/example/rest/examplerest/rest/impl/GoodsControllerImpl.java @@ -0,0 +1,20 @@ +package com.sop.example.rest.examplerest.rest.impl; + +import com.sop.example.rest.examplerest.rest.GoodsController; +import com.sop.example.rest.examplerest.rest.vo.GoodsVO; +import org.apache.dubbo.config.annotation.DubboService; + + +/** + * @author 六如 + */ +@DubboService(validation = "true") +public class GoodsControllerImpl implements GoodsController { + @Override + public GoodsVO getById(Integer id) { + GoodsVO goodsVO = new GoodsVO(); + goodsVO.setId(id); + goodsVO.setName("冰箱"); + return goodsVO; + } +} diff --git a/sop-example/example-rest/src/main/java/com/sop/example/rest/examplerest/rest/vo/GoodsVO.java b/sop-example/example-rest/src/main/java/com/sop/example/rest/examplerest/rest/vo/GoodsVO.java new file mode 100644 index 00000000..e5b43551 --- /dev/null +++ b/sop-example/example-rest/src/main/java/com/sop/example/rest/examplerest/rest/vo/GoodsVO.java @@ -0,0 +1,15 @@ +package com.sop.example.rest.examplerest.rest.vo; + +import lombok.Data; + +/** + * @author 六如 + */ +@Data +public class GoodsVO { + + private Integer id; + + private String name; + +} diff --git a/sop-example/example-rest/src/main/resources/application-dev.properties b/sop-example/example-rest/src/main/resources/application-dev.properties new file mode 100755 index 00000000..bfead63f --- /dev/null +++ b/sop-example/example-rest/src/main/resources/application-dev.properties @@ -0,0 +1 @@ +dubbo.registry.address=zookeeper://localhost:2181 diff --git a/sop-example/example-payment/src/main/resources/application.properties b/sop-example/example-rest/src/main/resources/application.properties old mode 100755 new mode 100644 similarity index 74% rename from sop-example/example-payment/src/main/resources/application.properties rename to sop-example/example-rest/src/main/resources/application.properties index a98bc57c..7e08ecbf --- a/sop-example/example-payment/src/main/resources/application.properties +++ b/sop-example/example-rest/src/main/resources/application.properties @@ -1,7 +1,7 @@ spring.profiles.active=dev -server.port=7072 -spring.application.name=example-payment +server.port=7073 +spring.application.name=rest-service dubbo.protocol.name=dubbo dubbo.protocol.port=-1 diff --git a/sop-example/example-rest/src/main/resources/static/index.html b/sop-example/example-rest/src/main/resources/static/index.html new file mode 100644 index 00000000..e2d94a21 --- /dev/null +++ b/sop-example/example-rest/src/main/resources/static/index.html @@ -0,0 +1,6 @@ + + +

hello word!!!

+

this is a html page

+ + \ No newline at end of file diff --git a/sop-example/example-rest/src/test/java/com/sop/example/rest/examplerest/ExampleRestApplicationTests.java b/sop-example/example-rest/src/test/java/com/sop/example/rest/examplerest/ExampleRestApplicationTests.java new file mode 100644 index 00000000..8a044136 --- /dev/null +++ b/sop-example/example-rest/src/test/java/com/sop/example/rest/examplerest/ExampleRestApplicationTests.java @@ -0,0 +1,13 @@ +package com.sop.example.rest.examplerest; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class ExampleRestApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/sop-example/example-story/src/main/java/com/gitee/sop/storyweb/open/OpenStory.java b/sop-example/example-story/src/main/java/com/gitee/sop/storyweb/open/OpenStory.java deleted file mode 100755 index b3d49308..00000000 --- a/sop-example/example-story/src/main/java/com/gitee/sop/storyweb/open/OpenStory.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.gitee.sop.storyweb.open; - -import com.gitee.sop.storyweb.open.req.StorySaveRequest; -import com.gitee.sop.storyweb.open.resp.StoryResponse; -import com.gitee.sop.support.annotation.Open; -import com.gitee.sop.support.context.OpenContext; -import com.gitee.sop.support.dto.FileData; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.util.List; - -/** - * 故事服务 - * - * @author 六如 - * @dubbo - */ -@Api("故事服务") -public interface OpenStory { - - /** - * 新增故事 - * - * @param storySaveRequest 入参 - * @return 返回id - */ - @Open("story.save") - Integer save(StorySaveRequest storySaveRequest); - - @Open("story.update") - Integer update(Integer id, StorySaveRequest storySaveRequest); - - // 演示抛出异常 - @Open("story.updateError") - Integer updateError(Integer id); - - @ApiOperation(value = "根据id获取故事") - @Open("story.get") - StoryResponse getById(@NotNull(message = "id必填") Integer id); - - // 需要授权 - @Open(value = "story.get", version = "2.0", permission = true) - StoryResponse getByIdV2(Long id); - - @Open(value = "story.get.context") - StoryResponse getContext(Long id, OpenContext context); - - - // 默认方法,注解放在这里也有效 - @Open("story.find") - default StoryResponse getById(Integer id, String name) { - StoryResponse storyResponse = new StoryResponse(); - storyResponse.setId(id); - storyResponse.setName(name); - return storyResponse; - } - - // 默认方法,注解放在这里也有效 - @Open("alipay.story.find") - default StoryResponse findByName(String name) { - StoryResponse storyResponse = new StoryResponse(); - storyResponse.setName(name); - return storyResponse; - } - - // 演示单文件上传 - @Open("story.upload") - StoryResponse upload(StorySaveRequest storySaveRequest, FileData file); - - // 演示多文件上传 - @Open("story.upload.more") - StoryResponse upload2( - StorySaveRequest storySaveRequest, - @NotNull(message = "身份证正面必填") FileData idCardFront, - @NotNull(message = "身份证背面必填") FileData idCardBack - ); - - // 演示多文件上传 - @Open("story.upload.list") - StoryResponse upload3( - StorySaveRequest storySaveRequest, - @Size(min = 2, message = "最少上传2个文件") - List files - ); - - // 下载 - @Open("story.download") - FileData download(Integer id); -} diff --git a/sop-example/pom.xml b/sop-example/pom.xml index 3423bddb..fd4d2854 100755 --- a/sop-example/pom.xml +++ b/sop-example/pom.xml @@ -10,7 +10,8 @@ pom - example-story example-payment + example-product + example-rest diff --git a/sop-example/readme.md b/sop-example/readme.md index 19188575..21f6ee82 100755 --- a/sop-example/readme.md +++ b/sop-example/readme.md @@ -1,3 +1,5 @@ # 服务示例 -- sop-story:微服务示例 +- example-payment:微服务示例 +- example-product:微服务示例 +- example-rest:微服务示例,rest模式 diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/common/SopConstants.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/common/SopConstants.java index 96c4d80c..f494a140 100755 --- a/sop-gateway/src/main/java/com/gitee/sop/gateway/common/SopConstants.java +++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/common/SopConstants.java @@ -14,5 +14,8 @@ public final class SopConstants { public static final Charset CHARSET_UTF8 = StandardCharsets.UTF_8; public static final String UTF8 = "UTF-8"; public static final String NULL = "null"; + public static final String DUBBO_TAG = "dubbo.tag"; + public static final String OPEN_CONTEXT = "open.context"; + public static final String DEFAULT_VERSION = "1.0"; } diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/config/ApiConfig.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/config/ApiConfig.java index 04f2e4e1..df5b74e7 100755 --- a/sop-gateway/src/main/java/com/gitee/sop/gateway/config/ApiConfig.java +++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/config/ApiConfig.java @@ -91,4 +91,6 @@ public class ApiConfig { * 字段下划线小写形式 */ private Boolean fieldSnakeCase = false; + + private String headerKeyTag = "open-tag"; } diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/config/GatewayConfig.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/config/GatewayConfig.java index 32f520e4..cf069306 100755 --- a/sop-gateway/src/main/java/com/gitee/sop/gateway/config/GatewayConfig.java +++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/config/GatewayConfig.java @@ -4,6 +4,7 @@ import com.gitee.sop.gateway.service.ParamExecutor; import com.gitee.sop.gateway.service.RouteService; import com.gitee.sop.gateway.service.Serde; import com.gitee.sop.gateway.service.impl.ParamExecutorImpl; +import com.gitee.sop.gateway.service.impl.RestRouteServiceImpl; import com.gitee.sop.gateway.service.impl.RouteServiceImpl; import com.gitee.sop.gateway.service.impl.SerdeGsonImpl; import com.gitee.sop.gateway.service.impl.SerdeImpl; @@ -21,8 +22,8 @@ import com.gitee.sop.gateway.service.manager.impl.RedisIsvManagerImpl; import com.gitee.sop.gateway.service.manager.impl.RedisSecretManager; import com.gitee.sop.support.message.OpenMessageFactory; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -35,81 +36,60 @@ import javax.annotation.PostConstruct; @Slf4j public class GatewayConfig { + private static final String REDIS = "redis"; + @Bean - @ConditionalOnProperty(value = "gateway.manager.api", havingValue = "local", matchIfMissing = true) - public ApiManager localApiManager() { + public ApiManager localApiManager(@Value("${gateway.manager.api:local}") String gatewayManagerApi) { + if (REDIS.equalsIgnoreCase(gatewayManagerApi)) { + return new RedisApiManagerImpl(); + } return new LocalApiManagerImpl(); } - @Bean - @ConditionalOnProperty(value = "gateway.manager.api", havingValue = "redis") - public ApiManager redisApiManager() { - return new RedisApiManagerImpl(); - } @Bean - @ConditionalOnProperty(value = "gateway.manager.isv", havingValue = "local", matchIfMissing = true) - public IsvManager localIsvManager() { + public IsvManager localIsvManager(@Value("${gateway.manager.isv:local}") String gatewayManagerIsv) { + if (REDIS.equalsIgnoreCase(gatewayManagerIsv)) { + return new RedisIsvManagerImpl(); + } return new LocalIsvManagerImpl(); } @Bean - @ConditionalOnProperty(value = "gateway.manager.isv", havingValue = "redis") - public IsvManager redisIsvManager() { - return new RedisIsvManagerImpl(); - } - - @Bean - @ConditionalOnProperty(value = "gateway.manager.secret", havingValue = "local", matchIfMissing = true) - public SecretManager localSecretManager() { + public SecretManager localSecretManager(@Value("${gateway.manager.secret:local}") String gatewayManagerSecret) { + if (REDIS.equalsIgnoreCase(gatewayManagerSecret)) { + return new RedisSecretManager(); + } return new LocalSecretManagerImpl(); } @Bean - @ConditionalOnProperty(value = "gateway.manager.secret", havingValue = "redis") - public SecretManager redisSecretManager() { - return new RedisSecretManager(); - } - - @Bean - @ConditionalOnProperty(value = "gateway.manager.isv-api-perm", havingValue = "local", matchIfMissing = true) - public IsvApiPermissionManager localIsvApiPermissionManager() { + public IsvApiPermissionManager localIsvApiPermissionManager( + @Value("${gateway.manager.isv-api-perm:local}") String gatewayManagerIsvApiPrm + ) { + if (REDIS.equalsIgnoreCase(gatewayManagerIsvApiPrm)) { + return new RedisIsvApiPermissionManagerImpl(); + } return new LocalIsvApiPermissionManagerImpl(); } - @Bean - @ConditionalOnProperty(value = "gateway.manager.isv-api-perm", havingValue = "redis") - public IsvApiPermissionManager redisIsvApiPermissionManager() { - return new RedisIsvApiPermissionManagerImpl(); - } // 默认使用fastjson2序列化 @Bean - @ConditionalOnProperty(value = "gateway.serialize.json-formatter", havingValue = "fastjson2", matchIfMissing = true) - public Serde serdeFastjson2() { - log.info("[init]使用fastjson2序列化"); + public Serde serdeFastjson2(@Value("${gateway.serialize.json-formatter:fastjson2}") String gatewaySerializeJsonFormatter) { + log.info("[init]使用{}序列化", gatewaySerializeJsonFormatter); + if ("gson".equalsIgnoreCase(gatewaySerializeJsonFormatter)) { + return new SerdeGsonImpl(); + } return new SerdeImpl(); } - @Bean - @ConditionalOnProperty(value = "gateway.serialize.json-formatter", havingValue = "gson") - public Serde serdeGson() { - log.info("[init]使用gson序列化"); - return new SerdeGsonImpl(); - } - @Bean @ConditionalOnMissingBean public ParamExecutor paramExecutor() { return new ParamExecutorImpl(); } - @Bean - @ConditionalOnMissingBean - public RouteService routeService() { - return new RouteServiceImpl(); - } - @Bean @ConditionalOnMissingBean public Serde serde() { diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/controller/IndexController.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/controller/IndexController.java index 031f3f5a..196bf69b 100755 --- a/sop-gateway/src/main/java/com/gitee/sop/gateway/controller/IndexController.java +++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/controller/IndexController.java @@ -1,12 +1,16 @@ package com.gitee.sop.gateway.controller; +import com.gitee.sop.gateway.common.SopConstants; +import com.gitee.sop.gateway.request.ApiRequest; import com.gitee.sop.gateway.request.ApiRequestContext; import com.gitee.sop.gateway.response.Response; import com.gitee.sop.gateway.service.ParamExecutor; import com.gitee.sop.gateway.service.RouteService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -23,8 +27,13 @@ import java.io.IOException; public class IndexController { @Autowired + @Qualifier("routeService") private RouteService routeService; + @Autowired + @Qualifier("restRouteService") + private RouteService restRouteService; + @Autowired private ParamExecutor paramExecutor; @@ -39,19 +48,19 @@ public class IndexController { * 请求入口 * * @apiNote 参数描述 -
-    参数	            类型	    是否必填	    最大长度	    描述	            示例值
-    app_id	        String	是	        32	    平台分配给开发者的应用ID	2014072300007148
-    method	        String	是	        128	    接口名称	alipay.trade.fastpay.refund.query
-    format	        String	否	        40	    仅支持JSON	JSON
-    charset	        String	是	        10	    请求使用的编码格式,如utf-8,gbk,gb2312等	utf-8
-    sign_type	    String	是	        10	    商户生成签名字符串所使用的签名算法类型,目前支持RSA2和RSA,推荐使用RSA2	RSA2
-    sign	        String	是	        344	    商户请求参数的签名串,详见签名	详见示例
-    timestamp	    String	是	        19	    发送请求的时间,格式"yyyy-MM-dd HH:mm:ss"	2014-07-24 03:07:50
-    version	        String	是	        3	    调用的接口版本,固定为:1.0	1.0
-    app_auth_token	String	否	        40	    详见应用授权概述
-    biz_content	    String	是		请求参数的集合,最大长度不限,除公共参数外所有请求参数都必须放在这个参数中传递,具体参照各产品快速接入文档
-    
+ *
+     * 参数	            类型	    是否必填	    最大长度	    描述	            示例值
+     * app_id	        String	是	        32	    平台分配给开发者的应用ID	2014072300007148
+     * method	        String	是	        128	    接口名称	alipay.trade.fastpay.refund.query
+     * format	        String	否	        40	    仅支持JSON	JSON
+     * charset	        String	是	        10	    请求使用的编码格式,如utf-8,gbk,gb2312等	utf-8
+     * sign_type	    String	是	        10	    商户生成签名字符串所使用的签名算法类型,目前支持RSA2和RSA,推荐使用RSA2	RSA2
+     * sign	        String	是	        344	    商户请求参数的签名串,详见签名	详见示例
+     * timestamp	    String	是	        19	    发送请求的时间,格式"yyyy-MM-dd HH:mm:ss"	2014-07-24 03:07:50
+     * version	        String	是	        3	    调用的接口版本,固定为:1.0	1.0
+     * app_auth_token	String	否	        40	    详见应用授权概述
+     * biz_content	    String	是		请求参数的集合,最大长度不限,除公共参数外所有请求参数都必须放在这个参数中传递,具体参照各产品快速接入文档
+     * 
*/ @RequestMapping(value = "${gateway.path:/api}", method = {RequestMethod.GET, RequestMethod.POST}) public void index(HttpServletRequest request, HttpServletResponse response) throws IOException { @@ -60,4 +69,46 @@ public class IndexController { paramExecutor.write(apiRequestContext, apiResponse, response); } + /** + * restful请求 + * + * @param request + * @param response + * @param path 路径,对应@Open.value + * @param version 版本号 + * @throws IOException + */ + @RequestMapping(value = "${gateway.rest}/{path}/{version}") + public void rest0( + HttpServletRequest request, + HttpServletResponse response, + @PathVariable String path, + @PathVariable String version + ) throws IOException { + ApiRequestContext apiRequestContext = paramExecutor.build(request); + ApiRequest apiRequest = apiRequestContext.getApiRequest(); + apiRequest.setMethod(path); + apiRequest.setVersion(version); + apiRequestContext.setIsRest(true); + Response apiResponse = restRouteService.route(apiRequestContext); + paramExecutor.write(apiRequestContext, apiResponse, response); + } + + /** + * restful请求 + * + * @param request + * @param response + * @param path 路径,对应@Open.value + * @throws IOException + */ + @RequestMapping(value = "${gateway.rest}/{path}") + public void rest( + HttpServletRequest request, + HttpServletResponse response, + @PathVariable String path + ) throws IOException { + this.rest0(request, response, path, SopConstants.DEFAULT_VERSION); + } + } diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/exception/impl/ExceptionExecutorImpl.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/exception/impl/ExceptionExecutorImpl.java index e13b90d2..a376124d 100755 --- a/sop-gateway/src/main/java/com/gitee/sop/gateway/exception/impl/ExceptionExecutorImpl.java +++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/exception/impl/ExceptionExecutorImpl.java @@ -32,7 +32,7 @@ public class ExceptionExecutorImpl implements ExceptionExecutor { String exceptionClass = genericException.getExceptionClass(); if (exceptionClass.contains(CONSTRAINT_VIOLATION_EXCEPTION)) { String exceptionMessage = genericException.getExceptionMessage(); - // 参数校验:Failed to validate service: com.gitee.sop.storyweb.open.StoryService, method: save, cause: [ConstraintViolationImpl{interpolatedMessage='故事名称必填', propertyPath=storyName, rootBeanClass=class com.gitee.sop.storyweb.open.req.StorySaveDTO, messageTemplate='故事名称必填'}] + // 参数校验:Failed to validate service: com.gitee.sop.storyweb.open.StoryService, method: save, cause: [ConstraintViolationImpl{interpolatedMessage='故事名称必填', propertyPath=productName, rootBeanClass=class com.gitee.sop.storyweb.open.req.StorySaveDTO, messageTemplate='故事名称必填'}] Set msgs = findErrorMsg(exceptionMessage); return ApiResponse.error(ErrorEnum.ISV_ERROR_PARAMETER, apiRequestContext.getLocale(), String.join(",", msgs)); } diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/request/ApiRequestContext.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/request/ApiRequestContext.java index 21e4eed6..c1af6022 100755 --- a/sop-gateway/src/main/java/com/gitee/sop/gateway/request/ApiRequestContext.java +++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/request/ApiRequestContext.java @@ -1,5 +1,6 @@ package com.gitee.sop.gateway.request; +import com.alibaba.fastjson2.JSONObject; import lombok.Builder; import lombok.Getter; import lombok.Setter; @@ -33,4 +34,20 @@ public class ApiRequestContext { * 上传文件 */ private UploadContext uploadContext; + + /** + * 标签 + */ + private String tag; + + /** + * 是否需要签名校验 + */ + @Builder.Default + private Boolean isRest = false; + + /** + * 原始参数 + */ + private JSONObject rawParams; } diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/request/ApiRequestContextFactory.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/request/ApiRequestContextFactory.java deleted file mode 100755 index 22ca94a6..00000000 --- a/sop-gateway/src/main/java/com/gitee/sop/gateway/request/ApiRequestContextFactory.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.gitee.sop.gateway.request; - -import com.alibaba.fastjson2.JSON; -import com.alibaba.fastjson2.JSONObject; -import com.gitee.sop.gateway.common.SopConstants; -import com.gitee.sop.gateway.config.ApiConfig; -import com.gitee.sop.gateway.util.RequestUtil; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; - -import javax.servlet.http.HttpServletRequest; -import java.io.IOException; -import java.util.UUID; - -/** - * @author 六如 - */ -@Slf4j -public class ApiRequestContextFactory { - - private static final String CONTENT_TYPE = "content-type"; - private static final String JSON_NAME = "json"; - private static final String TEXT_NAME = "text"; - private static final String MULTIPART = "multipart"; - public static final String FORM = "form"; - - public static ApiRequestContext build(HttpServletRequest request, ApiConfig apiConfig) { - // get请求可能返回null - String contentType = request.getHeader(CONTENT_TYPE); - if (contentType == null) { - contentType = ""; - } - ApiRequest apiRequest = new ApiRequest(); - String ip = RequestUtil.getIP(request); - byte[] body; - try { - body = IOUtils.toByteArray(request.getInputStream()); - } catch (IOException e) { - log.error("获取请求体失败", e); - body = new byte[0]; - } - JSONObject params = null; - UploadContext uploadContext = null; - String contentTypeStr = contentType.toLowerCase(); - // 如果是json方式提交 - if (StringUtils.containsAny(contentTypeStr, JSON_NAME, TEXT_NAME)) { - params = JSON.parseObject(body); - } else if (StringUtils.containsIgnoreCase(contentTypeStr, MULTIPART)) { - // 如果是文件上传请求 - RequestUtil.UploadInfo uploadInfo = RequestUtil.getUploadInfo(request); - params = uploadInfo.getApiParam(); - uploadContext = uploadInfo.getUploadContext(); - } else if (StringUtils.containsIgnoreCase(contentTypeStr, FORM)) { - // APPLICATION_FORM_URLENCODED请求 - params = RequestUtil.parseQuerystring(new String(body, SopConstants.CHARSET_UTF8)); - } else { - // get请求,参数跟在url后面 - params = RequestUtil.parseParameterMap(request.getParameterMap()); - } - if (params != null) { - apiRequest = params.toJavaObject(ApiRequest.class); - } - - return ApiRequestContext.builder() - .apiRequest(apiRequest) - .locale(request.getLocale()) - .ip(ip) - .uploadContext(uploadContext) - .traceId(UUID.randomUUID().toString().replace("-", "")) - .build(); - } - -} diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/service/Serde.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/service/Serde.java index d1e765fd..4f1e9262 100755 --- a/sop-gateway/src/main/java/com/gitee/sop/gateway/service/Serde.java +++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/service/Serde.java @@ -18,6 +18,9 @@ public interface Serde { Map parseJson(String json); default JSONObject parseObject(String json) { + if (json == null) { + return null; + } Map jsonObj = parseJson(json); return jsonObj instanceof JSONObject ? (JSONObject) jsonObj : new JSONObject(jsonObj); } diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/service/impl/ParamExecutorImpl.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/service/impl/ParamExecutorImpl.java index 47705b43..75dd21a3 100755 --- a/sop-gateway/src/main/java/com/gitee/sop/gateway/service/impl/ParamExecutorImpl.java +++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/service/impl/ParamExecutorImpl.java @@ -82,31 +82,38 @@ public class ParamExecutorImpl implements ParamExecutor paramInfoList = JSON.parseArray(paramInfo, ParamInfoDTO.class); + OpenContext openRequest = buildOpenContext(apiRequestContext); + RpcContext.getClientAttachment().setAttachment(SopConstants.OPEN_CONTEXT, JSON.toJSONString(openRequest)); return genericServiceInvoker.invoke( apiInfo.getInterfaceClassName(), apiInfo.getMethodName(), buildParamType(paramInfoList), - buildInvokeParam(apiRequestContext, paramInfoList) + buildInvokeParam(apiRequestContext, paramInfoList, openRequest) ); } @@ -121,13 +138,14 @@ public class RouteServiceImpl implements RouteService { .toArray(String[]::new); } - protected Object[] buildInvokeParam(ApiRequestContext apiRequestContext, List paramInfoList) { + protected Object[] buildInvokeParam( + ApiRequestContext apiRequestContext, + List paramInfoList, + OpenContext openRequest) { if (ObjectUtils.isEmpty(paramInfoList)) { return new Object[0]; } - ApiRequest apiRequest = apiRequestContext.getApiRequest(); - String bizContent = apiRequest.getBizContent(); - JSONObject jsonObject = serde.parseObject(bizContent); + JSONObject jsonObject = getParamObject(apiRequestContext); List params = new ArrayList<>(); for (ParamInfoDTO paramInfoDTO : paramInfoList) { String type = paramInfoDTO.getType(); @@ -135,7 +153,6 @@ public class RouteServiceImpl implements RouteService { // 上下文 if (Objects.equals(type, OpenContext.class.getName())) { - OpenContext openRequest = buildOpenContext(apiRequestContext); params.add(openRequest); } else if (Objects.equals(type, FileData.class.getName()) || Objects.equals(actualType, FileData.class.getName())) { // 处理文件上传 @@ -156,7 +173,7 @@ public class RouteServiceImpl implements RouteService { } params.add(value); } catch (ClassNotFoundException e) { - log.error("找不到参数class, paramInfoDTO={}, apiRequest={}", paramInfoDTO, apiRequest, e); + log.error("找不到参数class, paramInfoDTO={}, apiRequest={}", paramInfoDTO, apiRequestContext.getApiRequest(), e); throw new RuntimeException("找不到class:" + type, e); } } else { @@ -167,6 +184,12 @@ public class RouteServiceImpl implements RouteService { return params.toArray(new Object[0]); } + protected JSONObject getParamObject(ApiRequestContext apiRequestContext) { + ApiRequest apiRequest = apiRequestContext.getApiRequest(); + String bizContent = apiRequest.getBizContent(); + return serde.parseObject(bizContent); + } + protected OpenContext buildOpenContext(ApiRequestContext apiRequestContext) { ApiRequest apiRequest = apiRequestContext.getApiRequest(); DefaultOpenContext defaultOpenRequest = new DefaultOpenContext(); @@ -178,6 +201,8 @@ public class RouteServiceImpl implements RouteService { defaultOpenRequest.setNotifyUrl(apiRequest.getNotifyUrl()); defaultOpenRequest.setTraceId(apiRequestContext.getTraceId()); defaultOpenRequest.setLocale(apiRequestContext.getLocale()); + + defaultOpenRequest.initContext(); return defaultOpenRequest; } diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/service/validate/ApiValidator.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/service/validate/ApiValidator.java index c2bb44a6..a433b845 100755 --- a/sop-gateway/src/main/java/com/gitee/sop/gateway/service/validate/ApiValidator.java +++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/service/validate/ApiValidator.java @@ -80,10 +80,16 @@ public class ApiValidator implements Validator { @Override public ApiInfoDTO validate(ApiRequestContext apiRequestContext) { + ApiRequest apiRequest = apiRequestContext.getApiRequest(); + ApiInfoDTO apiInfo = apiManager.get(apiRequest.getMethod(), apiRequest.getVersion()); + // 检查接口信息 + checkApiInfo(apiRequestContext, apiInfo); // 校验字段完整性 checkField(apiRequestContext); // 检查isv IsvDTO isvDTO = checkIsv(apiRequestContext); + // 检查isv接口授权 + checkPermission(apiRequestContext, apiInfo, isvDTO); // 校验签名 checkSign(apiRequestContext, isvDTO); // 检查是否超时 @@ -92,12 +98,6 @@ public class ApiValidator implements Validator { checkFormat(apiRequestContext); // IP能否访问 checkIP(apiRequestContext); - - ApiRequest apiRequest = apiRequestContext.getApiRequest(); - ApiInfoDTO apiInfo = apiManager.get(apiRequest.getMethod(), apiRequest.getVersion()); - // 检查接口信息 - checkApiInfo(apiRequestContext, apiInfo, isvDTO); - // 检查上传文件 checkUploadFile(apiRequestContext); // 检查token @@ -105,7 +105,22 @@ public class ApiValidator implements Validator { return apiInfo; } - public void checkApiInfo(ApiRequestContext apiRequestContext, ApiInfoDTO apiInfoDTO, IsvDTO isvDTO) { + @Override + public ApiInfoDTO validateRest(ApiRequestContext apiRequestContext) { + ApiRequest apiRequest = apiRequestContext.getApiRequest(); + ApiInfoDTO apiInfo = apiManager.get(apiRequest.getMethod(), apiRequest.getVersion()); + // 检查接口信息 + checkApiInfo(apiRequestContext, apiInfo); + // IP能否访问 + checkIP(apiRequestContext); + // 检查上传文件 + checkUploadFile(apiRequestContext); + // 检查token + checkToken(apiRequestContext); + return apiInfo; + } + + public void checkApiInfo(ApiRequestContext apiRequestContext, ApiInfoDTO apiInfoDTO) { // 检查路由是否存在 if (apiInfoDTO == null) { throw new ApiException(ErrorEnum.ISV_INVALID_METHOD, apiRequestContext.getLocale()); @@ -114,11 +129,12 @@ public class ApiValidator implements Validator { if (StatusEnum.of(apiInfoDTO.getStatus()) != StatusEnum.ENABLE) { throw new ApiException(ErrorEnum.ISP_API_DISABLED, apiRequestContext.getLocale()); } + } + + public void checkPermission(ApiRequestContext apiRequestContext, ApiInfoDTO apiInfoDTO, IsvDTO isvDTO) { // 校验是否需要授权访问 boolean needCheckPermission = BooleanUtils.toBoolean(apiInfoDTO.getIsPermission()); if (needCheckPermission) { - ApiRequest apiRequest = apiRequestContext.getApiRequest(); - String appKey = apiRequest.getAppId(); boolean hasPermission = isvApiPermissionManager.hasPermission(isvDTO.getId(), apiInfoDTO); if (!hasPermission) { throw new ApiException(ErrorEnum.ISV_ROUTE_NO_PERMISSIONS, apiRequestContext.getLocale()); diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/service/validate/Validator.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/service/validate/Validator.java index 9d84f207..804ccc67 100755 --- a/sop-gateway/src/main/java/com/gitee/sop/gateway/service/validate/Validator.java +++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/service/validate/Validator.java @@ -17,4 +17,12 @@ public interface Validator { */ ApiInfoDTO validate(ApiRequestContext apiRequestContext); + /** + * 校验rest + * + * @param apiRequestContext 请求内容 + * @return 校验通过返回路由信息 + */ + ApiInfoDTO validateRest(ApiRequestContext apiRequestContext); + } diff --git a/sop-gateway/src/main/resources/application.properties b/sop-gateway/src/main/resources/application.properties index 31d361aa..59e1bb14 100755 --- a/sop-gateway/src/main/resources/application.properties +++ b/sop-gateway/src/main/resources/application.properties @@ -5,6 +5,8 @@ server.port=8081 ####### gateway config ####### # request entry path gateway.path=/api +# restfull entry path +gateway.rest=/rest # manager cache type, local/redis gateway.manager.cache-type=local # api manager,local/redis diff --git a/sop-registry/pom.xml b/sop-registry/pom.xml index 391cb697..81c736e1 100755 --- a/sop-registry/pom.xml +++ b/sop-registry/pom.xml @@ -16,7 +16,7 @@ 8 UTF-8 - 3.2.10 + 3.2.16 diff --git a/sop-sdk/sdk-csharp/SDKCSharp/Model/GetStoryModel.cs b/sop-sdk/sdk-csharp/SDKCSharp/Model/GetStoryModel.cs old mode 100755 new mode 100644 index d214d79c..9010a9a0 --- a/sop-sdk/sdk-csharp/SDKCSharp/Model/GetStoryModel.cs +++ b/sop-sdk/sdk-csharp/SDKCSharp/Model/GetStoryModel.cs @@ -4,11 +4,12 @@ namespace SDKCSharp.Model { public class GetStoryModel { - /// - /// 故事名称 + + /// + /// id /// - /// The name. - [JsonProperty("name")] - public string Name { get; set; } + /// The id. + [JsonProperty("id")] + public int Id { get; set; } } } diff --git a/sop-sdk/sdk-csharp/SDKCSharp/Program.cs b/sop-sdk/sdk-csharp/SDKCSharp/Program.cs old mode 100755 new mode 100644 index d4966d6a..e43973ea --- a/sop-sdk/sdk-csharp/SDKCSharp/Program.cs +++ b/sop-sdk/sdk-csharp/SDKCSharp/Program.cs @@ -42,15 +42,15 @@ namespace SDKTest private static void TestGet() { // 创建请求对象 - GetStoryRequest request = new GetStoryRequest(); + GetProductRequest request = new GetProductRequest(); // 请求参数 GetStoryModel model = new GetStoryModel(); - model.Name = "白雪公主"; + model.Id = 1; request.BizModel = model; // 发送请求 - Result result = client.Execute(request); - + Result result = client.Execute(request); + if (result.IsSuccess()) { // 返回结果 diff --git a/sop-sdk/sdk-csharp/SDKCSharp/Request/GetStoryRequest.cs b/sop-sdk/sdk-csharp/SDKCSharp/Request/GetStoryRequest.cs deleted file mode 100755 index fc5896a2..00000000 --- a/sop-sdk/sdk-csharp/SDKCSharp/Request/GetStoryRequest.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using SDKCSharp.Common; -using SDKCSharp.Response; - -namespace SDKCSharp.Request -{ - public class GetStoryRequest : BaseRequest - { - public override string GetMethod() - { - return "alipay.story.find"; - } - } - -} diff --git a/sop-sdk/sdk-csharp/SDKCSharp/Response/GetStoryResponse.cs b/sop-sdk/sdk-csharp/SDKCSharp/Response/GetStoryResponse.cs deleted file mode 100755 index 8150e06a..00000000 --- a/sop-sdk/sdk-csharp/SDKCSharp/Response/GetStoryResponse.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using Newtonsoft.Json; - -namespace SDKCSharp.Response -{ - public class GetStoryResponse - { - [JsonProperty("id")] - public int Id { get; set; } - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("gmt_create")] - public string GmtCreate { get; set; } - - } -} diff --git a/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/model/DemoFileUploadModel.java b/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/model/DemoFileUploadModel.java index 81bc172b..c360423c 100755 --- a/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/model/DemoFileUploadModel.java +++ b/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/model/DemoFileUploadModel.java @@ -7,6 +7,6 @@ import lombok.Data; */ @Data public class DemoFileUploadModel { - private String storyName; + private String productName; private String addTime; } diff --git a/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/request/DemoFileUploadRequest.java b/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/request/DemoFileUploadRequest.java index 8a1658a8..efb92028 100755 --- a/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/request/DemoFileUploadRequest.java +++ b/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/request/DemoFileUploadRequest.java @@ -1,13 +1,13 @@ package com.gitee.sop.sdk.request; -import com.gitee.sop.sdk.response.GetStoryResponse; +import com.gitee.sop.sdk.response.GetProductResponse; /** * @author 六如 */ -public class DemoFileUploadRequest extends BaseRequest { +public class DemoFileUploadRequest extends BaseRequest { @Override protected String method() { - return "story.upload.more"; + return "product.upload.more"; } } diff --git a/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/request/GetProductRequest.java b/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/request/GetProductRequest.java new file mode 100755 index 00000000..36b1fef5 --- /dev/null +++ b/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/request/GetProductRequest.java @@ -0,0 +1,11 @@ +package com.gitee.sop.sdk.request; + +import com.gitee.sop.sdk.response.GetProductResponse; + +public class GetProductRequest extends BaseRequest { + @Override + protected String method() { + return "product.get"; + } + +} diff --git a/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/request/GetStoryRequest.java b/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/request/GetStoryRequest.java deleted file mode 100755 index 077d1e9f..00000000 --- a/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/request/GetStoryRequest.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.gitee.sop.sdk.request; - -import com.gitee.sop.sdk.response.GetStoryResponse; - -public class GetStoryRequest extends BaseRequest { - @Override - protected String method() { - return "story.get"; - } - -} diff --git a/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/response/GetStoryResponse.java b/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/response/GetProductResponse.java similarity index 82% rename from sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/response/GetStoryResponse.java rename to sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/response/GetProductResponse.java index 9912a867..2c1a6150 100755 --- a/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/response/GetStoryResponse.java +++ b/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/response/GetProductResponse.java @@ -5,7 +5,7 @@ import lombok.Data; import java.util.Date; @Data -public class GetStoryResponse { +public class GetProductResponse { private Long id; private String name; private Date addTime; diff --git a/sop-sdk/sdk-java/src/test/java/com/gitee/sop/sdk/SdkTest.java b/sop-sdk/sdk-java/src/test/java/com/gitee/sop/sdk/SdkTest.java index aba5aaa9..0dfe5a7f 100755 --- a/sop-sdk/sdk-java/src/test/java/com/gitee/sop/sdk/SdkTest.java +++ b/sop-sdk/sdk-java/src/test/java/com/gitee/sop/sdk/SdkTest.java @@ -7,17 +7,15 @@ import com.gitee.sop.sdk.common.UploadFile; import com.gitee.sop.sdk.model.DemoFileUploadModel; import com.gitee.sop.sdk.model.GetStoryModel; import com.gitee.sop.sdk.request.DemoFileUploadRequest; -import com.gitee.sop.sdk.request.GetStoryRequest; +import com.gitee.sop.sdk.request.GetProductRequest; import com.gitee.sop.sdk.request.PayTradeWapPayModel; import com.gitee.sop.sdk.request.PayTradeWapPayRequest; -import com.gitee.sop.sdk.response.DemoFileUploadResponse; -import com.gitee.sop.sdk.response.GetStoryResponse; +import com.gitee.sop.sdk.response.GetProductResponse; import java.io.File; import java.io.IOException; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.List; import com.gitee.sop.sdk.response.PayTradeWapPayResponse; import junit.framework.TestCase; @@ -62,17 +60,17 @@ public class SdkTest extends TestCase { @Test public void testGet() { // 创建请求对象 - GetStoryRequest request = new GetStoryRequest(); + GetProductRequest request = new GetProductRequest(); // 请求参数 GetStoryModel model = new GetStoryModel(); model.setId(1); request.setBizModel(model); // 发送请求 - Result result = client.execute(request); + Result result = client.execute(request); if (result.isSuccess()) { - GetStoryResponse response = result.getData(); + GetProductResponse response = result.getData(); // 返回结果 System.out.println(String.format("response:%s", JSON.toJSONString(response))); @@ -88,7 +86,7 @@ public class SdkTest extends TestCase { DemoFileUploadRequest request = new DemoFileUploadRequest(); DemoFileUploadModel model = new DemoFileUploadModel(); - model.setStoryName("上传文件参数"); + model.setProductName("上传文件参数"); model.setAddTime( new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); request.setBizModel(model); @@ -98,11 +96,11 @@ public class SdkTest extends TestCase { request.addFile(new UploadFile("idCardFront", new File(root + "/src/main/resources/file1.txt"))); request.addFile(new UploadFile("idCardBack", new File(root + "/src/main/resources/file2.txt"))); - Result result = client.execute(request); + Result result = client.execute(request); System.out.println("--------------------"); if (result.isSuccess()) { - GetStoryResponse response = result.getData(); + GetProductResponse response = result.getData(); System.out.println("您上传的文件信息:" + response); } else { System.out.println(JSON.toJSONString(result)); diff --git a/sop-support/sop-service-support/pom.xml b/sop-support/sop-service-support/pom.xml index 13883127..5e489a10 100755 --- a/sop-support/sop-service-support/pom.xml +++ b/sop-support/sop-service-support/pom.xml @@ -28,7 +28,7 @@ org.apache.dubbo dubbo - 3.2.10 + 3.2.16 true diff --git a/sop-support/sop-service-support/src/main/java/com/gitee/sop/support/context/DefaultOpenContext.java b/sop-support/sop-service-support/src/main/java/com/gitee/sop/support/context/DefaultOpenContext.java index 3aa01111..c557c62a 100755 --- a/sop-support/sop-service-support/src/main/java/com/gitee/sop/support/context/DefaultOpenContext.java +++ b/sop-support/sop-service-support/src/main/java/com/gitee/sop/support/context/DefaultOpenContext.java @@ -1,6 +1,7 @@ package com.gitee.sop.support.context; import lombok.Data; +import lombok.EqualsAndHashCode; import java.io.Serializable; import java.util.Locale; @@ -8,8 +9,9 @@ import java.util.Locale; /** * @author 六如 */ +@EqualsAndHashCode(callSuper = true) @Data -public class DefaultOpenContext implements OpenContext, Serializable { +public class DefaultOpenContext extends OpenContext implements Serializable { private static final long serialVersionUID = -3218354527911979685L; /** @@ -51,4 +53,8 @@ public class DefaultOpenContext implements OpenContext, Serializable { * locale */ private Locale locale; + + public void initContext() { + this.setContext(this); + } } diff --git a/sop-support/sop-service-support/src/main/java/com/gitee/sop/support/context/OpenContext.java b/sop-support/sop-service-support/src/main/java/com/gitee/sop/support/context/OpenContext.java index 8a6679b5..4a5fa4e8 100755 --- a/sop-support/sop-service-support/src/main/java/com/gitee/sop/support/context/OpenContext.java +++ b/sop-support/sop-service-support/src/main/java/com/gitee/sop/support/context/OpenContext.java @@ -1,50 +1,61 @@ package com.gitee.sop.support.context; +import com.alibaba.ttl.TransmittableThreadLocal; + import java.util.Locale; /** * @author 六如 */ -public interface OpenContext { +public abstract class OpenContext { + + private static final ThreadLocal THREAD_LOCAL = new TransmittableThreadLocal<>(); /** * 获取appId */ - String getAppId(); + public abstract String getAppId(); /** * 获取apiName */ - String getApiName(); + public abstract String getApiName(); /** * 获取version */ - String getVersion(); + public abstract String getVersion(); /** * 获取token,没有返回null */ - String getAppAuthToken(); + public abstract String getAppAuthToken(); /** * 获取客户端ip */ - String getClientIp(); + public abstract String getClientIp(); /** * 获取回调地址 */ - String getNotifyUrl(); + public abstract String getNotifyUrl(); /** * 获取唯一请求id */ - String getTraceId(); + public abstract String getTraceId(); /** * 获取locale */ - Locale getLocale(); + public abstract Locale getLocale(); + protected void setContext(OpenContext openContext) { + THREAD_LOCAL.set(openContext); + } + + public static OpenContext current() { + return THREAD_LOCAL.get(); + } } diff --git a/sop-support/sop-service-support/src/main/java/com/gitee/sop/support/dubbo/DubboProviderTraceFilter.java b/sop-support/sop-service-support/src/main/java/com/gitee/sop/support/dubbo/DubboProviderTraceFilter.java new file mode 100644 index 00000000..5623390b --- /dev/null +++ b/sop-support/sop-service-support/src/main/java/com/gitee/sop/support/dubbo/DubboProviderTraceFilter.java @@ -0,0 +1,70 @@ +package com.gitee.sop.support.dubbo; + +import com.alibaba.fastjson2.JSON; +import com.gitee.sop.support.context.DefaultOpenContext; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.common.constants.CommonConstants; +import org.apache.dubbo.common.extension.Activate; +import org.apache.dubbo.rpc.Filter; +import org.apache.dubbo.rpc.Invocation; +import org.apache.dubbo.rpc.Invoker; +import org.apache.dubbo.rpc.Result; +import org.apache.dubbo.rpc.RpcContext; +import org.apache.dubbo.rpc.RpcContextAttachment; +import org.apache.dubbo.rpc.RpcException; +import org.apache.dubbo.rpc.RpcServiceContext; + +/** + * @author 六如 + */ +@Slf4j +@Activate(group = {CommonConstants.PROVIDER}) +public class DubboProviderTraceFilter implements Filter { + + private static final String OPEN_CONTEXT = "open.context"; + + @Override + public Result invoke(Invoker invoker, Invocation invocation) throws RpcException { + initOpenContext(); + long startTime = System.currentTimeMillis(); + long endTime = 0; + try { + Result result = invoker.invoke(invocation); + endTime = System.currentTimeMillis(); + return result; + } finally { + trace(invocation, startTime, endTime); + } + } + + private void initOpenContext() { + // 从 ServerAttachment 中读取的参数是从 Client 中传递过来的 + RpcContextAttachment serverAttachment = RpcContext.getServerAttachment(); + String attachment = serverAttachment.getAttachment(OPEN_CONTEXT); + if (attachment != null) { + DefaultOpenContext defaultOpenContext = JSON.parseObject(attachment, DefaultOpenContext.class); + defaultOpenContext.initContext(); + } + } + + private void trace(Invocation invocation, long startTime, long endTime) { + // 如果是服务提供端 + RpcServiceContext serviceContext = RpcContext.getServiceContext(); + // 获取客户端IP + String fromIP = serviceContext.getRemoteHost(); + // 获取客户端应用名称 + String fromApp = serviceContext.getRemoteApplicationName(); + // 获取调用的接口 + String interfaceName = invocation.getInvoker().getInterface().getName(); + // 获取调用的方法 + String methodName = serviceContext.getMethodName(); + // 调用参数值 + String param = JSON.toJSONString(serviceContext.getArguments()); + // 超过500毫秒告警 + long spend = (endTime == 0 ? System.currentTimeMillis() : endTime) - startTime; + if (log.isWarnEnabled() && spend > 500) { + log.warn("[sop_trace][dubbo_server][time_warn] Dubbo 耗时告警({}ms), from={}({}), methodName={}.{}, param={}", + spend, fromApp, fromIP, interfaceName, methodName, param); + } + } +} diff --git a/sop-support/sop-service-support/src/main/java/com/gitee/sop/support/register/ApiRegister.java b/sop-support/sop-service-support/src/main/java/com/gitee/sop/support/register/ApiRegister.java index df0d9390..672aeb5a 100755 --- a/sop-support/sop-service-support/src/main/java/com/gitee/sop/support/register/ApiRegister.java +++ b/sop-support/sop-service-support/src/main/java/com/gitee/sop/support/register/ApiRegister.java @@ -11,6 +11,8 @@ import lombok.Data; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.dubbo.config.annotation.DubboService; +import org.springframework.core.DefaultParameterNameDiscoverer; +import org.springframework.util.StringUtils; import java.io.Serializable; import java.lang.reflect.Method; @@ -34,6 +36,12 @@ public class ApiRegister { private static final Log LOG = LogFactory.getLog(ApiRegister.class); + /** + * Spring自带的参数提取工具类 + */ + private static final DefaultParameterNameDiscoverer DISCOVERER = new DefaultParameterNameDiscoverer(); + + private final ApiRegisterService apiRegisterService; public ApiRegister(ApiRegisterService apiRegisterService) { @@ -106,7 +114,7 @@ public class ApiRegister { List paramInfos = buildParamInfo(method); RegisterDTO registerDTO = new RegisterDTO(); registerDTO.setApplication(appName); - registerDTO.setApiName(open.value()); + registerDTO.setApiName(getApiName(open)); registerDTO.setApiVersion(open.version()); registerDTO.setInterfaceClassName(interfaceClass.getName()); registerDTO.setMethodName(method.getName()); @@ -125,6 +133,10 @@ public class ApiRegister { } } + protected String getApiName(Open open) { + return StringUtils.trimLeadingCharacter(open.value(), '/'); + } + private List buildParamInfo(Method method) { Parameter[] parameters = method.getParameters(); if (parameters.length == 0) { diff --git a/sop-support/sop-service-support/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.Filter b/sop-support/sop-service-support/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.Filter new file mode 100644 index 00000000..eeccf4b2 --- /dev/null +++ b/sop-support/sop-service-support/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.Filter @@ -0,0 +1 @@ +dubboProviderTraceFilter=com.gitee.sop.support.dubbo.DubboProviderTraceFilter diff --git a/sop-support/sop-spring-boot-starter/pom.xml b/sop-support/sop-spring-boot-starter/pom.xml index dab96e2e..4411248b 100755 --- a/sop-support/sop-spring-boot-starter/pom.xml +++ b/sop-support/sop-spring-boot-starter/pom.xml @@ -14,7 +14,7 @@ UTF-8 2.3.12.RELEASE - 3.2.10 + 3.2.16 diff --git a/sop-test/src/main/java/com/gitee/sop/test/Client.java b/sop-test/src/main/java/com/gitee/sop/test/Client.java index 4550aa22..077294d3 100755 --- a/sop-test/src/main/java/com/gitee/sop/test/Client.java +++ b/sop-test/src/main/java/com/gitee/sop/test/Client.java @@ -12,6 +12,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -268,6 +269,21 @@ public class Client { return this; } + /** + * 设置请求头 + * + * @param key 请求头key + * @param value 请求头value + * @return 返回RequestBuilder + */ + public RequestBuilder header(String key, String value) { + if (this.header == null) { + this.header = new LinkedHashMap<>(8); + } + header.put(key, value); + return this; + } + /** * 是否忽略签名验证 * diff --git a/sop-test/src/test/java/com/gitee/sop/test/AlipayClientPostTest.java b/sop-test/src/test/java/com/gitee/sop/test/AlipayClientPostTest.java index 9dafa502..56d3f978 100755 --- a/sop-test/src/test/java/com/gitee/sop/test/AlipayClientPostTest.java +++ b/sop-test/src/test/java/com/gitee/sop/test/AlipayClientPostTest.java @@ -2,6 +2,7 @@ package com.gitee.sop.test; import com.alibaba.fastjson.JSON; import com.gitee.sop.test.sign.AlipaySignature; +import okhttp3.internal.http2.Header; import org.junit.Test; import java.text.SimpleDateFormat; @@ -77,8 +78,8 @@ public class AlipayClientPostTest extends TestBase { // 公共请求参数 Map params = new HashMap(); params.put("app_id", appId); - params.put("method", "story.get"); - params.put("format", "xml"); // xml + params.put("method", "pay.trade.wap.pay"); + params.put("format", "xml"); params.put("charset", "utf-8"); params.put("sign_type", "RSA2"); params.put("timestamp", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); @@ -86,44 +87,10 @@ public class AlipayClientPostTest extends TestBase { // 业务参数 Map bizContent = new HashMap<>(); - bizContent.put("id", "1"); - bizContent.put("name", "葫芦娃"); - - params.put("biz_content", JSON.toJSONString(bizContent)); - String content = AlipaySignature.getSignContent(params); - String sign = AlipaySignature.rsa256Sign(content, privateKey, "utf-8"); - params.put("sign", sign); - - System.out.println("----------- 请求信息 -----------"); - System.out.println("请求参数:" + buildParamQuery(params)); - System.out.println("商户秘钥:" + privateKey); - System.out.println("待签名内容:" + content); - System.out.println("签名(sign):" + sign); - System.out.println("URL参数:" + buildUrlQuery(params)); - - System.out.println("----------- 返回结果 -----------"); - String responseData = postJson(url, params);// 发送请求 - // 0success乌鸦喝水1 - System.out.println(responseData); - } - - @Test - public void testFind() throws Exception { - - // 公共请求参数 - Map params = new HashMap(); - params.put("app_id", appId); - params.put("method", "story.find"); - params.put("format", "json"); - params.put("charset", "utf-8"); - params.put("sign_type", "RSA2"); - params.put("timestamp", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); - params.put("version", "1.0"); - - // 业务参数 - Map bizContent = new HashMap<>(); - bizContent.put("id", "122"); - bizContent.put("name", "葫芦娃"); + bizContent.put("outTradeNo", "70501111111S001111119"); + bizContent.put("totalAmount", "9.00"); + bizContent.put("subject", "衣服"); + bizContent.put("productCode", "QUICK_WAP_WAY"); params.put("biz_content", JSON.toJSONString(bizContent)); String content = AlipaySignature.getSignContent(params); @@ -143,12 +110,12 @@ public class AlipayClientPostTest extends TestBase { } @Test - public void testSave() throws Exception { + public void testSearch() throws Exception { // 公共请求参数 Map params = new HashMap(); params.put("app_id", appId); - params.put("method", "story.save"); + params.put("method", "pay.order.search"); params.put("format", "json"); params.put("charset", "utf-8"); params.put("sign_type", "RSA2"); @@ -157,8 +124,7 @@ public class AlipayClientPostTest extends TestBase { // 业务参数 Map bizContent = new HashMap<>(); - bizContent.put("storyName", "小猫钓鱼"); - bizContent.put("addTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + bizContent.put("orderNo", "70501111111S001111119"); params.put("biz_content", JSON.toJSONString(bizContent)); String content = AlipaySignature.getSignContent(params); @@ -173,45 +139,10 @@ public class AlipayClientPostTest extends TestBase { System.out.println("URL参数:" + buildUrlQuery(params)); System.out.println("----------- 返回结果 -----------"); - String responseData = postJson(url, params);// 发送请求 + Header[] header = {new Header("open-env", "gray")}; +// Header[] header = new Header[0]; + String responseData = postJson(url, params, header);// 发送请求 System.out.println(responseData); } - @Test - public void testUpdate() throws Exception { - - // 公共请求参数 - Map params = new HashMap(); - params.put("app_id", appId); - params.put("method", "story.update"); - params.put("format", "json"); - params.put("charset", "utf-8"); - params.put("sign_type", "RSA2"); - params.put("timestamp", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); - params.put("version", "1.0"); - - // 业务参数 - Map bizContent = new HashMap<>(); - bizContent.put("id", "1"); - bizContent.put("storyName", "花仙子"); - bizContent.put("addTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); - - params.put("biz_content", JSON.toJSONString(bizContent)); - String content = AlipaySignature.getSignContent(params); - String sign = AlipaySignature.rsa256Sign(content, privateKey, "utf-8"); - params.put("sign", sign); - - System.out.println("----------- 请求信息 -----------"); - System.out.println("请求参数:" + buildParamQuery(params)); - System.out.println("商户秘钥:" + privateKey); - System.out.println("待签名内容:" + content); - System.out.println("签名(sign):" + sign); - System.out.println("URL参数:" + buildUrlQuery(params)); - - System.out.println("----------- 返回结果 -----------"); - String responseData = postJson(url, params);// 发送请求 - System.out.println(responseData); - } - - } diff --git a/sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java b/sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java index 94c2a86f..64612831 100755 --- a/sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java +++ b/sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java @@ -34,7 +34,21 @@ public class AllInOneTest extends TestBase { */ public void testGet() { Client.RequestBuilder requestBuilder = new Client.RequestBuilder() - .method("story.get") + .method("product.get") + .version("1.0") + .bizContent(new BizContent().add("id", "1")) + .httpMethod(HttpTool.HTTPMethod.GET); + + client.execute(requestBuilder); + } + + /** + * 以get方式提交 + */ + public void testGetGray() { + Client.RequestBuilder requestBuilder = new Client.RequestBuilder() + .method("product.get") + .header("open-env", "gray") .version("1.0") .bizContent(new BizContent().add("id", "1")) .httpMethod(HttpTool.HTTPMethod.GET); @@ -47,9 +61,9 @@ public class AllInOneTest extends TestBase { */ public void testPostForm() { Client.RequestBuilder requestBuilder = new Client.RequestBuilder() - .method("story.get") + .method("product.get") .version("1.0") - .bizContent(new BizContent().add("id", "1").add("name", "葫芦娃")) + .bizContent(new BizContent().add("id", "1").add("name", "彩电")) .httpMethod(HttpTool.HTTPMethod.POST); client.execute(requestBuilder); @@ -60,11 +74,11 @@ public class AllInOneTest extends TestBase { */ public void testPostJSON() { Client.RequestBuilder requestBuilder = new Client.RequestBuilder() - .method("story.get") + .method("product.get") .version("1.0") // 以json方式提交 .postJson(true) - .bizContent(new BizContent().add("id", "1").add("name", "葫芦娃")); + .bizContent(new BizContent().add("id", "1").add("name", "彩电")); client.execute(requestBuilder); } @@ -79,12 +93,12 @@ public class AllInOneTest extends TestBase { header.put("Accept-Language", "en-US"); // header.put("Accept-Language", "zh-CN"); Client.RequestBuilder requestBuilder = new Client.RequestBuilder() - .method("story.updateError") + .method("product.updateError") .version("1.0") .header(header) // 以json方式提交 .postJson(true) - .bizContent(new BizContent().add("id", "0").add("name", "葫芦娃")) + .bizContent(new BizContent().add("id", "0").add("name", "彩电")) .callback((requestInfo, responseData) -> { System.out.println(responseData); JSONObject jsonObject = JSON.parseObject(responseData); @@ -100,9 +114,9 @@ public class AllInOneTest extends TestBase { */ public void testGet_v2() { Client.RequestBuilder requestBuilder = new Client.RequestBuilder() - .method("story.get") + .method("product.get") .version("2.0") - .bizContent(new BizContent().add("id", "2").add("name", "葫芦娃2")) + .bizContent(new BizContent().add("id", "2").add("name", "电脑")) .httpMethod(HttpTool.HTTPMethod.GET) .callback((requestInfo, responseData) -> { System.out.println(responseData); @@ -118,10 +132,10 @@ public class AllInOneTest extends TestBase { */ public void testGetContext() { Client.RequestBuilder requestBuilder = new Client.RequestBuilder() - .method("story.get.context") + .method("product.get.context") .version("1.0") .notifyUrl("http://www.baidu.com") - .bizContent(new BizContent().add("id", "2").add("name", "葫芦娃2")) + .bizContent(new BizContent().add("id", "2").add("name", "电脑")) .httpMethod(HttpTool.HTTPMethod.GET) .callback((requestInfo, responseData) -> { System.out.println(responseData); @@ -138,7 +152,7 @@ public class AllInOneTest extends TestBase { */ public void testPermission() { Client.RequestBuilder requestBuilder = new Client.RequestBuilder() - .method("story.get.permission") + .method("product.get.permission") .version("1.0") .bizContent(new BizContent()) .httpMethod(HttpTool.HTTPMethod.GET) @@ -159,10 +173,10 @@ public class AllInOneTest extends TestBase { Client client = new Client(url, appId, privateKey); String root = System.getProperty("user.dir"); Client.RequestBuilder requestBuilder = new Client.RequestBuilder() - .method("story.upload") + .method("product.upload") .version("1.0") .bizContent( - new BizContent().add("storyName", "白雪公主") + new BizContent().add("productName", "冰箱") .add("addTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())) ) // 添加文件 @@ -181,10 +195,10 @@ public class AllInOneTest extends TestBase { Client client = new Client(url, appId, privateKey); String root = System.getProperty("user.dir"); Client.RequestBuilder requestBuilder = new Client.RequestBuilder() - .method("story.upload.more") + .method("product.upload.more") .version("1.0") .bizContent( - new BizContent().add("storyName", "白雪公主") + new BizContent().add("productName", "冰箱") .add("addTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())) ) // 添加文件 @@ -203,10 +217,10 @@ public class AllInOneTest extends TestBase { public void testFileList() { String root = System.getProperty("user.dir"); Client.RequestBuilder requestBuilder = new Client.RequestBuilder() - .method("story.upload.list") + .method("product.upload.list") .version("1.0") .bizContent( - new BizContent().add("storyName", "白雪公主") + new BizContent().add("productName", "冰箱") .add("addTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())) ) // 添加文件 @@ -223,7 +237,7 @@ public class AllInOneTest extends TestBase { Client client = new Client(url, appId, privateKey); String root = System.getProperty("user.dir"); Client.RequestBuilder requestBuilder = new Client.RequestBuilder() - .method("story.upload") + .method("product.upload") .version("1.0") .bizContent(new BizContent().add("remark", "test file upload")) // 添加文件, 这个文件1.5M,上传会报错 @@ -243,10 +257,10 @@ public class AllInOneTest extends TestBase { public void testFileMaxSize() { String root = System.getProperty("user.dir"); Client.RequestBuilder requestBuilder = new Client.RequestBuilder() - .method("story.upload.list") + .method("product.upload.list") .version("1.0") .bizContent( - new BizContent().add("storyName", "白雪公主") + new BizContent().add("productName", "冰箱") .add("addTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())) ) .callback((requestInfo, responseData) -> { @@ -274,7 +288,7 @@ public class AllInOneTest extends TestBase { File file = new File(root + "/src/main/resources/large_data.txt"); String fileContent = FileUtils.readFileToString(file, StandardCharsets.UTF_8); Client.RequestBuilder requestBuilder = new Client.RequestBuilder() - .method("story.find") + .method("product.find") .version("1.0") .bizContent(new BizContent().add("id", 111)) .bizContent(new BizContent().add("name", fileContent)) @@ -288,7 +302,7 @@ public class AllInOneTest extends TestBase { */ public void testDownloadFile() throws IOException { Client.RequestBuilder requestBuilder = new Client.RequestBuilder() - .method("story.download") + .method("product.download") .version("1.0") .bizContent(new BizContent().add("id", 1)) .httpMethod(HttpTool.HTTPMethod.GET); @@ -302,10 +316,10 @@ public class AllInOneTest extends TestBase { public void testToken() { Client.RequestBuilder requestBuilder = new Client.RequestBuilder() - .method("story.save") + .method("product.save") .version("1.0") .bizContent( - new BizContent().add("storyName", "白雪公主") + new BizContent().add("productName", "冰箱") .add("addTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())) ) .appAuthToken("asdfasdfadsf") @@ -322,10 +336,10 @@ public class AllInOneTest extends TestBase { Map header = new HashMap<>(4); header.put("Accept-Language", "en-US"); Client.RequestBuilder requestBuilder = new Client.RequestBuilder() - .method("story.get==") // 制造错误的接口名 + .method("product.get==") // 制造错误的接口名 .version("1.0") .header(header) - .bizContent(new BizContent().add("id", "1").add("name", "葫芦娃")) + .bizContent(new BizContent().add("id", "1").add("name", "彩电")) .httpMethod(HttpTool.HTTPMethod.GET) .callback((requestInfo, responseData) -> { System.out.println(responseData); diff --git a/sop-test/src/test/java/com/gitee/sop/test/TestBase.java b/sop-test/src/test/java/com/gitee/sop/test/TestBase.java index f123df85..81652a8f 100755 --- a/sop-test/src/test/java/com/gitee/sop/test/TestBase.java +++ b/sop-test/src/test/java/com/gitee/sop/test/TestBase.java @@ -2,12 +2,14 @@ package com.gitee.sop.test; import com.alibaba.fastjson.JSON; import junit.framework.TestCase; +import okhttp3.internal.http2.Header; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.Collections; +import java.util.LinkedHashMap; import java.util.Map; /** @@ -31,9 +33,13 @@ public class TestBase extends TestCase { } } - public static String postJson(String url, Map params) { + public static String postJson(String url, Map params, Header... headers) { try { - return httpTool.requestJson(url, JSON.toJSONString(params), Collections.emptyMap()); + Map headerMap = new LinkedHashMap<>(); + for (Header header : headers) { + headerMap.put(header.name.utf8(), header.value.utf8()); + } + return httpTool.requestJson(url, JSON.toJSONString(params), headerMap); } catch (IOException e) { throw new RuntimeException("网络请求异常", e); } diff --git a/sop.sql b/sop.sql index 08ed61ee..984cd3d9 100755 --- a/sop.sql +++ b/sop.sql @@ -2,288 +2,329 @@ CREATE DATABASE IF NOT EXISTS `sop` DEFAULT CHARACTER SET utf8mb4; USE `sop`; +DROP TABLE IF EXISTS `api_info`; CREATE TABLE `api_info` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `application` varchar(64) NOT NULL DEFAULT '' COMMENT '应用名称', - `api_name` varchar(128) NOT NULL DEFAULT '' COMMENT '接口名称', - `api_version` varchar(16) NOT NULL DEFAULT '1.0' COMMENT '版本号', - `description` varchar(64) DEFAULT '' COMMENT '接口描述', - `remark` text COMMENT '备注', - `interface_class_name` varchar(128) NOT NULL DEFAULT '' COMMENT '接口class', - `method_name` varchar(128) NOT NULL DEFAULT '' COMMENT '方法名称', - `param_info` text COMMENT '参数信息', - `is_permission` tinyint(4) NOT NULL DEFAULT '0' COMMENT '接口是否需要授权访问', - `is_need_Token` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否需要appAuthToken', - `has_common_response` tinyint(4) DEFAULT '1' COMMENT '是否有公共响应参数', - `reg_source` tinyint(4) NOT NULL DEFAULT '1' COMMENT '注册来源,1-系统注册,2-手动注册', - `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1启用,0禁用', - `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', - PRIMARY KEY (`id`), - UNIQUE KEY `uk_apiname_version` (`api_name`,`api_version`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=25 COMMENT='接口信息表'; + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `application` varchar(64) NOT NULL DEFAULT '' COMMENT '应用名称', + `api_name` varchar(128) NOT NULL DEFAULT '' COMMENT '接口名称', + `api_version` varchar(16) NOT NULL DEFAULT '1.0' COMMENT '版本号', + `description` varchar(64) DEFAULT '' COMMENT '接口描述', + `remark` text COMMENT '备注', + `interface_class_name` varchar(128) NOT NULL DEFAULT '' COMMENT '接口class', + `method_name` varchar(128) NOT NULL DEFAULT '' COMMENT '方法名称', + `param_info` text COMMENT '参数信息', + `is_permission` tinyint(4) NOT NULL DEFAULT '0' COMMENT '接口是否需要授权访问', + `is_need_Token` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否需要appAuthToken', + `has_common_response` tinyint(4) DEFAULT '1' COMMENT '是否有公共响应参数', + `reg_source` tinyint(4) NOT NULL DEFAULT '1' COMMENT '注册来源,1-系统注册,2-手动注册', + `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1启用,0禁用', + `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_apiname_version` (`api_name`,`api_version`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf32 COMMENT='接口信息表'; +DROP TABLE IF EXISTS `doc_app`; CREATE TABLE `doc_app` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `app_name` varchar(64) NOT NULL COMMENT '应用名称', - `token` varchar(64) NOT NULL COMMENT 'Torna应用token', - `is_publish` tinyint(4) DEFAULT '0' COMMENT '是否发布', - `add_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5 COMMENT='文档应用'; + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `app_name` varchar(64) NOT NULL COMMENT '应用名称', + `token` varchar(64) NOT NULL COMMENT 'Torna应用token', + `is_publish` tinyint(4) DEFAULT '0' COMMENT '是否发布', + `add_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf32 COMMENT='文档应用'; +DROP TABLE IF EXISTS `doc_content`; CREATE TABLE `doc_content` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `doc_info_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'doc_info.id', - `content` longtext COMMENT '文档内容', - `add_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=8 COMMENT='文档内容'; + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `doc_info_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'doc_info.id', + `content` longtext COMMENT '文档内容', + `add_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`), + KEY `idx_doc_info_id` (`doc_info_id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf32 COMMENT='文档内容'; +DROP TABLE IF EXISTS `doc_info`; CREATE TABLE `doc_info` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `doc_app_id` bigint(20) NOT NULL COMMENT 'doc_app.id', - `doc_title` varchar(128) NOT NULL COMMENT '文档标题', - `doc_id` bigint(20) NOT NULL COMMENT '文档id', - `doc_code` varchar(64) DEFAULT '' COMMENT '文档code', - `doc_type` int(10) DEFAULT '1' COMMENT '文档类型,1-dubbo,2-富文本,3-Markdown', - `source_type` int(10) DEFAULT '1' COMMENT '来源类型,1-torna,2-自建', - `doc_version` varchar(16) NOT NULL COMMENT '文档版本号', - `doc_name` varchar(64) NOT NULL COMMENT '文档名称', - `description` text NOT NULL COMMENT '描述', - `is_folder` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '是否分类', - `is_publish` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '状态, 0-未发布,1-已发布', - `parent_id` bigint(20) NOT NULL COMMENT '父节点id', - `add_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=27 COMMENT='文档信息'; + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `doc_app_id` bigint(20) NOT NULL COMMENT 'doc_app.id', + `doc_title` varchar(128) NOT NULL COMMENT '文档标题', + `doc_id` bigint(20) NOT NULL COMMENT '文档id', + `doc_code` varchar(64) DEFAULT '' COMMENT '文档code', + `doc_type` int(10) DEFAULT '1' COMMENT '文档类型,1-dubbo,2-富文本,3-Markdown', + `source_type` int(10) DEFAULT '1' COMMENT '来源类型,1-torna,2-自建', + `doc_version` varchar(16) NOT NULL COMMENT '文档版本号', + `doc_name` varchar(64) NOT NULL COMMENT '文档名称', + `description` text NOT NULL COMMENT '描述', + `is_folder` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '是否分类', + `is_publish` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '状态, 0-未发布,1-已发布', + `parent_id` bigint(20) NOT NULL COMMENT '父节点id', + `add_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`), + KEY `idx_doc_app_id` (`doc_app_id`) USING BTREE, + KEY `idx_doc_id` (`doc_id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf32 COMMENT='文档信息'; +DROP TABLE IF EXISTS `isv_info`; CREATE TABLE `isv_info` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `app_id` varchar(100) NOT NULL COMMENT 'appKey', - `status` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '1启用,2禁用', - `remark` varchar(512) DEFAULT NULL COMMENT '备注', - `add_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', - PRIMARY KEY (`id`), - UNIQUE KEY `uk_appid` (`app_id`) -) ENGINE=InnoDB AUTO_INCREMENT=6 COMMENT='isv信息表'; + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `app_id` varchar(100) NOT NULL COMMENT 'appKey', + `status` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '1启用,2禁用', + `remark` varchar(512) DEFAULT NULL COMMENT '备注', + `add_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_appid` (`app_id`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf32 COMMENT='isv信息表'; +DROP TABLE IF EXISTS `isv_keys`; CREATE TABLE `isv_keys` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `isv_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'isv_info.id', - `key_format` tinyint(4) NOT NULL DEFAULT '1' COMMENT '秘钥格式,1:PKCS8(JAVA适用),2:PKCS1(非JAVA适用)', - `public_key_isv` text NOT NULL COMMENT '开发者生成的公钥', - `private_key_isv` text NOT NULL COMMENT '开发者生成的私钥(交给开发者)', - `public_key_platform` text NOT NULL COMMENT '平台生成的公钥(交给开发者)', - `private_key_platform` text NOT NULL COMMENT '平台生成的私钥', - `add_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', - PRIMARY KEY (`id`), - UNIQUE KEY `uk_appid` (`isv_id`) USING BTREE + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `isv_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'isv_info.id', + `key_format` tinyint(4) NOT NULL DEFAULT '1' COMMENT '秘钥格式,1:PKCS8(JAVA适用),2:PKCS1(非JAVA适用)', + `public_key_isv` text NOT NULL COMMENT '开发者生成的公钥', + `private_key_isv` text NOT NULL COMMENT '开发者生成的私钥(交给开发者)', + `public_key_platform` text NOT NULL COMMENT '平台生成的公钥(交给开发者)', + `private_key_platform` text NOT NULL COMMENT '平台生成的私钥', + `add_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_appid` (`isv_id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8 COMMENT='ISV秘钥管理'; +DROP TABLE IF EXISTS `perm_group`; CREATE TABLE `perm_group` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `group_name` varchar(64) NOT NULL COMMENT '分组描述', - `is_deleted` tinyint(4) DEFAULT '0' COMMENT '是否删除', - `add_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 COMMENT='分组表'; + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `group_name` varchar(64) NOT NULL COMMENT '分组描述', + `is_deleted` tinyint(4) DEFAULT '0' COMMENT '是否删除', + `add_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf32 COMMENT='分组表'; +DROP TABLE IF EXISTS `perm_group_permission`; CREATE TABLE `perm_group_permission` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `group_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'perm_group.id', - `api_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'api_info.id', - `add_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', - PRIMARY KEY (`id`), - UNIQUE KEY `uk_apiid_groupid` (`api_id`,`group_id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=16 COMMENT='组权限表'; + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `group_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'perm_group.id', + `api_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'api_info.id', + `add_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_apiid_groupid` (`api_id`,`group_id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf32 COMMENT='组权限表'; +DROP TABLE IF EXISTS `perm_isv_group`; CREATE TABLE `perm_isv_group` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `isv_id` bigint(20) NOT NULL COMMENT 'isv_info表id', - `group_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'perm_group.id', - `add_time` datetime DEFAULT CURRENT_TIMESTAMP, - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', - PRIMARY KEY (`id`), - UNIQUE KEY `uk_isvid_groupid` (`isv_id`,`group_id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=13 COMMENT='isv分组'; + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `isv_id` bigint(20) NOT NULL COMMENT 'isv_info表id', + `group_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'perm_group.id', + `add_time` datetime DEFAULT CURRENT_TIMESTAMP, + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_isvid_groupid` (`isv_id`,`group_id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf32 COMMENT='isv分组'; +DROP TABLE IF EXISTS `sys_admin_user`; +CREATE TABLE `sys_admin_user` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `username` varchar(128) NOT NULL DEFAULT '' COMMENT '用户名', + `password` varchar(128) NOT NULL DEFAULT '' COMMENT '密码', + `nickname` varchar(64) NOT NULL DEFAULT '' COMMENT '用户名', + `email` varchar(128) NOT NULL DEFAULT '' COMMENT '邮箱', + `avatar` varchar(128) NOT NULL DEFAULT '' COMMENT '头像', + `status` tinyint(4) unsigned NOT NULL DEFAULT '1' COMMENT '状态,1:启用,2:禁用', + `reg_type` varchar(32) NOT NULL DEFAULT '1' COMMENT '注册类型,1-系统,2-手动', + `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_username` (`username`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf32 COMMENT='系统用户表'; + +DROP TABLE IF EXISTS `sys_config`; CREATE TABLE `sys_config` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', - `config_key` varchar(64) NOT NULL DEFAULT '' COMMENT '配置key', - `config_value` varchar(256) NOT NULL DEFAULT '' COMMENT '配置值', - `remark` varchar(128) NOT NULL DEFAULT '' COMMENT '备注', - `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除', - `add_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '最后更新人id', - PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `uk_configkey` (`config_key`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=7 COMMENT='系统配置表'; + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', + `config_key` varchar(64) NOT NULL DEFAULT '' COMMENT '配置key', + `config_value` varchar(256) NOT NULL DEFAULT '' COMMENT '配置值', + `remark` varchar(128) NOT NULL DEFAULT '' COMMENT '备注', + `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除', + `add_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '最后更新人id', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `uk_configkey` (`config_key`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf32 COMMENT='系统配置表'; +DROP TABLE IF EXISTS `sys_dept`; CREATE TABLE `sys_dept` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `name` varchar(64) NOT NULL DEFAULT '' COMMENT '部门名称', - `sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序', - `status` tinyint(4) unsigned NOT NULL DEFAULT '1' COMMENT '状态,1:启用,2:禁用', - `remark` varchar(64) NOT NULL DEFAULT '' COMMENT '备注', - `parent_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '父级id', - `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 COMMENT='部门表'; + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `name` varchar(64) NOT NULL DEFAULT '' COMMENT '部门名称', + `sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序', + `status` tinyint(4) unsigned NOT NULL DEFAULT '1' COMMENT '状态,1:启用,2:禁用', + `remark` varchar(64) NOT NULL DEFAULT '' COMMENT '备注', + `parent_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '父级id', + `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf32 COMMENT='部门表'; +DROP TABLE IF EXISTS `sys_resource`; CREATE TABLE `sys_resource` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `menu_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '菜单类型(0代表菜单、1代表iframe、2代表外链、3代表按钮)', - `title` varchar(64) DEFAULT NULL COMMENT '菜单名称', - `name` varchar(64) DEFAULT NULL COMMENT '路由名称', - `path` varchar(128) DEFAULT NULL COMMENT '路由路径', - `component` varchar(128) DEFAULT NULL COMMENT '路由路径', - `rank` int(11) DEFAULT NULL COMMENT '排序', - `redirect` varchar(128) DEFAULT NULL COMMENT '路由重定向', - `icon` varchar(128) DEFAULT NULL COMMENT '菜单图标', - `extra_icon` varchar(64) DEFAULT NULL COMMENT '右侧图标', - `enter_transition` varchar(64) DEFAULT NULL COMMENT '进场动画(页面加载动画)', - `leave_transition` varchar(64) DEFAULT NULL COMMENT '离场动画(页面加载动画)', - `active_path` varchar(64) DEFAULT NULL COMMENT '菜单激活', - `auths` varchar(64) DEFAULT NULL COMMENT '权限标识', - `frame_src` varchar(128) DEFAULT NULL COMMENT '链接地址(需要内嵌的`iframe`链接地址)', - `frame_loading` tinyint(4) DEFAULT '1' COMMENT '加载动画(内嵌的`iframe`页面是否开启首次加载动画)', - `keep_alive` tinyint(4) DEFAULT '0' COMMENT '缓存页面', - `hidden_tag` tinyint(4) DEFAULT '0' COMMENT '标签页(当前菜单名称或自定义信息禁止添加到标签页) ', - `fixed_tag` tinyint(4) DEFAULT '0' COMMENT '固定标签页(当前菜单名称是否固定显示在标签页且不可关闭)', - `show_link` tinyint(4) unsigned DEFAULT '1' COMMENT '菜单(是否显示该菜单)', - `show_parent` tinyint(4) unsigned DEFAULT NULL COMMENT '父级菜单(是否显示父级菜单', - `parent_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '父级id', - `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除', - `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=21 COMMENT='菜单资源表'; + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `menu_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '菜单类型(0代表菜单、1代表iframe、2代表外链、3代表按钮)', + `title` varchar(64) DEFAULT NULL COMMENT '菜单名称', + `name` varchar(64) DEFAULT NULL COMMENT '路由名称', + `path` varchar(128) DEFAULT NULL COMMENT '路由路径', + `component` varchar(128) DEFAULT NULL COMMENT '路由路径', + `rank` int(11) DEFAULT NULL COMMENT '排序', + `redirect` varchar(128) DEFAULT NULL COMMENT '路由重定向', + `icon` varchar(128) DEFAULT NULL COMMENT '菜单图标', + `extra_icon` varchar(64) DEFAULT NULL COMMENT '右侧图标', + `enter_transition` varchar(64) DEFAULT NULL COMMENT '进场动画(页面加载动画)', + `leave_transition` varchar(64) DEFAULT NULL COMMENT '离场动画(页面加载动画)', + `active_path` varchar(64) DEFAULT NULL COMMENT '菜单激活', + `auths` varchar(64) DEFAULT NULL COMMENT '权限标识', + `frame_src` varchar(128) DEFAULT NULL COMMENT '链接地址(需要内嵌的`iframe`链接地址)', + `frame_loading` tinyint(4) DEFAULT '1' COMMENT '加载动画(内嵌的`iframe`页面是否开启首次加载动画)', + `keep_alive` tinyint(4) DEFAULT '0' COMMENT '缓存页面', + `hidden_tag` tinyint(4) DEFAULT '0' COMMENT '标签页(当前菜单名称或自定义信息禁止添加到标签页) ', + `fixed_tag` tinyint(4) DEFAULT '0' COMMENT '固定标签页(当前菜单名称是否固定显示在标签页且不可关闭)', + `show_link` tinyint(4) unsigned DEFAULT '1' COMMENT '菜单(是否显示该菜单)', + `show_parent` tinyint(4) unsigned DEFAULT NULL COMMENT '父级菜单(是否显示父级菜单', + `parent_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '父级id', + `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除', + `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf32 COMMENT='菜单资源表'; +DROP TABLE IF EXISTS `sys_role`; CREATE TABLE `sys_role` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `name` varchar(64) NOT NULL DEFAULT '' COMMENT '角色名称', - `code` varchar(64) NOT NULL DEFAULT '' COMMENT '角色code', - `remark` varchar(128) NOT NULL DEFAULT '' COMMENT '备注', - `status` tinyint(4) unsigned NOT NULL DEFAULT '1' COMMENT '状态,1:启用,2:禁用', - `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除', - `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', - PRIMARY KEY (`id`), - UNIQUE KEY `uk_code` (`code`) -) ENGINE=InnoDB AUTO_INCREMENT=4 COMMENT='角色表'; + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `name` varchar(64) NOT NULL DEFAULT '' COMMENT '角色名称', + `code` varchar(64) NOT NULL DEFAULT '' COMMENT '角色code', + `remark` varchar(128) NOT NULL DEFAULT '' COMMENT '备注', + `status` tinyint(4) unsigned NOT NULL DEFAULT '1' COMMENT '状态,1:启用,2:禁用', + `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除', + `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_code` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf32 COMMENT='角色表'; +DROP TABLE IF EXISTS `sys_role_resource`; CREATE TABLE `sys_role_resource` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `role_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'sys_role.id', - `resource_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'sys_resource.id', - `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', - PRIMARY KEY (`id`), - KEY `idx_role_id` (`role_id`) -) ENGINE=InnoDB AUTO_INCREMENT=109 COMMENT='角色资源关联表'; + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `role_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'sys_role.id', + `resource_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'sys_resource.id', + `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`), + KEY `idx_role_id` (`role_id`) +) ENGINE=InnoDB AUTO_INCREMENT=109 DEFAULT CHARSET=utf32 COMMENT='角色资源关联表'; +DROP TABLE IF EXISTS `sys_user`; CREATE TABLE `sys_user` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `username` varchar(128) NOT NULL DEFAULT '' COMMENT '用户名', - `password` varchar(128) NOT NULL DEFAULT '' COMMENT '密码', - `nickname` varchar(64) NOT NULL DEFAULT '' COMMENT '昵称', - `phone` varchar(32) NOT NULL DEFAULT '' COMMENT '邮箱', - `email` varchar(128) NOT NULL DEFAULT '' COMMENT '邮箱', - `avatar` varchar(256) NOT NULL DEFAULT '' COMMENT '头像', - `gender` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '性别,0-未知,1-男,2-女', - `status` tinyint(4) unsigned NOT NULL DEFAULT '1' COMMENT '状态,1:启用,2:禁用', - `reg_type` varchar(32) NOT NULL DEFAULT 'backend' COMMENT '注册类型', - `remark` varchar(128) NOT NULL DEFAULT '' COMMENT '备注', - `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', - PRIMARY KEY (`id`), - UNIQUE KEY `uk_username` (`username`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=4 COMMENT='系统用户表'; + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `username` varchar(128) NOT NULL DEFAULT '' COMMENT '用户名', + `password` varchar(128) NOT NULL DEFAULT '' COMMENT '密码', + `nickname` varchar(64) NOT NULL DEFAULT '' COMMENT '昵称', + `phone` varchar(32) NOT NULL DEFAULT '' COMMENT '邮箱', + `email` varchar(128) NOT NULL DEFAULT '' COMMENT '邮箱', + `avatar` varchar(256) NOT NULL DEFAULT '' COMMENT '头像', + `gender` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '性别,0-未知,1-男,2-女', + `status` tinyint(4) unsigned NOT NULL DEFAULT '1' COMMENT '状态,1:启用,2:禁用', + `reg_type` varchar(32) NOT NULL DEFAULT 'backend' COMMENT '注册类型', + `remark` varchar(128) NOT NULL DEFAULT '' COMMENT '备注', + `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_username` (`username`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf32 COMMENT='系统用户表'; +DROP TABLE IF EXISTS `sys_user_dept`; CREATE TABLE `sys_user_dept` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `user_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'sys_user.id', - `dept_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'sys_dept.id', - `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', - PRIMARY KEY (`id`), - UNIQUE KEY `uk_userid_deptid` (`user_id`,`dept_id`) -) ENGINE=InnoDB AUTO_INCREMENT=6 COMMENT='用户部门关联表'; + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `user_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'sys_user.id', + `dept_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'sys_dept.id', + `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_userid_deptid` (`user_id`,`dept_id`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf32 COMMENT='用户部门关联表'; +DROP TABLE IF EXISTS `sys_user_role`; CREATE TABLE `sys_user_role` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `role_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'sys_role.id', - `user_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'sys_user.id', - `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', - `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', - PRIMARY KEY (`id`), - UNIQUE KEY `uk_userid_roleid` (`user_id`,`role_id`) -) ENGINE=InnoDB AUTO_INCREMENT=7 COMMENT='角色用户关联表'; + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `role_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'sys_role.id', + `user_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'sys_user.id', + `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `add_by` bigint(20) DEFAULT '0' COMMENT '创建人id', + `update_by` bigint(20) DEFAULT '0' COMMENT '修改人id', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_userid_roleid` (`user_id`,`role_id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf32 COMMENT='角色用户关联表'; + + +-- insert INSERT INTO `api_info` (`id`, `application`, `api_name`, `api_version`, `description`, `remark`, `interface_class_name`, `method_name`, `param_info`, `is_permission`, `is_need_Token`, `has_common_response`, `reg_source`, `status`, `add_time`, `update_time`, `add_by`, `update_by`) VALUES - (1, 'story-service', 'story.get', '1.0', '根据id获取故事', '', 'com.gitee.sop.storyweb.open.OpenStory', 'getById', '[{\"name\":\"id\",\"type\":\"java.lang.Integer\"}]', 0, 0, 1, 1, 1, '2024-09-10 18:34:05', '2024-12-22 07:39:35', 0, 0), - (2, 'story-service', 'story.save', '1.0', '', '', 'com.gitee.sop.storyweb.open.OpenStory', 'save', '[{\"name\":\"storySaveRequest\",\"type\":\"com.gitee.sop.storyweb.open.req.StorySaveRequest\"}]', 0, 0, 1, 1, 1, '2024-09-10 18:34:05', '2024-12-22 07:39:35', 0, 0), - (3, 'story-service', 'story.find', '1.0', '', '', 'com.gitee.sop.storyweb.open.OpenStory', 'getById', '[{\"name\":\"id\",\"type\":\"java.lang.Integer\"},{\"name\":\"name\",\"type\":\"java.lang.String\"}]', 0, 0, 1, 1, 1, '2024-09-10 18:38:27', '2024-12-22 07:39:35', 0, 0), - (4, 'story-service', 'story.find2', '1.0', '', '', 'com.gitee.sop.storyweb.open.StoryService', 'getById2', '[{\"name\":\"id\",\"type\":\"java.lang.Integer\"},{\"name\":\"name\",\"type\":\"java.lang.String\"}]', 0, 0, 1, 1, 1, '2024-09-10 18:44:51', '2024-09-10 18:44:51', 0, 0), - (5, 'story-service', 'story.find3', '1.0', '', '', 'com.gitee.sop.storyweb.open.StoryService', 'getById2', '[{\"name\":\"id\",\"type\":\"java.lang.Integer\"},{\"name\":\"name\",\"type\":\"java.lang.String\"}]', 0, 0, 1, 1, 1, '2024-09-10 18:49:14', '2024-09-10 18:49:14', 0, 0), - (6, 'story-service', 'story.update', '1.0', '', '', 'com.gitee.sop.storyweb.open.OpenStory', 'update', '[{\"name\":\"id\",\"type\":\"java.lang.Integer\"},{\"name\":\"storySaveRequest\",\"type\":\"com.gitee.sop.storyweb.open.req.StorySaveRequest\"}]', 0, 0, 1, 1, 1, '2024-09-10 23:00:07', '2024-12-22 07:39:35', 0, 0), - (7, 'story-service', 'story.upload', '1.0', '', '', 'com.gitee.sop.storyweb.open.OpenStory', 'upload', '[{\"name\":\"storySaveRequest\",\"type\":\"com.gitee.sop.storyweb.open.req.StorySaveRequest\"},{\"name\":\"file\",\"type\":\"com.gitee.sop.support.dto.FileData\"}]', 0, 0, 1, 1, 1, '2024-09-13 09:14:03', '2024-12-22 07:39:35', 0, 0), - (8, 'story-service', 'story.upload.more', '1.0', '', '', 'com.gitee.sop.storyweb.open.OpenStory', 'upload2', '[{\"name\":\"storySaveRequest\",\"type\":\"com.gitee.sop.storyweb.open.req.StorySaveRequest\"},{\"name\":\"idCardFront\",\"type\":\"com.gitee.sop.support.dto.FileData\"},{\"name\":\"idCardBack\",\"type\":\"com.gitee.sop.support.dto.FileData\"}]', 0, 0, 1, 1, 1, '2024-09-13 09:22:05', '2024-12-22 07:39:35', 0, 0), - (9, 'story-service', 'story.upload.list', '1.0', '', '', 'com.gitee.sop.storyweb.open.OpenStory', 'upload3', '[{\"name\":\"storySaveRequest\",\"type\":\"com.gitee.sop.storyweb.open.req.StorySaveRequest\"},{\"actualType\":\"com.gitee.sop.support.dto.FileData\",\"name\":\"files\",\"type\":\"java.util.List\"}]', 0, 0, 1, 1, 1, '2024-09-13 09:28:01', '2024-12-22 07:39:35', 0, 0), - (10, 'story-service', 'story.get', '2.0', '', '', 'com.gitee.sop.storyweb.open.OpenStory', 'getByIdV2', '[{\"name\":\"id\",\"type\":\"java.lang.Long\"}]', 1, 0, 1, 1, 1, '2024-09-14 10:40:13', '2024-12-22 08:28:31', 0, 1), - (11, 'story-service', 'story.download', '1.0', '11', '', 'com.gitee.sop.storyweb.open.OpenStory', 'download', '[{\"name\":\"id\",\"type\":\"java.lang.Integer\"}]', 0, 0, 1, 1, 1, '2024-09-16 20:56:09', '2024-12-22 07:39:35', 0, 0), + (1, 'product-service', 'product.get', '1.0', '根据id获取故事', '', 'com.gitee.sop.productweb.open.OpenProduct', 'getById', '[{\"name\":\"id\",\"type\":\"java.lang.Integer\"}]', 0, 0, 1, 1, 1, '2024-09-10 18:34:05', '2024-12-22 07:39:35', 0, 0), + (2, 'product-service', 'product.save', '1.0', '', '', 'com.gitee.sop.productweb.open.OpenProduct', 'save', '[{\"name\":\"request\",\"type\":\"com.gitee.sop.productweb.open.req.ProductSaveRequest\"}]', 0, 0, 1, 1, 1, '2024-09-10 18:34:05', '2024-12-22 07:39:35', 0, 0), + (3, 'product-service', 'product.find', '1.0', '', '', 'com.gitee.sop.productweb.open.OpenProduct', 'getById', '[{\"name\":\"id\",\"type\":\"java.lang.Integer\"},{\"name\":\"name\",\"type\":\"java.lang.String\"}]', 0, 0, 1, 1, 1, '2024-09-10 18:38:27', '2024-12-22 07:39:35', 0, 0), + (4, 'product-service', 'product.find2', '1.0', '', '', 'com.gitee.sop.productweb.open.ProductService', 'getById2', '[{\"name\":\"id\",\"type\":\"java.lang.Integer\"},{\"name\":\"name\",\"type\":\"java.lang.String\"}]', 0, 0, 1, 1, 1, '2024-09-10 18:44:51', '2024-09-10 18:44:51', 0, 0), + (5, 'product-service', 'product.find3', '1.0', '', '', 'com.gitee.sop.productweb.open.ProductService', 'getById2', '[{\"name\":\"id\",\"type\":\"java.lang.Integer\"},{\"name\":\"name\",\"type\":\"java.lang.String\"}]', 0, 0, 1, 1, 1, '2024-09-10 18:49:14', '2024-09-10 18:49:14', 0, 0), + (6, 'product-service', 'product.update', '1.0', '', '', 'com.gitee.sop.productweb.open.OpenProduct', 'update', '[{\"name\":\"id\",\"type\":\"java.lang.Integer\"},{\"name\":\"request\",\"type\":\"com.gitee.sop.productweb.open.req.ProductSaveRequest\"}]', 0, 0, 1, 1, 1, '2024-09-10 23:00:07', '2024-12-22 07:39:35', 0, 0), + (7, 'product-service', 'product.upload', '1.0', '', '', 'com.gitee.sop.productweb.open.OpenProduct', 'upload', '[{\"name\":\"request\",\"type\":\"com.gitee.sop.productweb.open.req.ProductSaveRequest\"},{\"name\":\"file\",\"type\":\"com.gitee.sop.support.dto.FileData\"}]', 0, 0, 1, 1, 1, '2024-09-13 09:14:03', '2024-12-22 07:39:35', 0, 0), + (8, 'product-service', 'product.upload.more', '1.0', '', '', 'com.gitee.sop.productweb.open.OpenProduct', 'upload2', '[{\"name\":\"request\",\"type\":\"com.gitee.sop.productweb.open.req.ProductSaveRequest\"},{\"name\":\"idCardFront\",\"type\":\"com.gitee.sop.support.dto.FileData\"},{\"name\":\"idCardBack\",\"type\":\"com.gitee.sop.support.dto.FileData\"}]', 0, 0, 1, 1, 1, '2024-09-13 09:22:05', '2024-12-22 07:39:35', 0, 0), + (9, 'product-service', 'product.upload.list', '1.0', '', '', 'com.gitee.sop.productweb.open.OpenProduct', 'upload3', '[{\"name\":\"request\",\"type\":\"com.gitee.sop.productweb.open.req.ProductSaveRequest\"},{\"actualType\":\"com.gitee.sop.support.dto.FileData\",\"name\":\"files\",\"type\":\"java.util.List\"}]', 0, 0, 1, 1, 1, '2024-09-13 09:28:01', '2024-12-22 07:39:35', 0, 0), + (10, 'product-service', 'product.get', '2.0', '', '', 'com.gitee.sop.productweb.open.OpenProduct', 'getByIdV2', '[{\"name\":\"id\",\"type\":\"java.lang.Long\"}]', 1, 0, 1, 1, 1, '2024-09-14 10:40:13', '2024-12-22 08:28:31', 0, 1), + (11, 'product-service', 'product.download', '1.0', '11', '', 'com.gitee.sop.productweb.open.OpenProduct', 'download', '[{\"name\":\"id\",\"type\":\"java.lang.Integer\"}]', 0, 0, 1, 1, 1, '2024-09-16 20:56:09', '2024-12-22 07:39:35', 0, 0), (14, 'q1', 'q11', 'q', 'q1', '备注,内容有点长内容有点长内容有点长内容有点长内容有点长内容有点长', '', '', NULL, 1, 0, 1, 1, 2, '2024-10-06 09:51:47', '2024-11-13 10:20:56', 0, 1), (15, 'server', 'goods.get', '1.0', '1111', '2222225555', '', '', NULL, 1, 0, 1, 2, 2, '2024-10-10 10:38:59', '2024-10-25 20:19:29', 0, 0), (18, 'example-payment', 'alipay.trade.wap.pay', '2.0', NULL, NULL, 'com.gitee.sop.payment.open.OpenPayment', 'tradeWapPay', '[{\"name\":\"request\",\"type\":\"com.gitee.sop.payment.open.req.AlipayTradeWapPayRequest\"}]', 0, 0, 1, 1, 1, '2024-10-27 17:12:20', '2024-10-27 21:02:07', 0, 0), - (19, 'story-service', 'story.updateError', '1.0', NULL, NULL, 'com.gitee.sop.storyweb.open.OpenStory', 'updateError', '[{\"name\":\"id\",\"type\":\"java.lang.Integer\"}]', 0, 0, 1, 1, 1, '2024-11-03 22:26:14', '2024-12-22 07:39:35', 0, 0), - (20, 'story-service', 'story.get', '3.0', NULL, NULL, 'com.gitee.sop.storyweb.open.OpenStory', 'getByIdV3', '[{\"name\":\"id\",\"type\":\"java.lang.Long\"},{\"name\":\"request\",\"type\":\"com.gitee.sop.support.dto.OpenRequest\"}]', 0, 0, 1, 1, 1, '2024-11-04 14:27:07', '2024-11-08 09:47:27', 0, 0), - (21, 'story-service', 'story.get.context', '1.0', NULL, NULL, 'com.gitee.sop.storyweb.open.OpenStory', 'getContext', '[{\"name\":\"id\",\"type\":\"java.lang.Long\"},{\"name\":\"context\",\"type\":\"com.gitee.sop.support.context.OpenContext\"}]', 0, 0, 1, 1, 1, '2024-11-10 23:06:45', '2024-12-22 07:39:35', 0, 0), + (19, 'product-service', 'product.updateError', '1.0', NULL, NULL, 'com.gitee.sop.productweb.open.OpenProduct', 'updateError', '[{\"name\":\"id\",\"type\":\"java.lang.Integer\"}]', 0, 0, 1, 1, 1, '2024-11-03 22:26:14', '2024-12-22 07:39:35', 0, 0), + (20, 'product-service', 'product.get', '3.0', NULL, NULL, 'com.gitee.sop.productweb.open.OpenProduct', 'getByIdV3', '[{\"name\":\"id\",\"type\":\"java.lang.Long\"},{\"name\":\"request\",\"type\":\"com.gitee.sop.support.dto.OpenRequest\"}]', 0, 0, 1, 1, 1, '2024-11-04 14:27:07', '2024-11-08 09:47:27', 0, 0), + (21, 'product-service', 'product.get.context', '1.0', NULL, NULL, 'com.gitee.sop.productweb.open.OpenProduct', 'getContext', '[{\"name\":\"id\",\"type\":\"java.lang.Long\"},{\"name\":\"context\",\"type\":\"com.gitee.sop.support.context.OpenContext\"}]', 0, 0, 1, 1, 1, '2024-11-10 23:06:45', '2024-12-22 07:39:35', 0, 0), (22, 'example-payment', 'pay.trade.wap.pay', '1.0', '手机网站支付接口', NULL, 'com.gitee.sop.payment.open.OpenPayment', 'tradeWapPay', '[{\"name\":\"request\",\"type\":\"com.gitee.sop.payment.open.req.PayTradeWapPayRequest\"}]', 0, 0, 1, 1, 1, '2024-11-29 22:28:20', '2024-12-02 10:14:26', 0, 0), (23, 'example-payment', 'pay.order.search', '1.0', '订单查询接口', NULL, 'com.gitee.sop.payment.open.OpenPayment', 'orderSearch', '[{\"name\":\"request\",\"type\":\"com.gitee.sop.payment.open.req.PayOrderSearchRequest\"}]', 0, 0, 1, 1, 1, '2024-11-29 22:28:20', '2024-12-02 10:14:26', 0, 0), - (24, 'story-service', 'alipay.story.find', '1.0', NULL, NULL, 'com.gitee.sop.storyweb.open.OpenStory', 'findByName', '[{\"name\":\"name\",\"type\":\"java.lang.String\"}]', 0, 0, 1, 1, 1, '2024-12-21 19:48:40', '2024-12-22 07:39:35', 0, 0); + (24, 'product-service', 'alipay.product.find', '1.0', NULL, NULL, 'com.gitee.sop.productweb.open.OpenProduct', 'findByName', '[{\"name\":\"name\",\"type\":\"java.lang.String\"}]', 0, 0, 1, 1, 1, '2024-12-21 19:48:40', '2024-12-22 07:39:35', 0, 0); INSERT INTO `doc_app` (`id`, `app_name`, `token`, `is_publish`, `add_time`, `update_time`, `add_by`, `update_by`) VALUES (3, '支付服务', '34ff76952462413982d21219cf099d46', 1, '2024-11-26 09:19:29', '2024-11-29 22:49:20', 1, 1), @@ -296,7 +337,7 @@ INSERT INTO `doc_content` (`id`, `doc_info_id`, `content`, `add_time`, `update_t (4, 24, '{\"children\":[],\"contentType\":\"application/json\",\"description\":\"该接口是页面跳转接口,用于生成用户访问跳转链接。请在服务端执行SDK中pageExecute方法,读取响应中的body()结果。该结果用于跳转到页面,返回到用户浏览器渲染或重定向跳转到页面。具体使用方法请参考 接入指南\",\"docName\":\"手机网站支付接口\",\"docTitle\":\"手机网站支付接口\",\"errorCodeParams\":[],\"globalHeaders\":[],\"globalParams\":[],\"globalReturns\":[],\"gmtCreate\":\"2024-11-29 22:33:41\",\"gmtModified\":\"2024-12-02 10:10:27\",\"headerParams\":[],\"headerParamsRaw\":[],\"httpMethod\":\"POST\",\"id\":724,\"isFolder\":0,\"name\":\"手机网站支付接口\",\"parentId\":640,\"pathParams\":[],\"queryParams\":[],\"requestParams\":[{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"商户网站唯一订单号\",\"docId\":724,\"enumId\":0,\"example\":\"70501111111S001111119\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6892,\"maxLength\":\"64\",\"modifierName\":\"Jim\",\"name\":\"outTradeNo\",\"parentId\":0,\"require\":false,\"required\":1,\"type\":\"String\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"订单总金额.单位为元,精确到小数点后两位,取值范围:[0.01,100000000] \",\"docId\":724,\"enumId\":0,\"example\":\"9.00\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6893,\"maxLength\":\"-\",\"modifierName\":\"Jim\",\"name\":\"totalAmount\",\"parentId\":0,\"require\":false,\"required\":1,\"type\":\"BigDecimal\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"订单标题。注意:不可使用特殊字符,如 /,=,& 等。\",\"docId\":724,\"enumId\":0,\"example\":\"大乐透\",\"global\":false,\"gmtCreate\":\"2024-11-29 22:33:41\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6847,\"maxLength\":\"256\",\"modifierName\":\"Jim\",\"name\":\"subject\",\"parentId\":0,\"require\":false,\"required\":1,\"type\":\"String\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"销售产品码,商家和支付平台签约的产品码。手机网站支付为:QUICK_WAP_WAY\",\"docId\":724,\"enumId\":0,\"example\":\"QUICK_WAP_WAY\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6895,\"maxLength\":\"64\",\"modifierName\":\"Jim\",\"name\":\"productCode\",\"parentId\":0,\"require\":false,\"required\":1,\"type\":\"String\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"针对用户授权接口,获取用户相关数据时,用于标识用户授权关系\",\"docId\":724,\"enumId\":0,\"example\":\"appopenBb64d181d0146481ab6a762c00714cC27\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6896,\"maxLength\":\"40\",\"modifierName\":\"Jim\",\"name\":\"authToken\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"String\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"用户付款中途退出返回商户网站的地址\",\"docId\":724,\"enumId\":0,\"example\":\"http://www.taobao.com/product/113714.html\",\"global\":false,\"gmtCreate\":\"2024-11-29 22:33:41\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6850,\"maxLength\":\"400\",\"modifierName\":\"Jim\",\"name\":\"quit_url\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"String\"},{\"children\":[{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"商品的编号\",\"docId\":724,\"enumId\":0,\"example\":\"apple-01\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6899,\"maxLength\":\"64\",\"modifierName\":\"Jim\",\"name\":\"goodsId\",\"parentId\":6898,\"require\":false,\"required\":1,\"type\":\"String\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"商品名称\",\"docId\":724,\"enumId\":0,\"example\":\"ipad\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6900,\"maxLength\":\"256\",\"modifierName\":\"Jim\",\"name\":\"goodsName\",\"parentId\":6898,\"require\":false,\"required\":1,\"type\":\"String\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"商品数量\",\"docId\":724,\"enumId\":0,\"example\":\"1\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6901,\"maxLength\":\"-\",\"modifierName\":\"Jim\",\"name\":\"quantity\",\"parentId\":6898,\"require\":false,\"required\":1,\"type\":\"Integer\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"商品单价,单位为元\",\"docId\":724,\"enumId\":0,\"example\":\"2000\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6902,\"maxLength\":\"-\",\"modifierName\":\"Jim\",\"name\":\"price\",\"parentId\":6898,\"require\":false,\"required\":1,\"type\":\"BigDecimal\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"支付平台定义的统一商品编号\",\"docId\":724,\"enumId\":0,\"example\":\"20010001\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6903,\"maxLength\":\"32\",\"modifierName\":\"Jim\",\"name\":\"alipayGoodsId\",\"parentId\":6898,\"require\":false,\"required\":0,\"type\":\"String\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"商品类目\",\"docId\":724,\"enumId\":0,\"example\":\"34543238\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6904,\"maxLength\":\"24\",\"modifierName\":\"Jim\",\"name\":\"goodsCategory\",\"parentId\":6898,\"require\":false,\"required\":0,\"type\":\"String\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"商品类目树,从商品类目根节点到叶子节点的类目id组成,类目id值使用|分割\",\"docId\":724,\"enumId\":0,\"example\":\"124868003|126232002|126252004\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6905,\"maxLength\":\"128\",\"modifierName\":\"Jim\",\"name\":\"categoriesTree\",\"parentId\":6898,\"require\":false,\"required\":0,\"type\":\"String\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"商品描述信息\",\"docId\":724,\"enumId\":0,\"example\":\"特价手机\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6906,\"maxLength\":\"1000\",\"modifierName\":\"Jim\",\"name\":\"body\",\"parentId\":6898,\"require\":false,\"required\":0,\"type\":\"String\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"商品的展示地址\",\"docId\":724,\"enumId\":0,\"example\":\"http://www.alipay.com/xxx.jpg\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6907,\"maxLength\":\"400\",\"modifierName\":\"Jim\",\"name\":\"showUrl\",\"parentId\":6898,\"require\":false,\"required\":0,\"type\":\"String\"}],\"creatorName\":\"Jim\",\"description\":\"订单包含的商品列表信息,json格式,其它说明详见商品明细说明\",\"docId\":724,\"enumId\":0,\"example\":\"\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6898,\"maxLength\":\"\",\"modifierName\":\"Jim\",\"name\":\"goodsDetail\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"List\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"绝对超时时间,格式为yyyy-MM-dd HH:mm:ss。超时时间范围:1m~15d。\",\"docId\":724,\"enumId\":0,\"example\":\"2016-12-31 10:05:00\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6908,\"maxLength\":\"32\",\"modifierName\":\"Jim\",\"name\":\"timeExpire\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"String\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"商户传入业务信息,具体值要和支付平台约定,应用于安全,营销等参数直传场景,格式为json格式\",\"docId\":724,\"enumId\":0,\"example\":\"{\\\"mc_create_trade_ip\\\":\\\"127.0.0.1\\\"}\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6909,\"maxLength\":\"512\",\"modifierName\":\"Jim\",\"name\":\"businessParams\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"String\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"公用回传参数,如果请求时传递了该参数,则返回给商户时会回传该参数。支付平台只会在同步返回(包括跳转回商户网站)和异步通知时将该参数原样返回。本参数必须进行UrlEncode之后才可以发送给支付平台。\",\"docId\":724,\"enumId\":0,\"example\":\"merchantBizType%3d3C%26merchantBizNo%3d2016010101111\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6910,\"maxLength\":\"512\",\"modifierName\":\"Jim\",\"name\":\"passbackParams\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"String\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"商户原始订单号,最大长度限制32位\",\"docId\":724,\"enumId\":0,\"example\":\"{\\\"mc_create_trade_ip\\\":\\\"127.0.0.1\\\"}\",\"global\":false,\"gmtCreate\":\"2024-12-02 10:10:27\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6911,\"maxLength\":\"32\",\"modifierName\":\"Jim\",\"name\":\"merchantOrderNo\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"String\"}],\"responseParams\":[{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"用于跳转支付平台页面的信息,POST和GET方法生成内容不同:使用POST方法执行,结果为html form表单,在浏览器渲染即可;使用GET方法会得到支付平台URL,需要打开或重定向到该URL。建议使用POST方式。具体使用方法请参考\",\"docId\":724,\"enumId\":0,\"example\":\"请参考响应示例\",\"global\":false,\"gmtCreate\":\"2024-11-29 22:33:41\",\"gmtModified\":\"2024-12-02 10:10:27\",\"id\":6865,\"maxLength\":\"-\",\"modifierName\":\"Jim\",\"name\":\"pageRedirectionData\",\"parentId\":0,\"require\":false,\"required\":1,\"type\":\"String\"}],\"url\":\"pay.trade.wap.pay\",\"version\":\"1.0\"}', '2024-11-29 22:38:17', '2024-12-02 10:11:31', 1, 1), (5, 3, '{\"children\":[],\"contentType\":\"application/json\",\"description\":\"根据表单内容新建地址\",\"docName\":\"添加地址\",\"docTitle\":\"添加地址\",\"errorCodeParams\":[],\"globalHeaders\":[],\"globalParams\":[],\"globalReturns\":[],\"gmtCreate\":\"2024-09-02 10:05:38\",\"gmtModified\":\"2024-11-14 11:08:40\",\"headerParams\":[],\"headerParamsRaw\":[],\"httpMethod\":\"POST\",\"id\":229,\"isFolder\":0,\"name\":\"添加地址\",\"parentId\":228,\"pathParams\":[],\"queryParams\":[],\"requestParams\":[{\"children\":[],\"creatorName\":\"thc\",\"description\":\"详细地址\",\"docId\":229,\"enumId\":0,\"example\":\"xxx省xx市\",\"global\":false,\"gmtCreate\":\"2024-09-02 10:05:38\",\"gmtModified\":\"2024-11-14 11:08:40\",\"id\":1406,\"maxLength\":\"-\",\"modifierName\":\"thc\",\"name\":\"address\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"string\"},{\"children\":[],\"creatorName\":\"thc\",\"description\":\"行政编码\",\"docId\":229,\"enumId\":0,\"example\":\"330104\",\"global\":false,\"gmtCreate\":\"2024-09-02 10:05:38\",\"gmtModified\":\"2024-11-14 11:08:40\",\"id\":1407,\"maxLength\":\"-\",\"modifierName\":\"thc\",\"name\":\"areaCode\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"string\"}],\"responseParams\":[{\"children\":[],\"creatorName\":\"thc\",\"description\":\"状态码

200:成功
400:未知失败
400xxxx:明确的失败\",\"docId\":229,\"enumId\":0,\"example\":\"0\",\"global\":false,\"gmtCreate\":\"2024-09-02 10:05:38\",\"gmtModified\":\"2024-11-14 11:08:40\",\"id\":1408,\"maxLength\":\"-\",\"modifierName\":\"thc\",\"name\":\"code\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"int32\"},{\"children\":[],\"creatorName\":\"thc\",\"description\":\"状态描述\",\"docId\":229,\"enumId\":0,\"example\":\"\",\"global\":false,\"gmtCreate\":\"2024-09-02 10:05:38\",\"gmtModified\":\"2024-11-14 11:08:40\",\"id\":1409,\"maxLength\":\"-\",\"modifierName\":\"thc\",\"name\":\"description\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"string\"},{\"children\":[],\"creatorName\":\"thc\",\"description\":\"数据\",\"docId\":229,\"enumId\":0,\"example\":\"\",\"global\":false,\"gmtCreate\":\"2024-09-02 10:05:38\",\"gmtModified\":\"2024-11-14 11:08:40\",\"id\":1410,\"maxLength\":\"-\",\"modifierName\":\"thc\",\"name\":\"data\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"int64\"}],\"url\":\"/address/add\",\"version\":\"\"}', '2024-11-30 23:02:26', '2024-11-30 23:02:26', 1, 1), (6, 25, '{\"children\":[],\"contentType\":\"\",\"description\":\"\",\"docName\":\"故事服务\",\"docTitle\":\"故事服务\",\"errorCodeParams\":[],\"globalHeaders\":[],\"globalParams\":[],\"globalReturns\":[],\"gmtCreate\":\"2024-12-21 15:11:33\",\"gmtModified\":\"2024-12-21 15:11:33\",\"headerParams\":[],\"headerParamsRaw\":[],\"httpMethod\":\"\",\"id\":796,\"isFolder\":1,\"name\":\"故事服务\",\"parentId\":0,\"pathParams\":[],\"queryParams\":[],\"requestParams\":[],\"responseParams\":[],\"url\":\"\",\"version\":\"\"}', '2024-12-21 15:11:55', '2024-12-21 15:11:55', 1, 1), - (7, 26, '{\"children\":[],\"contentType\":\"application/json\",\"description\":\"\",\"docName\":\"根据id获取故事\",\"docTitle\":\"根据id获取故事\",\"errorCodeParams\":[],\"globalHeaders\":[],\"globalParams\":[],\"globalReturns\":[],\"gmtCreate\":\"2024-12-21 15:11:34\",\"gmtModified\":\"2024-12-21 15:11:34\",\"headerParams\":[],\"headerParamsRaw\":[],\"httpMethod\":\"POST\",\"id\":797,\"isFolder\":0,\"name\":\"根据id获取故事\",\"parentId\":796,\"pathParams\":[],\"queryParams\":[],\"requestParams\":[],\"responseParams\":[{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"\",\"docId\":797,\"enumId\":0,\"example\":\"\",\"global\":false,\"gmtCreate\":\"2024-12-21 15:11:34\",\"gmtModified\":\"2024-12-21 15:11:34\",\"id\":7248,\"maxLength\":\"-\",\"modifierName\":\"Jim\",\"name\":\"id\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"Integer\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"\",\"docId\":797,\"enumId\":0,\"example\":\"\",\"global\":false,\"gmtCreate\":\"2024-12-21 15:11:34\",\"gmtModified\":\"2024-12-21 15:11:34\",\"id\":7249,\"maxLength\":\"-\",\"modifierName\":\"Jim\",\"name\":\"name\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"String\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"\",\"docId\":797,\"enumId\":0,\"example\":\"\",\"global\":false,\"gmtCreate\":\"2024-12-21 15:11:34\",\"gmtModified\":\"2024-12-21 15:11:34\",\"id\":7250,\"maxLength\":\"-\",\"modifierName\":\"Jim\",\"name\":\"addTime\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"Date\"}],\"url\":\"story.get\",\"version\":\"1.0\"}', '2024-12-21 15:11:55', '2024-12-21 15:11:55', 1, 1); + (7, 26, '{\"children\":[],\"contentType\":\"application/json\",\"description\":\"\",\"docName\":\"根据id获取故事\",\"docTitle\":\"根据id获取故事\",\"errorCodeParams\":[],\"globalHeaders\":[],\"globalParams\":[],\"globalReturns\":[],\"gmtCreate\":\"2024-12-21 15:11:34\",\"gmtModified\":\"2024-12-21 15:11:34\",\"headerParams\":[],\"headerParamsRaw\":[],\"httpMethod\":\"POST\",\"id\":797,\"isFolder\":0,\"name\":\"根据id获取故事\",\"parentId\":796,\"pathParams\":[],\"queryParams\":[],\"requestParams\":[],\"responseParams\":[{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"\",\"docId\":797,\"enumId\":0,\"example\":\"\",\"global\":false,\"gmtCreate\":\"2024-12-21 15:11:34\",\"gmtModified\":\"2024-12-21 15:11:34\",\"id\":7248,\"maxLength\":\"-\",\"modifierName\":\"Jim\",\"name\":\"id\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"Integer\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"\",\"docId\":797,\"enumId\":0,\"example\":\"\",\"global\":false,\"gmtCreate\":\"2024-12-21 15:11:34\",\"gmtModified\":\"2024-12-21 15:11:34\",\"id\":7249,\"maxLength\":\"-\",\"modifierName\":\"Jim\",\"name\":\"name\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"String\"},{\"children\":[],\"creatorName\":\"Jim\",\"description\":\"\",\"docId\":797,\"enumId\":0,\"example\":\"\",\"global\":false,\"gmtCreate\":\"2024-12-21 15:11:34\",\"gmtModified\":\"2024-12-21 15:11:34\",\"id\":7250,\"maxLength\":\"-\",\"modifierName\":\"Jim\",\"name\":\"addTime\",\"parentId\":0,\"require\":false,\"required\":0,\"type\":\"Date\"}],\"url\":\"product.get\",\"version\":\"1.0\"}', '2024-12-21 15:11:55', '2024-12-21 15:11:55', 1, 1); INSERT INTO `doc_info` (`id`, `doc_app_id`, `doc_title`, `doc_id`, `doc_code`, `doc_type`, `source_type`, `doc_version`, `doc_name`, `description`, `is_folder`, `is_publish`, `parent_id`, `add_time`, `update_time`, `add_by`, `update_by`) VALUES (14, 3, '支付接口', 640, '', 1, 1, '', '支付接口', '', 1, 1, 0, '2024-11-26 22:17:12', '2024-11-29 22:38:17', 0, 1), @@ -304,7 +345,7 @@ INSERT INTO `doc_info` (`id`, `doc_app_id`, `doc_title`, `doc_id`, `doc_code`, ` (23, 3, '订单查询接口', 723, '', 1, 1, '1.0', 'pay.order.search', '', 0, 1, 640, '2024-11-29 22:38:16', '2024-11-29 22:53:22', 0, 1), (24, 3, '手机网站支付接口', 724, '', 1, 1, '1.0', 'pay.trade.wap.pay', '该接口是页面跳转接口,用于生成用户访问跳转链接。请在服务端执行SDK中pageExecute方法,读取响应中的body()结果。该结果用于跳转到页面,返回到用户浏览器渲染或重定向跳转到页面。具体使用方法请参考 接入指南', 0, 1, 640, '2024-11-29 22:38:16', '2024-12-02 10:11:31', 0, 1), (25, 4, '故事服务', 796, '', 1, 1, '', '故事服务', '', 1, 1, 0, '2024-12-21 15:11:54', '2024-12-21 15:11:54', 1, 0), - (26, 4, '根据id获取故事', 797, '', 1, 1, '1.0', 'story.get', '', 0, 0, 796, '2024-12-21 15:11:54', '2024-12-21 15:11:54', 1, 0); + (26, 4, '根据id获取故事', 797, '', 1, 1, '1.0', 'product.get', '', 0, 0, 796, '2024-12-21 15:11:54', '2024-12-21 15:11:54', 1, 0); INSERT INTO `isv_info` (`id`, `app_id`, `status`, `remark`, `add_time`, `update_time`, `add_by`, `update_by`) VALUES (1, '2019032617262200001', 1, 'xx', '2024-09-10 09:23:43', '2024-12-22 07:35:52', 0, 1),