From 48d40971c4f471f3f3f44e3696f9922ded29b55d Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Tue, 27 Jun 2023 19:02:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dswagger=E5=AF=BC=E5=85=A5=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E8=BD=AC=E6=8D=A2=E6=A0=BC=E5=BC=8F=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1027227 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001027227 --- .../main/java/io/metersphere/commons/utils/JSONUtil.java | 3 +++ framework/sdk-parent/jmeter/pom.xml | 6 ++++++ .../src/main/java/io/metersphere/utils/JsonUtils.java | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/api-test/backend/src/main/java/io/metersphere/commons/utils/JSONUtil.java b/api-test/backend/src/main/java/io/metersphere/commons/utils/JSONUtil.java index eaa62b0bb1..942026bb3b 100644 --- a/api-test/backend/src/main/java/io/metersphere/commons/utils/JSONUtil.java +++ b/api-test/backend/src/main/java/io/metersphere/commons/utils/JSONUtil.java @@ -11,6 +11,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.type.CollectionType; import com.fasterxml.jackson.databind.type.TypeFactory; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParser; @@ -52,6 +53,8 @@ public class JSONUtil { // 设置JSON处理字符长度限制 objectMapper.getFactory() .setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(JSON.DEFAULT_MAX_STRING_LEN).build()); + // 处理时间格式 + objectMapper.registerModule(new JavaTimeModule()); } diff --git a/framework/sdk-parent/jmeter/pom.xml b/framework/sdk-parent/jmeter/pom.xml index 75f0d70374..365ef208a4 100644 --- a/framework/sdk-parent/jmeter/pom.xml +++ b/framework/sdk-parent/jmeter/pom.xml @@ -299,6 +299,12 @@ commons-dbcp2 ${commons-dbcp2-version} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + 2.15.0 + compile + diff --git a/framework/sdk-parent/jmeter/src/main/java/io/metersphere/utils/JsonUtils.java b/framework/sdk-parent/jmeter/src/main/java/io/metersphere/utils/JsonUtils.java index 2fb849d59c..e61fbd97e7 100644 --- a/framework/sdk-parent/jmeter/src/main/java/io/metersphere/utils/JsonUtils.java +++ b/framework/sdk-parent/jmeter/src/main/java/io/metersphere/utils/JsonUtils.java @@ -9,6 +9,8 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.type.CollectionType; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; + import java.io.IOException; import java.io.InputStream; @@ -31,6 +33,8 @@ public class JsonUtils { // 设置JSON处理字符长度限制 objectMapper.getFactory() .setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(DEFAULT_MAX_STRING_LEN).build()); + // 处理时间格式 + objectMapper.registerModule(new JavaTimeModule()); }