From 40d0a50151ce1068dc2a2a52df253d454cc5b082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=A2=A6=E6=8A=80=E6=9C=AF?= <596392912@qq.com> Date: Thu, 21 Dec 2023 21:41:56 +0800 Subject: [PATCH 1/5] =?UTF-8?q?:sparkles:=20=E4=BE=9D=E8=B5=96=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 67c53f9d6..bdc4a809d 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { ext { javaVersion = JavaVersion.VERSION_1_8 springBootVersion = "2.7.18" - springCloudVersion = "2021.0.8" + springCloudVersion = "2021.0.9" micaAutoVersion = "2.3.3" micaWeiXinVersion = "2.1.2" knife4jVersion = "3.0.3" From 3bd4a8a89643c9d99980805b3d95126673d56c28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=A2=A6=E6=8A=80=E6=9C=AF?= <596392912@qq.com> Date: Thu, 21 Dec 2023 21:58:06 +0800 Subject: [PATCH 2/5] =?UTF-8?q?:sparkles:=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index bdc4a809d..e3f675a32 100644 --- a/build.gradle +++ b/build.gradle @@ -46,7 +46,7 @@ configure(subprojects - project(":mica-bom")) { targetCompatibility = "$javaVersion" tasks.withType(JavaCompile) { options.encoding = "UTF-8" - options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" + options.compilerArgs << "-parameters" << "-Xlint:unchecked" << "-Xlint:deprecation" } repositories { From 8f2ea99b5ff3ceed06f51be778ac3060df04f568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C7=B3=C3=83=C3=8E?= <1101766085@qq.com> Date: Fri, 22 Dec 2023 16:24:33 +0800 Subject: [PATCH 3/5] =?UTF-8?q?:sparkles:=20=E4=BC=98=E5=8C=96=EF=BC=8C?= =?UTF-8?q?=E4=BD=BF=20mica-http=20=E5=AE=8C=E5=85=A8=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E4=B8=8D=E4=BE=9D=E8=B5=96=20Spring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/net/dreamlu/mica/core/utils/JsonUtil.java | 11 +++++------ .../main/java/net/dreamlu/mica/http/HttpLogger.java | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/mica-core/src/main/java/net/dreamlu/mica/core/utils/JsonUtil.java b/mica-core/src/main/java/net/dreamlu/mica/core/utils/JsonUtil.java index 7bb5d4a49..7e0f14617 100644 --- a/mica-core/src/main/java/net/dreamlu/mica/core/utils/JsonUtil.java +++ b/mica-core/src/main/java/net/dreamlu/mica/core/utils/JsonUtil.java @@ -29,7 +29,6 @@ import com.fasterxml.jackson.databind.type.MapType; import net.dreamlu.mica.core.function.CheckedConsumer; import org.springframework.lang.Nullable; -import org.springframework.util.ObjectUtils; import java.io.IOException; import java.io.InputStream; @@ -220,7 +219,7 @@ public static JsonNode readTree(JsonParser jsonParser) { */ @Nullable public static T readValue(@Nullable byte[] content, Class valueType) { - if (ObjectUtils.isEmpty(content)) { + if (content == null || content.length == 0) { return null; } try { @@ -301,7 +300,7 @@ public static T readValue(@Nullable Reader reader, Class valueType) { */ @Nullable public static T readValue(@Nullable byte[] content, TypeReference typeReference) { - if (ObjectUtils.isEmpty(content)) { + if (content == null || content.length == 0) { return null; } try { @@ -381,7 +380,7 @@ public static T readValue(@Nullable Reader reader, TypeReference typeRefe */ @Nullable public static T readValue(@Nullable byte[] content, JavaType javaType) { - if (ObjectUtils.isEmpty(content)) { + if (content == null || content.length == 0) { return null; } try { @@ -531,7 +530,7 @@ public static JavaType getParametricType(Class parametrized, JavaType... para * @return 集合 */ public static List readList(@Nullable byte[] content, Class elementClass) { - if (ObjectUtils.isEmpty(content)) { + if (content == null || content.length == 0) { return Collections.emptyList(); } try { @@ -697,7 +696,7 @@ public static Map readMap(@Nullable String content, Class valu * @return 集合 */ public static Map readMap(@Nullable byte[] content, Class keyClass, Class valueClass) { - if (ObjectUtils.isEmpty(content)) { + if (content == null || content.length == 0) { return Collections.emptyMap(); } try { diff --git a/mica-http/src/main/java/net/dreamlu/mica/http/HttpLogger.java b/mica-http/src/main/java/net/dreamlu/mica/http/HttpLogger.java index 3dc8d8fba..49565a565 100644 --- a/mica-http/src/main/java/net/dreamlu/mica/http/HttpLogger.java +++ b/mica-http/src/main/java/net/dreamlu/mica/http/HttpLogger.java @@ -46,7 +46,7 @@ public void log(@Nonnull String message) { @Override public void log(@Nonnull String message) { // 统一添加前缀,方便在茫茫日志中查看 - System.out.printf("HttpLogger: %s\n", message); + System.out.println("HttpLogger: " + message); } }; From c17fb4ab76f428cf1be82dd7c8e6a7e449aad01b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C7=B3=C3=83=C3=8E?= <1101766085@qq.com> Date: Fri, 22 Dec 2023 16:35:12 +0800 Subject: [PATCH 4/5] =?UTF-8?q?:sparkles:=20=E6=A2=B3=E7=90=86=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 8 ++++++++ mica-http/src/test/java/net/dreamlu/HttpRequestDemo.java | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f77bf37f..2c21fd1c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ ## 发行版本 +### v2.7.18.1 - 2023-12-24 + +- :sparkles: mica-http 优化,添加 `.setGlobalLog(log::info)`,`.useLog(log::info)` 避免需要配置 net.dreamlu.mica.http 包日志等级 +- :sparkles: mica-http 完善,添加 `asPart` 系列方法,方便下载的文件再上传的场景。 +- :sparkles: mica-core 完善 GeoUtil。 +- :sparkles: mica-core 优化 JsonUtil,使完全可以不依赖 Spring。 +- :sparkles: mica-core 完善 DesensitizationUtil 工具类。 + ### v2.7.18 - 2023-12-01 - :sparkles: mica-http 完善和优化,使用控制台日志时,可以没有 slf4j 依赖。 diff --git a/mica-http/src/test/java/net/dreamlu/HttpRequestDemo.java b/mica-http/src/test/java/net/dreamlu/HttpRequestDemo.java index 55bea01a6..debec3c49 100644 --- a/mica-http/src/test/java/net/dreamlu/HttpRequestDemo.java +++ b/mica-http/src/test/java/net/dreamlu/HttpRequestDemo.java @@ -17,6 +17,7 @@ package net.dreamlu; import com.fasterxml.jackson.databind.JsonNode; +import lombok.extern.slf4j.Slf4j; import net.dreamlu.mica.core.utils.Base64Util; import net.dreamlu.mica.http.HttpLogger; import net.dreamlu.mica.http.HttpRequest; @@ -33,6 +34,7 @@ * * @author L.cm */ +@Slf4j public class HttpRequestDemo { public void doc() { @@ -40,10 +42,12 @@ public void doc() { HttpRequest.setGlobalLog(LogLevel.BODY); // 设置控制台日志,用于没有日志依赖的 sdk 开发时使用 HttpRequest.setGlobalLog(HttpLogger.Console, LogLevel.BODY); + // 设置为自己的日志,避免需要配置 net.dreamlu.mica.http 包日志等级 + HttpRequest.setGlobalLog(log::info); // 同步请求 url,方法支持 get、post、patch、put、delete HttpRequest.get("https://www.baidu.com") - .useSlf4jLog() //使用 Slf4j 日志,同类的有 .useConsoleLog(),日志级别为 BODY + .useSlf4jLog() //使用 Slf4j 日志,同类的有 .useConsoleLog(),.useLog(log::info),日志级别为 BODY .addHeader("x-account-id", "mica001") // 添加 header .addCookie(new Cookie.Builder() // 添加 cookie .name("sid") From f26992dd2edddb2a33a46fc43f248a08e25a6487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C7=B3=C3=83=C3=8E?= <1101766085@qq.com> Date: Mon, 25 Dec 2023 16:19:30 +0800 Subject: [PATCH 5/5] =?UTF-8?q?:sparkles:=20=E4=BC=98=E5=8C=96=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mica-core/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mica-core/build.gradle b/mica-core/build.gradle index 727633744..d8dcd9739 100644 --- a/mica-core/build.gradle +++ b/mica-core/build.gradle @@ -1,6 +1,6 @@ dependencies { - api "org.springframework:spring-context" api "com.fasterxml.jackson.core:jackson-databind" + implementation "org.springframework:spring-context" compileOnly "org.springframework:spring-web" compileOnly "jakarta.validation:jakarta.validation-api" compileOnly "io.swagger:swagger-annotations:${swaggerVersion}"