Administrator 2 лет назад
Родитель
Сommit
e67e6570ac

+ 0 - 2
src/main/java/com/xiesx/fastboot/core/fastjson/cfg/FastJsonCfg.java

@@ -16,7 +16,6 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.alibaba.fastjson.serializer.ToStringSerializer;
 import com.alibaba.fastjson.support.config.FastJsonConfig;
 import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
-import com.xiesx.fastboot.core.fastjson.serializer.CustomerBigDecimalCodec;
 
 @Configuration
 @EnableConfigurationProperties(FastJsonProperties.class)
@@ -75,7 +74,6 @@ public class FastJsonCfg implements WebMvcConfigurer {
         serializeConfig.put(Long.class, ToStringSerializer.instance);
         serializeConfig.put(Long.TYPE, ToStringSerializer.instance);
         serializeConfig.put(BigInteger.class, ToStringSerializer.instance);
-        serializeConfig.put(BigDecimal.class, CustomerBigDecimalCodec.instance);
         fastJsonConfig.setSerializeConfig(serializeConfig);
         return fastJsonConfig;
     }

+ 17 - 0
src/main/java/com/xiesx/fastboot/utils/CopyUtils.java

@@ -46,4 +46,21 @@ public class CopyUtils {
         String[] result = new String[noValuePropertySet.size()];
         return noValuePropertySet.toArray(result);
     }
+
+    public static String[] notNullNames(@NonNull Object source) {
+
+        final BeanWrapper beanWrapper = new BeanWrapperImpl(source);
+
+        PropertyDescriptor[] pds = beanWrapper.getPropertyDescriptors();
+
+        Set<String> noValuePropertySet = Sets.newHashSet();
+        Arrays.stream(pds).forEach(pd -> {
+            Object propertyValue = beanWrapper.getPropertyValue(pd.getName());
+            if (ObjectUtils.isNotEmpty(propertyValue)) {
+                noValuePropertySet.add(pd.getName());
+            }
+        });
+        String[] result = new String[noValuePropertySet.size()];
+        return noValuePropertySet.toArray(result);
+    }
 }