|
|
@@ -1,11 +1,18 @@
|
|
|
package cn.com.yusys.yusp.config;
|
|
|
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+import com.fasterxml.jackson.databind.SerializationFeature;
|
|
|
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+
|
|
|
/**
|
|
|
* Web MVC配置类
|
|
|
*
|
|
|
@@ -37,4 +44,16 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 全局Jackson配置,统一时间格式化
|
|
|
+ */
|
|
|
+ @Bean
|
|
|
+ public ObjectMapper objectMapper() {
|
|
|
+ return Jackson2ObjectMapperBuilder.json()
|
|
|
+ .dateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"))
|
|
|
+ .timeZone("GMT+8")
|
|
|
+ .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
|
|
+ .build();
|
|
|
+ }
|
|
|
}
|