Ver a proveniência

[小程序通信问题][修复]:修复Long丢失精度及时间显示等问题

release_toaliyun_real
Stormeye.Wu há 7 anos
ascendente
cometimento
b5eeb1f479
2 ficheiros alterados com 7 adições e 3 eliminações
  1. +2
    -0
      mallinkBApi/src/main/java/com/iformall/config/WebMvcConfig.java
  2. +5
    -3
      mallinkCApi/src/main/java/com/iformall/config/WebMvcConfig.java

+ 2
- 0
mallinkBApi/src/main/java/com/iformall/config/WebMvcConfig.java Ver ficheiro

@@ -12,6 +12,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -29,6 +30,7 @@ import java.util.List;
* @date 2017-04-20 22:30 * @date 2017-04-20 22:30
*/ */
@Configuration @Configuration
@EnableWebMvc
public class WebMvcConfig implements WebMvcConfigurer { public class WebMvcConfig implements WebMvcConfigurer {
@Autowired @Autowired
private AuthorizationInterceptor authorizationInterceptor; private AuthorizationInterceptor authorizationInterceptor;


+ 5
- 3
mallinkCApi/src/main/java/com/iformall/config/WebMvcConfig.java Ver ficheiro

@@ -12,6 +12,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -29,6 +30,7 @@ import java.util.List;
* @date 2017-04-20 22:30 * @date 2017-04-20 22:30
*/ */
@Configuration @Configuration
@EnableWebMvc
public class WebMvcConfig implements WebMvcConfigurer { public class WebMvcConfig implements WebMvcConfigurer {
@Autowired @Autowired
private AuthorizationInterceptor authorizationInterceptor; private AuthorizationInterceptor authorizationInterceptor;
@@ -68,11 +70,11 @@ public class WebMvcConfig implements WebMvcConfigurer {
.without(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .without(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
); );
//序列化将Long转String类型 //序列化将Long转String类型
simpleModule.addSerializer(Long.class, com.fasterxml.jackson.databind.ser.std.ToStringSerializer.instance);
simpleModule.addSerializer(Long.TYPE, com.fasterxml.jackson.databind.ser.std.ToStringSerializer.instance);
simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
SimpleModule bigIntegerModule = new SimpleModule(); SimpleModule bigIntegerModule = new SimpleModule();
//序列化将BigInteger转String类型 //序列化将BigInteger转String类型
bigIntegerModule.addSerializer(BigInteger.class, com.fasterxml.jackson.databind.ser.std.ToStringSerializer.instance);
bigIntegerModule.addSerializer(BigInteger.class, ToStringSerializer.instance);
SimpleModule bigDecimalModule = new SimpleModule(); SimpleModule bigDecimalModule = new SimpleModule();
//序列化将BigDecimal转String类型 //序列化将BigDecimal转String类型
bigDecimalModule.addSerializer(BigDecimal.class, ToStringSerializer.instance); bigDecimalModule.addSerializer(BigDecimal.class, ToStringSerializer.instance);


Carregando…
Cancelar
Guardar