|
@@ -1,22 +1,13 @@
|
|
|
package com.qmth.themis.exam.config;
|
|
|
|
|
|
-import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
|
-import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
-import com.fasterxml.jackson.databind.module.SimpleModule;
|
|
|
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
|
import com.qmth.themis.exam.interceptor.AuthInterceptor;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
-import org.springframework.http.converter.HttpMessageConverter;
|
|
|
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.math.BigInteger;
|
|
|
-import java.util.List;
|
|
|
-import java.util.TimeZone;
|
|
|
|
|
|
/**
|
|
|
* @Description: 路径拦截器
|
|
@@ -41,27 +32,27 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|
|
registry.addInterceptor(AuthInterceptor()).addPathPatterns(SystemConstant.ALL_PATH).excludePathPatterns(dictionaryConfig.authNoUrlDomain().getUrls());
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
|
|
- ObjectMapper objectMapper = new ObjectMapper();
|
|
|
- objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
|
|
- objectMapper.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
|
|
|
-
|
|
|
- objectMapper.setTimeZone(TimeZone.getTimeZone("GMT+8"));
|
|
|
- //objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
|
|
|
-
|
|
|
- // 处理数字位数超过JS默认最大数字时精度差异问题
|
|
|
- SimpleModule simpleModule = new SimpleModule();
|
|
|
- simpleModule.addSerializer(BigInteger.class, ToStringSerializer.instance);
|
|
|
- simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
|
|
|
- simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
|
|
|
-
|
|
|
- objectMapper.registerModule(simpleModule);
|
|
|
-
|
|
|
- for (HttpMessageConverter<?> c : converters) {
|
|
|
- if (c instanceof MappingJackson2HttpMessageConverter) {
|
|
|
- ((MappingJackson2HttpMessageConverter) c).setObjectMapper(objectMapper);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// @Override
|
|
|
+// public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
|
|
+// ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+// objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
|
|
+// objectMapper.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
|
|
|
+//
|
|
|
+// objectMapper.setTimeZone(TimeZone.getTimeZone("GMT+8"));
|
|
|
+// //objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
|
|
|
+//
|
|
|
+// // 处理数字位数超过JS默认最大数字时精度差异问题
|
|
|
+// SimpleModule simpleModule = new SimpleModule();
|
|
|
+// simpleModule.addSerializer(BigInteger.class, ToStringSerializer.instance);
|
|
|
+// simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
|
|
|
+// simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
|
|
|
+//
|
|
|
+// objectMapper.registerModule(simpleModule);
|
|
|
+//
|
|
|
+// for (HttpMessageConverter<?> c : converters) {
|
|
|
+// if (c instanceof MappingJackson2HttpMessageConverter) {
|
|
|
+// ((MappingJackson2HttpMessageConverter) c).setObjectMapper(objectMapper);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|