Merge branch 'master' into eureka

eureka
tanghc 5 years ago
commit 1cd9bcc615
  1. 5
      changelog.md
  2. 2
      sop-auth/pom.xml
  3. 2
      sop-common/pom.xml
  4. 6
      sop-common/sop-bridge-gateway/pom.xml
  5. 6
      sop-common/sop-bridge-zuul/pom.xml
  6. 4
      sop-common/sop-gateway-common/pom.xml
  7. 2
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/filter/GatewayModifyResponseGatewayFilter.java
  8. 4
      sop-common/sop-service-common/pom.xml
  9. 15
      sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/BaseServiceConfiguration.java
  10. 2
      sop-example/sop-book/sop-book-web/pom.xml
  11. 10
      sop-example/sop-book/sop-book-web/src/main/java/com/gitee/sop/bookweb/config/OpenServiceConfig.java
  12. 2
      sop-example/sop-easyopen/pom.xml
  13. 2
      sop-example/sop-springmvc/pom.xml
  14. 2
      sop-example/sop-story/sop-story-web/pom.xml
  15. 2
      sop-gateway/pom.xml
  16. 2
      sop-website/pom.xml
  17. 11
      sop-website/src/main/java/com/gitee/sop/websiteserver/manager/SwaggerDocParser.java

@ -1,5 +1,10 @@
# changelog # changelog
## 3.1.1
- 修复继承WebMvcConfigurationSupport导致的jackson序列化时间问题
- 修复微服务接口返回void网关不会返回code和msg问题
## 3.1.0 ## 3.1.0
- 新增路由监控功能 - 新增路由监控功能

@ -26,7 +26,7 @@
<dependency> <dependency>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-service-common</artifactId> <artifactId>sop-service-common</artifactId>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
</dependency> </dependency>
<!-- sop相关配置 end--> <!-- sop相关配置 end-->

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-common</artifactId> <artifactId>sop-common</artifactId>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>

@ -5,11 +5,11 @@
<parent> <parent>
<artifactId>sop-common</artifactId> <artifactId>sop-common</artifactId>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
<artifactId>sop-bridge-gateway</artifactId> <artifactId>sop-bridge-gateway</artifactId>
@ -17,7 +17,7 @@
<dependency> <dependency>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-gateway-common</artifactId> <artifactId>sop-gateway-common</artifactId>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

@ -5,11 +5,11 @@
<parent> <parent>
<artifactId>sop-common</artifactId> <artifactId>sop-common</artifactId>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
<artifactId>sop-bridge-zuul</artifactId> <artifactId>sop-bridge-zuul</artifactId>
@ -17,7 +17,7 @@
<dependency> <dependency>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-gateway-common</artifactId> <artifactId>sop-gateway-common</artifactId>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

@ -5,11 +5,11 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-common</artifactId> <artifactId>sop-common</artifactId>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>sop-gateway-common</artifactId> <artifactId>sop-gateway-common</artifactId>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>sop-gateway-common</name> <name>sop-gateway-common</name>

@ -59,6 +59,8 @@ public class GatewayModifyResponseGatewayFilter implements GlobalFilter, Ordered
//TODO: flux or mono //TODO: flux or mono
Mono modifiedBody = clientResponse.bodyToMono(inClass) Mono modifiedBody = clientResponse.bodyToMono(inClass)
// 修复微服务接口返回void网关不会返回code和msg问题
.switchIfEmpty(Mono.just(""))
.flatMap(originalBody -> { .flatMap(originalBody -> {
// 合并微服务传递过来的结果,变成最终结果 // 合并微服务传递过来的结果,变成最终结果
ResultExecutor resultExecutor = ApiContext.getApiConfig().getGatewayResultExecutor(); ResultExecutor resultExecutor = ApiContext.getApiConfig().getGatewayResultExecutor();

@ -6,11 +6,11 @@
<parent> <parent>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-common</artifactId> <artifactId>sop-common</artifactId>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>sop-service-common</artifactId> <artifactId>sop-service-common</artifactId>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>sop-service-common</name> <name>sop-service-common</name>

@ -9,13 +9,14 @@ import com.gitee.sop.servercommon.message.ServiceErrorFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@ -26,7 +27,7 @@ import java.util.List;
* @author tanghc * @author tanghc
*/ */
@Slf4j @Slf4j
public class BaseServiceConfiguration extends WebMvcConfigurationSupport { public class BaseServiceConfiguration implements WebMvcConfigurer, WebMvcRegistrations {
public BaseServiceConfiguration() { public BaseServiceConfiguration() {
ServiceConfig.getInstance().getI18nModules().add("i18n/isp/bizerror"); ServiceConfig.getInstance().getI18nModules().add("i18n/isp/bizerror");
@ -38,8 +39,7 @@ public class BaseServiceConfiguration extends WebMvcConfigurationSupport {
private Environment environment; private Environment environment;
@Override @Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) { public void addResourceHandlers(ResourceHandlerRegistry registry) {
super.addResourceHandlers(registry);
// 支持swagger-bootstrap-ui首页 // 支持swagger-bootstrap-ui首页
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/"); registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
// 支持默认swagger // 支持默认swagger
@ -48,14 +48,13 @@ public class BaseServiceConfiguration extends WebMvcConfigurationSupport {
} }
@Override @Override
protected void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
// 添加拦截器 // 添加拦截器
registry.addInterceptor(new ServiceContextInterceptor()); registry.addInterceptor(new ServiceContextInterceptor());
super.addInterceptors(registry);
} }
@Override @Override
protected void extendMessageConverters(List<HttpMessageConverter<?>> converters) { public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
// 解决controller返回字符串中文乱码问题 // 解决controller返回字符串中文乱码问题
for (HttpMessageConverter<?> converter : converters) { for (HttpMessageConverter<?> converter : converters) {
if (converter instanceof StringHttpMessageConverter) { if (converter instanceof StringHttpMessageConverter) {
@ -69,7 +68,7 @@ public class BaseServiceConfiguration extends WebMvcConfigurationSupport {
* @return 返回RequestMappingHandlerMapping * @return 返回RequestMappingHandlerMapping
*/ */
@Override @Override
protected RequestMappingHandlerMapping createRequestMappingHandlerMapping() { public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
return apiMappingHandlerMapping; return apiMappingHandlerMapping;
} }

@ -28,7 +28,7 @@
<dependency> <dependency>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-service-common</artifactId> <artifactId>sop-service-common</artifactId>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>

@ -3,7 +3,6 @@ package com.gitee.sop.bookweb.config;
import com.gitee.sop.servercommon.configuration.AlipayServiceConfiguration; import com.gitee.sop.servercommon.configuration.AlipayServiceConfiguration;
import com.gitee.sop.servercommon.swagger.SwaggerSupport; import com.gitee.sop.servercommon.swagger.SwaggerSupport;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.swagger2.annotations.EnableSwagger2;
/** /**
@ -13,15 +12,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration @Configuration
public class OpenServiceConfig extends AlipayServiceConfiguration { public class OpenServiceConfig extends AlipayServiceConfiguration {
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
super.addResourceHandlers(registry);
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
// 开启文档 // 开启文档
@Configuration @Configuration
@EnableSwagger2 @EnableSwagger2

@ -29,7 +29,7 @@
<dependency> <dependency>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-service-common</artifactId> <artifactId>sop-service-common</artifactId>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
</dependency> </dependency>
<!-- 使用nacos注册中心 <!-- 使用nacos注册中心

@ -20,7 +20,7 @@
<dependency> <dependency>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-service-common</artifactId> <artifactId>sop-service-common</artifactId>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
</dependency> </dependency>
<!-- nacos --> <!-- nacos -->
<dependency> <dependency>

@ -28,7 +28,7 @@
<dependency> <dependency>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-service-common</artifactId> <artifactId>sop-service-common</artifactId>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>

@ -34,7 +34,7 @@
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-bridge-gateway</artifactId> <artifactId>sop-bridge-gateway</artifactId>
<!--<artifactId>sop-bridge-zuul</artifactId>--> <!--<artifactId>sop-bridge-zuul</artifactId>-->
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

@ -35,7 +35,7 @@
<dependency> <dependency>
<groupId>com.gitee.sop</groupId> <groupId>com.gitee.sop</groupId>
<artifactId>sop-gateway-common</artifactId> <artifactId>sop-gateway-common</artifactId>
<version>3.1.0-SNAPSHOT</version> <version>3.1.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

@ -148,8 +148,15 @@ public class SwaggerDocParser implements DocParser {
List<DocParameter> docParameterList = new ArrayList<>(); List<DocParameter> docParameterList = new ArrayList<>();
for (int i = 0; i < parameters.size(); i++) { for (int i = 0; i < parameters.size(); i++) {
JSONObject fieldJson = parameters.getJSONObject(i); JSONObject fieldJson = parameters.getJSONObject(i);
DocParameter docParameter = fieldJson.toJavaObject(DocParameter.class); JSONObject schema = fieldJson.getJSONObject("schema");
docParameterList.add(docParameter); if (schema != null) {
RefInfo refInfo = getRefInfo(schema);
List<DocParameter> parameterList = this.buildDocParameters(refInfo.ref, docRoot, true);
docParameterList.addAll(parameterList);
} else {
DocParameter docParameter = fieldJson.toJavaObject(DocParameter.class);
docParameterList.add(docParameter);
}
} }
Map<String, List<DocParameter>> collect = docParameterList.stream() Map<String, List<DocParameter>> collect = docParameterList.stream()

Loading…
Cancel
Save