mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
4.3.2
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
# changelog
|
# changelog
|
||||||
|
|
||||||
|
## 4.3.2
|
||||||
|
|
||||||
|
- 修复微服务方法没有参数时获取不到OpenContext问题
|
||||||
|
|
||||||
## 4.3.1
|
## 4.3.1
|
||||||
|
|
||||||
- 修复serviceId有大小写出现404问题
|
- 修复serviceId有大小写出现404问题
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>doc</artifactId>
|
<artifactId>doc</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Generic properties -->
|
<!-- Generic properties -->
|
||||||
|
2
pom.xml
2
pom.xml
@@ -11,7 +11,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-parent</artifactId>
|
<artifactId>sop-parent</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<description>一个开放平台解决方案项目,基于Spring Cloud实现,目标是能够让用户快速得搭建起自己的开放平台</description>
|
<description>一个开放平台解决方案项目,基于Spring Cloud实现,目标是能够让用户快速得搭建起自己的开放平台</description>
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-parent</artifactId>
|
<artifactId>sop-parent</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@@ -5,13 +5,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-parent</artifactId>
|
<artifactId>sop-parent</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>sop-admin-server</artifactId>
|
<artifactId>sop-admin-server</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-parent</artifactId>
|
<artifactId>sop-parent</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sdk-java</artifactId>
|
<artifactId>sdk-java</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- http请求 -->
|
<!-- http请求 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-parent</artifactId>
|
<artifactId>sop-parent</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-common</artifactId>
|
<artifactId>sop-common</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-common</artifactId>
|
<artifactId>sop-common</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-common</artifactId>
|
<artifactId>sop-common</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-common</artifactId>
|
<artifactId>sop-common</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>sop-service-common</artifactId>
|
<artifactId>sop-service-common</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@@ -1,6 +1,11 @@
|
|||||||
package com.gitee.sop.servercommon.interceptor;
|
package com.gitee.sop.servercommon.interceptor;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.gitee.sop.servercommon.annotation.Open;
|
||||||
|
import com.gitee.sop.servercommon.bean.OpenContextImpl;
|
||||||
import com.gitee.sop.servercommon.bean.ServiceContext;
|
import com.gitee.sop.servercommon.bean.ServiceContext;
|
||||||
|
import com.gitee.sop.servercommon.util.OpenUtil;
|
||||||
|
import org.springframework.web.method.HandlerMethod;
|
||||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -16,6 +21,7 @@ public class ServiceContextInterceptor extends HandlerInterceptorAdapter {
|
|||||||
ServiceContext context = ServiceContext.getCurrentContext();
|
ServiceContext context = ServiceContext.getCurrentContext();
|
||||||
context.setRequest(request);
|
context.setRequest(request);
|
||||||
context.setResponse(response);
|
context.setResponse(response);
|
||||||
|
this.initOpenContextWithNoParam(context, request, handler);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,4 +29,22 @@ public class ServiceContextInterceptor extends HandlerInterceptorAdapter {
|
|||||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||||
ServiceContext.getCurrentContext().unset();
|
ServiceContext.getCurrentContext().unset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修复没有参数的情况下无法获取OpenContext
|
||||||
|
* @param context ServiceContext
|
||||||
|
* @param request HttpServletRequest
|
||||||
|
* @param handler HandlerMethod
|
||||||
|
*/
|
||||||
|
private void initOpenContextWithNoParam(ServiceContext context, HttpServletRequest request, Object handler) {
|
||||||
|
if (handler instanceof HandlerMethod) {
|
||||||
|
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
||||||
|
Open open = handlerMethod.getMethodAnnotation(Open.class);
|
||||||
|
if (open != null && handlerMethod.getMethodParameters().length == 0) {
|
||||||
|
JSONObject requestParams = OpenUtil.getRequestParams(request);
|
||||||
|
OpenContextImpl openContext = new OpenContextImpl(requestParams);
|
||||||
|
context.setOpenContext(openContext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-parent</artifactId>
|
<artifactId>sop-parent</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-parent</artifactId>
|
<artifactId>sop-parent</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-parent</artifactId>
|
<artifactId>sop-parent</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@@ -111,6 +111,16 @@ public class Example1001_BaseController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Open(value = "story.system.param.get2")
|
||||||
|
@GetMapping("/get/system/param/v2")
|
||||||
|
public StoryResult systemParam2() {
|
||||||
|
StoryResult result = new StoryResult();
|
||||||
|
OpenContext openContext = ServiceContext.getCurrentContext().getOpenContext();
|
||||||
|
String token = openContext.getAppAuthToken();
|
||||||
|
result.setName(token);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// 参数绑定,少量参数可以这样写,参数多了建议放进类里面
|
// 参数绑定,少量参数可以这样写,参数多了建议放进类里面
|
||||||
@Open(value = "story.oneparam")
|
@Open(value = "story.oneparam")
|
||||||
@GetMapping("/oneParam/v1")
|
@GetMapping("/oneParam/v1")
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-parent</artifactId>
|
<artifactId>sop-parent</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-parent</artifactId>
|
<artifactId>sop-parent</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@@ -4,13 +4,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-parent</artifactId>
|
<artifactId>sop-parent</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>sdk-java</artifactId>
|
<artifactId>sdk-java</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Generic properties -->
|
<!-- Generic properties -->
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-parent</artifactId>
|
<artifactId>sop-parent</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@@ -371,6 +371,24 @@ public class AllInOneTest extends TestBase {
|
|||||||
client.execute(requestBuilder);
|
client.execute(requestBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 没有参数获取token
|
||||||
|
*/
|
||||||
|
public void testNoParamToken() {
|
||||||
|
String token = "asdfasdfadsf";
|
||||||
|
Client.RequestBuilder requestBuilder = new Client.RequestBuilder()
|
||||||
|
.method("story.system.param.get2")
|
||||||
|
.version("1.0")
|
||||||
|
.appAuthToken(token)
|
||||||
|
.httpMethod(HttpTool.HTTPMethod.GET)
|
||||||
|
.callback((requestInfo, responseData) -> {
|
||||||
|
System.out.println(responseData);
|
||||||
|
Assert.assertTrue(responseData.contains(token));
|
||||||
|
});
|
||||||
|
|
||||||
|
client.execute(requestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
static class BizContent extends HashMap<String, Object> {
|
static class BizContent extends HashMap<String, Object> {
|
||||||
public BizContent add(String key, Object value) {
|
public BizContent add(String key, Object value) {
|
||||||
this.put(key, value);
|
this.put(key, value);
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-parent</artifactId>
|
<artifactId>sop-parent</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-website</artifactId>
|
<artifactId>sop-website</artifactId>
|
||||||
<version>4.3.1-SNAPSHOT</version>
|
<version>4.3.2-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user