diff --git a/doc/docs/files/90100_常见问题.md b/doc/docs/files/90100_常见问题.md index e2b4601f..b1177e01 100644 --- a/doc/docs/files/90100_常见问题.md +++ b/doc/docs/files/90100_常见问题.md @@ -67,4 +67,20 @@ public static class Swagger2 extends SwaggerSupport { return false; } } +``` + +## 调试网关出现服务不可用 + +打断点调试,网关出现Read Timeout + +参考:https://blog.csdn.net/qq_36872046/article/details/81058045 + +yml添加: + +```yaml +ribbon: + # https://blog.csdn.net/qq_36872046/article/details/81058045 + # 路由转发超时时间,毫秒,默认值1000,详见:RibbonClientConfiguration.DEFAULT_READ_TIMEOUT。 + # 如果微服务端 处理时间过长,会导致ribbon read超时,解决办法将这个值调大一点 + ReadTimeout: 60000 ``` \ No newline at end of file diff --git a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/AlipayServiceConfiguration.java b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/AlipayServiceConfiguration.java index 01517ecf..a1748613 100644 --- a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/AlipayServiceConfiguration.java +++ b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/AlipayServiceConfiguration.java @@ -14,7 +14,7 @@ import java.util.List; */ public class AlipayServiceConfiguration extends BaseServiceConfiguration { - public AlipayServiceConfiguration() { + static { // 默认版本号为1.0 ServiceConfig.getInstance().setDefaultVersion("1.0"); } diff --git a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/config/OpenServiceConfig.java b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/config/OpenServiceConfig.java index c39ba27c..dd9a5f12 100644 --- a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/config/OpenServiceConfig.java +++ b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/config/OpenServiceConfig.java @@ -28,7 +28,11 @@ public class OpenServiceConfig extends AlipayServiceConfiguration { .addResourceLocations("classpath:/META-INF/resources/webjars/"); } - // 开启文档 + + /** + * 开启文档 + * http://ip:port/v2/api-docs + */ @Configuration @EnableSwagger2 public static class Swagger2 extends SwaggerSupport { diff --git a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/FileUploadDemoController.java b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/FileUploadDemoController.java index bcce526b..13b38327 100644 --- a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/FileUploadDemoController.java +++ b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/FileUploadDemoController.java @@ -5,6 +5,10 @@ import com.gitee.sop.servercommon.util.UploadUtil; import com.gitee.sop.storyweb.controller.param.FileUploadParam; import com.gitee.sop.storyweb.controller.param.FileUploadParam2; import com.gitee.sop.storyweb.vo.FileUploadVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Extension; +import io.swagger.annotations.ExtensionProperty; import org.apache.commons.io.IOUtils; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; @@ -19,6 +23,7 @@ import java.util.Collection; * @author tanghc */ @RestController +@Api(tags = "文件上传") public class FileUploadDemoController { /** @@ -26,6 +31,7 @@ public class FileUploadDemoController { * @param param * @return */ + @ApiOperation(value = "文件上传例1", notes = "上传文件demo") @ApiMapping(value = "demo.file.upload") public FileUploadVO file1(FileUploadParam param) { System.out.println(param.getRemark()); @@ -48,6 +54,9 @@ public class FileUploadDemoController { * @param param * @return */ + @ApiOperation(value = "文件上传例2", notes = "可上传多个文件" + // 多文件上传、不确定文件数量上传,必须申明下面这句,否则沙盒界面不会出现上传控件 + , extensions = @Extension(properties = @ExtensionProperty(name = "multiple", value = "multiple"))) @ApiMapping(value = "demo.file.upload2") public FileUploadVO file2(FileUploadParam2 param, HttpServletRequest request) { System.out.println(param.getRemark()); diff --git a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/param/FileUploadParam.java b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/param/FileUploadParam.java index ac778bf2..2be7875c 100644 --- a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/param/FileUploadParam.java +++ b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/param/FileUploadParam.java @@ -1,5 +1,6 @@ package com.gitee.sop.storyweb.controller.param; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.web.multipart.MultipartFile; @@ -14,8 +15,10 @@ public class FileUploadParam { // 上传文件,字段名称对应表单中的name属性值 @NotNull(message = "请上传文件1") + @ApiModelProperty(value = "文件1", required = true) private MultipartFile file1; @NotNull(message = "请上传文件2") + @ApiModelProperty(value = "文件2", required = true) private MultipartFile file2; } diff --git a/sop-gateway/src/main/resources/application-dev.yml b/sop-gateway/src/main/resources/application-dev.yml index 568556ce..49b49adc 100644 --- a/sop-gateway/src/main/resources/application-dev.yml +++ b/sop-gateway/src/main/resources/application-dev.yml @@ -15,6 +15,10 @@ zuul: secret: MZZOUSTua6LzApIWXCwEgbBmxSzpzC ribbon: + # https://blog.csdn.net/qq_36872046/article/details/81058045 + # 路由转发超时时间,毫秒,默认值1000,详见:RibbonClientConfiguration.DEFAULT_READ_TIMEOUT。 + # 如果微服务端 处理时间过长,会导致ribbon read超时,解决办法将这个值调大一点 + ReadTimeout: 2000 # 设置为true(默认false),则所有请求都重试,默认只支持get请求重试 # 请谨慎设置,因为post请求大多都是写入请求,如果要支持重试,确保服务的幂等性 OkToRetryOnAllOperations: false diff --git a/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/common/OpenConfig.java b/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/common/OpenConfig.java index 4d47c629..e8b64015 100644 --- a/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/common/OpenConfig.java +++ b/sop-sdk/sdk-java/src/main/java/com/gitee/sop/sdk/common/OpenConfig.java @@ -50,11 +50,11 @@ public class OpenConfig { private String errorResponseName = "error_response"; /** 请求超时时间 */ - private int connectTimeoutSeconds = 10; + private int connectTimeoutSeconds = 60; /** http读取超时时间 */ - private int readTimeoutSeconds = 10; + private int readTimeoutSeconds = 60; /** http写超时时间 */ - private int writeTimeoutSeconds = 10; + private int writeTimeoutSeconds = 60; /** * 构建数据节点名称 diff --git a/sop-website/website-front/pages/sandbox/sandbox.html b/sop-website/website-front/pages/sandbox/sandbox.html index 5428c532..1dd4b6cd 100644 --- a/sop-website/website-front/pages/sandbox/sandbox.html +++ b/sop-website/website-front/pages/sandbox/sandbox.html @@ -104,6 +104,9 @@
@@ -136,7 +139,7 @@ - +