From f12b6e7b016835413cdf22ffb7ae64804a2725bc Mon Sep 17 00:00:00 2001 From: tanghc Date: Sun, 13 Dec 2020 14:24:14 +0800 Subject: [PATCH 1/3] 4.2.4 --- doc/docs/files/10011_项目接入到SOP.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/docs/files/10011_项目接入到SOP.md b/doc/docs/files/10011_项目接入到SOP.md index a05026a8..324e80f5 100644 --- a/doc/docs/files/10011_项目接入到SOP.md +++ b/doc/docs/files/10011_项目接入到SOP.md @@ -6,12 +6,13 @@ ```xml -2.3.4.RELEASE +2.1.8.RELEASE -Hoxton.SR8 +Greenwich.SR6 -2.2.3.RELEASE +2.1.2.RELEASE + ``` - pom.xml添加``控制版本 From 4451918acbd5a36b953702e396bc75fdb2b46aa2 Mon Sep 17 00:00:00 2001 From: tanghc Date: Tue, 15 Dec 2020 15:13:45 +0800 Subject: [PATCH 2/3] 4.2.4 --- .../param/ValidationAnnotationDefinitionFactory.java | 9 +++++++++ .../storyweb/controller/Example1001_BaseController.java | 3 ++- .../controller/Example1002_FileUploadController.java | 8 +++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/param/ValidationAnnotationDefinitionFactory.java b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/param/ValidationAnnotationDefinitionFactory.java index 83bf8428..699e9804 100644 --- a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/param/ValidationAnnotationDefinitionFactory.java +++ b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/param/ValidationAnnotationDefinitionFactory.java @@ -17,6 +17,8 @@ import org.hibernate.validator.constraints.SafeHtml; import org.hibernate.validator.constraints.ScriptAssert; import org.hibernate.validator.constraints.URL; import org.hibernate.validator.constraints.UniqueElements; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestParam; import javax.validation.constraints.AssertFalse; import javax.validation.constraints.AssertTrue; @@ -40,7 +42,9 @@ import javax.validation.constraints.Positive; import javax.validation.constraints.PositiveOrZero; import javax.validation.constraints.Size; import java.lang.annotation.Annotation; +import java.util.Arrays; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -50,6 +54,8 @@ public class ValidationAnnotationDefinitionFactory { private static final Map, ValidationAnnotationBuilder> store = new HashMap<>(64); + private static final List> excludeList = Arrays.asList(RequestParam.class, PathVariable.class); + static { new BaseValidationAnnotationBuilder(){}; @@ -107,6 +113,9 @@ public class ValidationAnnotationDefinitionFactory { public static ValidationAnnotationDefinition build(Annotation annotation) { Class jsr303Anno = annotation.annotationType(); + if (excludeList.contains(jsr303Anno)) { + return null; + } ValidationAnnotationBuilder validationAnnotationBuilder = store.get(jsr303Anno); if (validationAnnotationBuilder == null) { return null; diff --git a/sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/Example1001_BaseController.java b/sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/Example1001_BaseController.java index 73393281..97f4ae20 100644 --- a/sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/Example1001_BaseController.java +++ b/sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/Example1001_BaseController.java @@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; @@ -138,7 +139,7 @@ public class Example1001_BaseController { // 参数绑定 @Open(value = "story.param.bind", mergeResult = false) @RequestMapping("/get/param/v1") - public StoryResult param(int id, String name) { + public StoryResult param(@RequestParam("id") Integer id, @RequestParam String name) { StoryResult result = new StoryResult(); result.setName("参数绑定:id:" + id + ", name:" + name); return result; diff --git a/sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/Example1002_FileUploadController.java b/sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/Example1002_FileUploadController.java index 815f1eb1..accfa90c 100644 --- a/sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/Example1002_FileUploadController.java +++ b/sop-example/sop-story/src/main/java/com/gitee/sop/storyweb/controller/Example1002_FileUploadController.java @@ -10,6 +10,8 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.Extension; import io.swagger.annotations.ExtensionProperty; import org.apache.commons.io.IOUtils; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; @@ -38,7 +40,7 @@ public class Example1002_FileUploadController { */ @ApiOperation(value = "文件上传例1", notes = "上传文件demo") @Open("file.upload") - @RequestMapping("file1") + @PostMapping(value = "file1", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public FileUploadResult file1(FileUploadParam param) { // 获取上传的文件 MultipartFile file1 = param.getFile1(); @@ -64,7 +66,7 @@ public class Example1002_FileUploadController { // 多文件上传、不确定文件数量上传,必须申明下面这句,否则沙盒界面不会出现上传控件 , extensions = @Extension(properties = @ExtensionProperty(name = "multiple", value = "multiple"))) @Open("file.upload2") - @RequestMapping("file2") + @PostMapping(value = "file2", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public FileUploadResult file2(FileUploadParam2 param, HttpServletRequest request) { System.out.println(param.getRemark()); FileUploadResult result = new FileUploadResult(); @@ -78,7 +80,7 @@ public class Example1002_FileUploadController { } @Open("file.upload3") - @RequestMapping("file3") + @PostMapping(value = "file3", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public FileUploadResult file3(FileUploadParam2 param, HttpServletRequest request) { System.out.println(param.getRemark()); FileUploadResult result = new FileUploadResult(); From 9fa4ccce2b490f7ebabe964a0e04807bc4a6e4a4 Mon Sep 17 00:00:00 2001 From: tanghc Date: Tue, 15 Dec 2020 16:37:20 +0800 Subject: [PATCH 3/3] 4.2.4 --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index acf3aa07..f554358b 100644 --- a/pom.xml +++ b/pom.xml @@ -222,9 +222,9 @@ - spring-milestones - Spring Milestones - https://repo.spring.io/milestone + aliyun + aliyun + https://maven.aliyun.com/repository/public