From cc24fc3124c8c92071efba354f1c152d3cba675e Mon Sep 17 00:00:00 2001
From: guosongrui <17737810342@163.com>
Date: Mon, 13 May 2024 19:14:19 +0800
Subject: [PATCH] =?UTF-8?q?Feature=20=E6=B7=BB=E5=8A=A0JacksonConfig?=
=?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=AF=B9=E6=97=A5=E6=9C=9F=E6=A0=BC=E5=BC=8F?=
=?UTF-8?q?=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 2 +-
.../com/njcn/bpm/config/JacksonConfig.java | 22 +++++++++++++++++++
.../bpm-boot/src/main/resources/bootstrap.yml | 3 +++
3 files changed, 26 insertions(+), 1 deletion(-)
create mode 100644 pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/config/JacksonConfig.java
diff --git a/pom.xml b/pom.xml
index d7c0e9aea..acb276043 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,7 +52,7 @@
- fd74182b-1fce-4dba-afa7-2623b0376205
+ 6d75b5c3-cff9-4c4a-8e8b-ca2363753ecb
${middle.server.url}:8080
diff --git a/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/config/JacksonConfig.java b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/config/JacksonConfig.java
new file mode 100644
index 000000000..d7c924461
--- /dev/null
+++ b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/config/JacksonConfig.java
@@ -0,0 +1,22 @@
+package com.njcn.bpm.config;
+
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
+import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+@Configuration
+public class JacksonConfig {
+ public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
+ @Bean
+ public Jackson2ObjectMapperBuilderCustomizer jsonCustomizer() {
+ return builder -> { builder.simpleDateFormat(DATE_TIME_FORMAT);
+ JavaTimeModule module = new JavaTimeModule(); module.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)));
+ builder.modules(module);
+ };
+ }
+}
\ No newline at end of file
diff --git a/pqs-bpm/bpm-boot/src/main/resources/bootstrap.yml b/pqs-bpm/bpm-boot/src/main/resources/bootstrap.yml
index 7ea185876..30a9b7713 100644
--- a/pqs-bpm/bpm-boot/src/main/resources/bootstrap.yml
+++ b/pqs-bpm/bpm-boot/src/main/resources/bootstrap.yml
@@ -16,6 +16,9 @@ feign:
spring:
application:
name: @artifactId@
+ jackson:
+ date-format: yyyy-MM-dd HH:mm:ss
+ time-zone: Asia/Shanghai
#nacos注册中心以及配置中心的指定
cloud:
nacos: