Bladeren bron

feat: resumit some utils

zhangjun 2 jaren geleden
bovenliggende
commit
916fb9c090
19 gewijzigde bestanden met toevoegingen van 3431 en 0 verwijderingen
  1. 52 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/Base64Util.java
  2. 191 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/BaseBeanCopier.java
  3. 24 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/BeanProperty.java
  4. 137 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/BeanUtil.java
  5. 36 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/Charsets.java
  6. 65 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/ClassUtil.java
  7. 37 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/CollectionUtil.java
  8. 69 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/ConcurrentDateFormat.java
  9. 267 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/DateUtil.java
  10. 89 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/DigestUtil.java
  11. 581 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/Func.java
  12. 99 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/HexUtil.java
  13. 66 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/IoUtil.java
  14. 312 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/JsonUtil.java
  15. 102 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/Kv.java
  16. 56 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/StrFormatter.java
  17. 238 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/StrSpliter.java
  18. 741 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/StringUtil.java
  19. 269 0
      zzbusiness-common/src/main/java/org/zhongzheng/common/utils/WebUtil.java

+ 52 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/Base64Util.java

@@ -0,0 +1,52 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+import java.nio.charset.Charset;
+import org.springframework.util.Base64Utils;
+
+public class Base64Util extends Base64Utils {
+    public Base64Util() {
+    }
+
+    public static String encode(String value) {
+        return encode(value, Charsets.UTF_8);
+    }
+
+    public static String encode(String value, Charset charset) {
+        byte[] val = value.getBytes(charset);
+        return new String(encode(val), charset);
+    }
+
+    public static String encodeUrlSafe(String value) {
+        return encodeUrlSafe(value, Charsets.UTF_8);
+    }
+
+    public static String encodeUrlSafe(String value, Charset charset) {
+        byte[] val = value.getBytes(charset);
+        return new String(encodeUrlSafe(val), charset);
+    }
+
+    public static String decode(String value) {
+        return decode(value, Charsets.UTF_8);
+    }
+
+    public static String decode(String value, Charset charset) {
+        byte[] val = value.getBytes(charset);
+        byte[] decodedValue = decode(val);
+        return new String(decodedValue, charset);
+    }
+
+    public static String decodeUrlSafe(String value) {
+        return decodeUrlSafe(value, Charsets.UTF_8);
+    }
+
+    public static String decodeUrlSafe(String value, Charset charset) {
+        byte[] val = value.getBytes(charset);
+        byte[] decodedValue = decodeUrlSafe(val);
+        return new String(decodedValue, charset);
+    }
+}

+ 191 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/BaseBeanCopier.java

@@ -0,0 +1,191 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Modifier;
+import java.security.ProtectionDomain;
+import java.util.HashMap;
+import java.util.Map;
+import org.zhongzheng.common.utils.BeanUtil;
+import org.springframework.asm.ClassVisitor;
+import org.springframework.asm.Type;
+import org.springframework.cglib.core.AbstractClassGenerator;
+import org.springframework.cglib.core.ClassEmitter;
+import org.springframework.cglib.core.CodeEmitter;
+import org.springframework.cglib.core.Constants;
+import org.springframework.cglib.core.Converter;
+import org.springframework.cglib.core.EmitUtils;
+import org.springframework.cglib.core.KeyFactory;
+import org.springframework.cglib.core.Local;
+import org.springframework.cglib.core.MethodInfo;
+import org.springframework.cglib.core.ReflectUtils;
+import org.springframework.cglib.core.Signature;
+import org.springframework.cglib.core.TypeUtils;
+
+public abstract class BaseBeanCopier {
+    private static final BeanCopierKey KEY_FACTORY = (BeanCopierKey)KeyFactory.create(BeanCopierKey.class);
+    private static final Type CONVERTER = TypeUtils.parseType("org.springframework.cglib.core.Converter");
+    private static final Type BEAN_COPIER = TypeUtils.parseType(BaseBeanCopier.class.getName());
+    private static final Signature COPY;
+    private static final Signature CONVERT;
+
+    public BaseBeanCopier() {
+    }
+
+    public static BaseBeanCopier create(Class source, Class target, boolean useConverter) {
+        return create(source, target, (ClassLoader)null, useConverter);
+    }
+
+    public static BaseBeanCopier create(Class source, Class target, ClassLoader classLoader, boolean useConverter) {
+        Generator gen;
+        if (classLoader == null) {
+            gen = new Generator();
+        } else {
+            gen = new Generator(classLoader);
+        }
+
+        gen.setSource(source);
+        gen.setTarget(target);
+        gen.setUseConverter(useConverter);
+        return gen.create();
+    }
+
+    public abstract void copy(Object from, Object to, Converter converter);
+
+    static {
+        COPY = new Signature("copy", Type.VOID_TYPE, new Type[]{Constants.TYPE_OBJECT, Constants.TYPE_OBJECT, CONVERTER});
+        CONVERT = TypeUtils.parseSignature("Object convert(Object, Class, Object)");
+    }
+
+    public static class Generator extends AbstractClassGenerator {
+        private static final AbstractClassGenerator.Source SOURCE = new AbstractClassGenerator.Source(BaseBeanCopier.class.getName());
+        private final ClassLoader classLoader;
+        private Class source;
+        private Class target;
+        private boolean useConverter;
+
+        Generator() {
+            super(SOURCE);
+            this.classLoader = null;
+        }
+
+        Generator(ClassLoader classLoader) {
+            super(SOURCE);
+            this.classLoader = classLoader;
+        }
+
+        public void setSource(Class source) {
+            if (!Modifier.isPublic(source.getModifiers())) {
+                this.setNamePrefix(source.getName());
+            }
+
+            this.source = source;
+        }
+
+        public void setTarget(Class target) {
+            if (!Modifier.isPublic(target.getModifiers())) {
+                this.setNamePrefix(target.getName());
+            }
+
+            this.target = target;
+        }
+
+        public void setUseConverter(boolean useConverter) {
+            this.useConverter = useConverter;
+        }
+
+        protected ClassLoader getDefaultClassLoader() {
+            return this.target.getClassLoader();
+        }
+
+        protected ProtectionDomain getProtectionDomain() {
+            return ReflectUtils.getProtectionDomain(this.source);
+        }
+
+        public BaseBeanCopier create() {
+            Object key = BaseBeanCopier.KEY_FACTORY.newInstance(this.source.getName(), this.target.getName(), this.useConverter);
+            return (BaseBeanCopier)super.create(key);
+        }
+
+        public void generateClass(ClassVisitor v) {
+            Type sourceType = Type.getType(this.source);
+            Type targetType = Type.getType(this.target);
+            ClassEmitter ce = new ClassEmitter(v);
+            ce.begin_class(46, 1, this.getClassName(), BaseBeanCopier.BEAN_COPIER, (Type[])null, "<generated>");
+            EmitUtils.null_constructor(ce);
+            CodeEmitter e = ce.begin_method(1, BaseBeanCopier.COPY, (Type[])null);
+            PropertyDescriptor[] getters = BeanUtil.getBeanGetters(this.source);
+            PropertyDescriptor[] setters = BeanUtil.getBeanSetters(this.target);
+            Map<String, Object> names = new HashMap(16);
+            PropertyDescriptor[] var9 = getters;
+            int var10 = getters.length;
+
+            int i;
+            PropertyDescriptor setter;
+            for(i = 0; i < var10; ++i) {
+                setter = var9[i];
+                names.put(setter.getName(), setter);
+            }
+
+            Local targetLocal = e.make_local();
+            Local sourceLocal = e.make_local();
+            e.load_arg(1);
+            e.checkcast(targetType);
+            e.store_local(targetLocal);
+            e.load_arg(0);
+            e.checkcast(sourceType);
+            e.store_local(sourceLocal);
+
+            for(i = 0; i < setters.length; ++i) {
+                setter = setters[i];
+                PropertyDescriptor getter = (PropertyDescriptor)names.get(setter.getName());
+                if (getter != null) {
+                    MethodInfo read = ReflectUtils.getMethodInfo(getter.getReadMethod());
+                    MethodInfo write = ReflectUtils.getMethodInfo(setter.getWriteMethod());
+                    if (this.useConverter) {
+                        Type setterType = write.getSignature().getArgumentTypes()[0];
+                        e.load_local(targetLocal);
+                        e.load_arg(2);
+                        e.load_local(sourceLocal);
+                        e.invoke(read);
+                        e.box(read.getSignature().getReturnType());
+                        EmitUtils.load_class(e, setterType);
+                        e.push(write.getSignature().getName());
+                        e.invoke_interface(BaseBeanCopier.CONVERTER, BaseBeanCopier.CONVERT);
+                        e.unbox_or_zero(setterType);
+                        e.invoke(write);
+                    } else if (compatible(getter, setter)) {
+                        e.load_local(targetLocal);
+                        e.load_local(sourceLocal);
+                        e.invoke(read);
+                        e.invoke(write);
+                    }
+                }
+            }
+
+            e.return_value();
+            e.end_method();
+            ce.end_class();
+        }
+
+        private static boolean compatible(PropertyDescriptor getter, PropertyDescriptor setter) {
+            return setter.getPropertyType().isAssignableFrom(getter.getPropertyType());
+        }
+
+        protected Object firstInstance(Class type) {
+            return ReflectUtils.newInstance(type);
+        }
+
+        protected Object nextInstance(Object instance) {
+            return instance;
+        }
+    }
+
+    interface BeanCopierKey {
+        Object newInstance(String source, String target, boolean useConverter);
+    }
+}

+ 24 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/BeanProperty.java

@@ -0,0 +1,24 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+public class BeanProperty {
+    private final String name;
+    private final Class<?> type;
+
+    public String getName() {
+        return this.name;
+    }
+
+    public Class<?> getType() {
+        return this.type;
+    }
+
+    public BeanProperty(final String name, final Class<?> type) {
+        this.name = name;
+        this.type = type;
+    }
+}

+ 137 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/BeanUtil.java

@@ -0,0 +1,137 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+
+import java.beans.PropertyDescriptor;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.zhongzheng.common.utils.BaseBeanCopier;
+import org.zhongzheng.common.utils.BeanProperty;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.BeansException;
+import org.springframework.cglib.beans.BeanGenerator;
+import org.springframework.cglib.beans.BeanMap;
+import org.springframework.cglib.core.CodeGenerationException;
+import org.springframework.cglib.core.Converter;
+import org.springframework.util.Assert;
+
+public class BeanUtil extends BeanUtils {
+    public BeanUtil() {
+    }
+
+    public static <T> T newInstance(Class<?> clazz) {
+        return (T)instantiateClass(clazz);
+    }
+
+    public static <T> T newInstance(String clazzStr) {
+        try {
+            Class<?> clazz = Class.forName(clazzStr);
+            return newInstance(clazz);
+        } catch (ClassNotFoundException var2) {
+            throw new RuntimeException(var2);
+        }
+    }
+
+    public static Object getProperty(Object bean, String propertyName) {
+        Assert.notNull(bean, "bean Could not null");
+        return BeanMap.create(bean).get(propertyName);
+    }
+
+    public static void setProperty(Object bean, String propertyName, Object value) {
+        Assert.notNull(bean, "bean Could not null");
+        BeanMap.create(bean).put(propertyName, value);
+    }
+
+    public static <T> T clone(T source) {
+        return (T)copy(source, source.getClass());
+    }
+
+    public static <T> T copy(Object source, Class<T> clazz) {
+        BaseBeanCopier copier = BaseBeanCopier.create(source.getClass(), clazz, false);
+        T to = newInstance(clazz);
+        copier.copy(source, to, (Converter)null);
+        return to;
+    }
+
+    public static void copy(Object source, Object targetBean) {
+        BaseBeanCopier copier = BaseBeanCopier.create(source.getClass(), targetBean.getClass(), false);
+        copier.copy(source, targetBean, (Converter)null);
+    }
+
+    public static <T> T copyProperties(Object source, Class<T> target) throws BeansException {
+        T to = newInstance(target);
+        copyProperties(source, to);
+        return to;
+    }
+
+    public static Map<String, Object> toMap(Object bean) {
+        return BeanMap.create(bean);
+    }
+
+    public static <T> T toBean(Map<String, Object> beanMap, Class<T> valueType) {
+        T bean = newInstance(valueType);
+        BeanMap.create(bean).putAll(beanMap);
+        return bean;
+    }
+
+    public static Object generator(Object superBean, BeanProperty... props) {
+        Class<?> superclass = superBean.getClass();
+        Object genBean = generator(superclass, props);
+        copy(superBean, genBean);
+        return genBean;
+    }
+
+    public static Object generator(Class<?> superclass, BeanProperty... props) {
+        BeanGenerator generator = new BeanGenerator();
+        generator.setSuperclass(superclass);
+        generator.setUseCache(true);
+        BeanProperty[] var3 = props;
+        int var4 = props.length;
+
+        for(int var5 = 0; var5 < var4; ++var5) {
+            BeanProperty prop = var3[var5];
+            generator.addProperty(prop.getName(), prop.getType());
+        }
+
+        return generator.create();
+    }
+
+    public static PropertyDescriptor[] getBeanGetters(Class type) {
+        return getPropertiesHelper(type, true, false);
+    }
+
+    public static PropertyDescriptor[] getBeanSetters(Class type) {
+        return getPropertiesHelper(type, false, true);
+    }
+
+    private static PropertyDescriptor[] getPropertiesHelper(Class type, boolean read, boolean write) {
+        try {
+            PropertyDescriptor[] all = getPropertyDescriptors(type);
+            if (read && write) {
+                return all;
+            } else {
+                List<PropertyDescriptor> properties = new ArrayList(all.length);
+                PropertyDescriptor[] var5 = all;
+                int var6 = all.length;
+
+                for(int var7 = 0; var7 < var6; ++var7) {
+                    PropertyDescriptor pd = var5[var7];
+                    if (read && pd.getReadMethod() != null) {
+                        properties.add(pd);
+                    } else if (write && pd.getWriteMethod() != null) {
+                        properties.add(pd);
+                    }
+                }
+
+                return (PropertyDescriptor[])properties.toArray(new PropertyDescriptor[0]);
+            }
+        } catch (BeansException var9) {
+            throw new CodeGenerationException(var9);
+        }
+    }
+}

+ 36 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/Charsets.java

@@ -0,0 +1,36 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.nio.charset.UnsupportedCharsetException;
+
+public class Charsets {
+    public static final Charset ISO_8859_1;
+    public static final String ISO_8859_1_NAME;
+    public static final Charset GBK;
+    public static final String GBK_NAME;
+    public static final Charset UTF_8;
+    public static final String UTF_8_NAME;
+
+    public Charsets() {
+    }
+
+    public static Charset charset(String charsetName) throws UnsupportedCharsetException {
+        return StringUtil.isBlank(charsetName) ? Charset.defaultCharset() : Charset.forName(charsetName);
+    }
+
+    static {
+        ISO_8859_1 = StandardCharsets.ISO_8859_1;
+        ISO_8859_1_NAME = ISO_8859_1.name();
+        GBK = Charset.forName("GBK");
+        GBK_NAME = GBK.name();
+        UTF_8 = StandardCharsets.UTF_8;
+        UTF_8_NAME = UTF_8.name();
+    }
+}

+ 65 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/ClassUtil.java

@@ -0,0 +1,65 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import org.springframework.core.BridgeMethodResolver;
+import org.springframework.core.DefaultParameterNameDiscoverer;
+import org.springframework.core.MethodParameter;
+import org.springframework.core.ParameterNameDiscoverer;
+import org.springframework.core.annotation.AnnotatedElementUtils;
+import org.springframework.core.annotation.SynthesizingMethodParameter;
+import org.springframework.util.ClassUtils;
+import org.springframework.web.method.HandlerMethod;
+
+public class ClassUtil extends ClassUtils {
+    private static final ParameterNameDiscoverer PARAMETER_NAME_DISCOVERER = new DefaultParameterNameDiscoverer();
+
+    public ClassUtil() {
+    }
+
+    public static MethodParameter getMethodParameter(Constructor<?> constructor, int parameterIndex) {
+        MethodParameter methodParameter = new SynthesizingMethodParameter(constructor, parameterIndex);
+        methodParameter.initParameterNameDiscovery(PARAMETER_NAME_DISCOVERER);
+        return methodParameter;
+    }
+
+    public static MethodParameter getMethodParameter(Method method, int parameterIndex) {
+        MethodParameter methodParameter = new SynthesizingMethodParameter(method, parameterIndex);
+        methodParameter.initParameterNameDiscovery(PARAMETER_NAME_DISCOVERER);
+        return methodParameter;
+    }
+
+    public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationType) {
+        Class<?> targetClass = method.getDeclaringClass();
+        Method specificMethod = getMostSpecificMethod(method, targetClass);
+        specificMethod = BridgeMethodResolver.findBridgedMethod(specificMethod);
+        A annotation = AnnotatedElementUtils.findMergedAnnotation(specificMethod, annotationType);
+        return null != annotation ? annotation : AnnotatedElementUtils.findMergedAnnotation(specificMethod.getDeclaringClass(), annotationType);
+    }
+
+    public static <A extends Annotation> A getAnnotation(HandlerMethod handlerMethod, Class<A> annotationType) {
+        A annotation = handlerMethod.getMethodAnnotation(annotationType);
+        if (null != annotation) {
+            return annotation;
+        } else {
+            Class<?> beanType = handlerMethod.getBeanType();
+            return AnnotatedElementUtils.findMergedAnnotation(beanType, annotationType);
+        }
+    }
+
+    public static <A extends Annotation> boolean isAnnotated(Method method, Class<A> annotationType) {
+        boolean isMethodAnnotated = AnnotatedElementUtils.isAnnotated(method, annotationType);
+        if (isMethodAnnotated) {
+            return true;
+        } else {
+            Class<?> targetClass = method.getDeclaringClass();
+            return AnnotatedElementUtils.isAnnotated(targetClass, annotationType);
+        }
+    }
+}

+ 37 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/CollectionUtil.java

@@ -0,0 +1,37 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import org.springframework.lang.Nullable;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.ObjectUtils;
+
+public class CollectionUtil extends CollectionUtils {
+    public CollectionUtil() {
+    }
+
+    public static <T> boolean contains(@Nullable T[] array, final T element) {
+        return array == null ? false : Arrays.stream(array).anyMatch((x) -> {
+            return ObjectUtils.nullSafeEquals(x, element);
+        });
+    }
+
+    public static boolean isArray(Object obj) {
+        return null == obj ? false : obj.getClass().isArray();
+    }
+
+    public static boolean isNotEmpty(@Nullable Collection<?> coll) {
+        return !CollectionUtils.isEmpty(coll);
+    }
+
+    public static boolean isNotEmpty(@Nullable Map<?, ?> map) {
+        return !CollectionUtils.isEmpty(map);
+    }
+}

+ 69 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/ConcurrentDateFormat.java

@@ -0,0 +1,69 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import java.util.Queue;
+import java.util.TimeZone;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+public class ConcurrentDateFormat {
+    private final String format;
+    private final Locale locale;
+    private final TimeZone timezone;
+    private final Queue<SimpleDateFormat> queue = new ConcurrentLinkedQueue();
+
+    private ConcurrentDateFormat(String format, Locale locale, TimeZone timezone) {
+        this.format = format;
+        this.locale = locale;
+        this.timezone = timezone;
+        SimpleDateFormat initial = this.createInstance();
+        this.queue.add(initial);
+    }
+
+    public static ConcurrentDateFormat of(String format) {
+        return new ConcurrentDateFormat(format, Locale.getDefault(), TimeZone.getDefault());
+    }
+
+    public static ConcurrentDateFormat of(String format, TimeZone timezone) {
+        return new ConcurrentDateFormat(format, Locale.getDefault(), timezone);
+    }
+
+    public static ConcurrentDateFormat of(String format, Locale locale, TimeZone timezone) {
+        return new ConcurrentDateFormat(format, locale, timezone);
+    }
+
+    public String format(Date date) {
+        SimpleDateFormat sdf = (SimpleDateFormat)this.queue.poll();
+        if (sdf == null) {
+            sdf = this.createInstance();
+        }
+
+        String result = sdf.format(date);
+        this.queue.add(sdf);
+        return result;
+    }
+
+    public Date parse(String source) throws ParseException {
+        SimpleDateFormat sdf = (SimpleDateFormat)this.queue.poll();
+        if (sdf == null) {
+            sdf = this.createInstance();
+        }
+
+        Date result = sdf.parse(source);
+        this.queue.add(sdf);
+        return result;
+    }
+
+    private SimpleDateFormat createInstance() {
+        SimpleDateFormat sdf = new SimpleDateFormat(this.format, this.locale);
+        sdf.setTimeZone(this.timezone);
+        return sdf;
+    }
+}

+ 267 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/DateUtil.java

@@ -0,0 +1,267 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+import java.text.ParseException;
+import java.time.Duration;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.Period;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.Temporal;
+import java.time.temporal.TemporalAccessor;
+import java.time.temporal.TemporalAmount;
+import java.time.temporal.TemporalQuery;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+import org.springframework.util.Assert;
+
+public final class DateUtil {
+    public static final String PATTERN_DATETIME = "yyyy-MM-dd HH:mm:ss";
+    public static final String PATTERN_DATE = "yyyy-MM-dd";
+    public static final String PATTERN_TIME = "HH:mm:ss";
+    public static final ConcurrentDateFormat DATETIME_FORMAT = ConcurrentDateFormat.of("yyyy-MM-dd HH:mm:ss");
+    public static final ConcurrentDateFormat DATE_FORMAT = ConcurrentDateFormat.of("yyyy-MM-dd");
+    public static final ConcurrentDateFormat TIME_FORMAT = ConcurrentDateFormat.of("HH:mm:ss");
+    public static final DateTimeFormatter DATETIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+    public static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+    public static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("HH:mm:ss");
+
+    public static Date now() {
+        return new Date();
+    }
+
+    public static Date plusYears(Date date, int yearsToAdd) {
+        return set(date, 1, yearsToAdd);
+    }
+
+    public static Date plusMonths(Date date, int monthsToAdd) {
+        return set(date, 2, monthsToAdd);
+    }
+
+    public static Date plusWeeks(Date date, int weeksToAdd) {
+        return plus(date, Period.ofWeeks(weeksToAdd));
+    }
+
+    public static Date plusDays(Date date, long daysToAdd) {
+        return plus(date, Duration.ofDays(daysToAdd));
+    }
+
+    public static Date plusHours(Date date, long hoursToAdd) {
+        return plus(date, Duration.ofHours(hoursToAdd));
+    }
+
+    public static Date plusMinutes(Date date, long minutesToAdd) {
+        return plus(date, Duration.ofMinutes(minutesToAdd));
+    }
+
+    public static Date plusSeconds(Date date, long secondsToAdd) {
+        return plus(date, Duration.ofSeconds(secondsToAdd));
+    }
+
+    public static Date plusMillis(Date date, long millisToAdd) {
+        return plus(date, Duration.ofMillis(millisToAdd));
+    }
+
+    public static Date plusNanos(Date date, long nanosToAdd) {
+        return plus(date, Duration.ofNanos(nanosToAdd));
+    }
+
+    public static Date plus(Date date, TemporalAmount amount) {
+        Instant instant = date.toInstant();
+        return Date.from(instant.plus(amount));
+    }
+
+    public static Date minusYears(Date date, int years) {
+        return set(date, 1, -years);
+    }
+
+    public static Date minusMonths(Date date, int months) {
+        return set(date, 2, -months);
+    }
+
+    public static Date minusWeeks(Date date, int weeks) {
+        return minus(date, Period.ofWeeks(weeks));
+    }
+
+    public static Date minusDays(Date date, long days) {
+        return minus(date, Duration.ofDays(days));
+    }
+
+    public static Date minusHours(Date date, long hours) {
+        return minus(date, Duration.ofHours(hours));
+    }
+
+    public static Date minusMinutes(Date date, long minutes) {
+        return minus(date, Duration.ofMinutes(minutes));
+    }
+
+    public static Date minusSeconds(Date date, long seconds) {
+        return minus(date, Duration.ofSeconds(seconds));
+    }
+
+    public static Date minusMillis(Date date, long millis) {
+        return minus(date, Duration.ofMillis(millis));
+    }
+
+    public static Date minusNanos(Date date, long nanos) {
+        return minus(date, Duration.ofNanos(nanos));
+    }
+
+    public static Date minus(Date date, TemporalAmount amount) {
+        Instant instant = date.toInstant();
+        return Date.from(instant.minus(amount));
+    }
+
+    private static Date set(Date date, int calendarField, int amount) {
+        Assert.notNull(date, "The date must not be null");
+        Calendar c = Calendar.getInstance();
+        c.setLenient(false);
+        c.setTime(date);
+        c.add(calendarField, amount);
+        return c.getTime();
+    }
+
+    public static String formatDateTime(Date date) {
+        return DATETIME_FORMAT.format(date);
+    }
+
+    public static String formatDate(Date date) {
+        return DATE_FORMAT.format(date);
+    }
+
+    public static String formatTime(Date date) {
+        return TIME_FORMAT.format(date);
+    }
+
+    public static String format(Date date, String pattern) {
+        return ConcurrentDateFormat.of(pattern).format(date);
+    }
+
+    public static String formatDateTime(TemporalAccessor temporal) {
+        return DATETIME_FORMATTER.format(temporal);
+    }
+
+    public static String formatDate(TemporalAccessor temporal) {
+        return DATE_FORMATTER.format(temporal);
+    }
+
+    public static String formatTime(TemporalAccessor temporal) {
+        return TIME_FORMATTER.format(temporal);
+    }
+
+    public static String format(TemporalAccessor temporal, String pattern) {
+        return DateTimeFormatter.ofPattern(pattern).format(temporal);
+    }
+
+    public static Date parse(String dateStr, String pattern) {
+        ConcurrentDateFormat format = ConcurrentDateFormat.of(pattern);
+
+        try {
+            return format.parse(dateStr);
+        } catch (ParseException var4) {
+            throw Exceptions.unchecked(var4);
+        }
+    }
+
+    public static Date parse(String dateStr, ConcurrentDateFormat format) {
+        try {
+            return format.parse(dateStr);
+        } catch (ParseException var3) {
+            throw Exceptions.unchecked(var3);
+        }
+    }
+
+    public static <T> T parse(String dateStr, String pattern, TemporalQuery<T> query) {
+        return DateTimeFormatter.ofPattern(pattern).parse(dateStr, query);
+    }
+
+    public static Instant toInstant(LocalDateTime dateTime) {
+        return dateTime.atZone(ZoneId.systemDefault()).toInstant();
+    }
+
+    public static LocalDateTime toDateTime(Instant instant) {
+        return LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
+    }
+
+    public static Date toDate(LocalDateTime dateTime) {
+        return Date.from(toInstant(dateTime));
+    }
+
+    public static Date toDate(final LocalDate localDate) {
+        return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
+    }
+
+    public static Calendar toCalendar(final LocalDateTime localDateTime) {
+        return GregorianCalendar.from(ZonedDateTime.of(localDateTime, ZoneId.systemDefault()));
+    }
+
+    public static long toMilliseconds(final LocalDateTime localDateTime) {
+        return localDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
+    }
+
+    public static long toMilliseconds(LocalDate localDate) {
+        return toMilliseconds(localDate.atStartOfDay());
+    }
+
+    public static LocalDateTime fromCalendar(final Calendar calendar) {
+        TimeZone tz = calendar.getTimeZone();
+        ZoneId zid = tz == null ? ZoneId.systemDefault() : tz.toZoneId();
+        return LocalDateTime.ofInstant(calendar.toInstant(), zid);
+    }
+
+    public static LocalDateTime fromInstant(final Instant instant) {
+        return LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
+    }
+
+    public static LocalDateTime fromDate(final Date date) {
+        return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
+    }
+
+    public static LocalDateTime fromMilliseconds(final long milliseconds) {
+        return LocalDateTime.ofInstant(Instant.ofEpochMilli(milliseconds), ZoneId.systemDefault());
+    }
+
+    public static Duration between(Temporal startInclusive, Temporal endExclusive) {
+        return Duration.between(startInclusive, endExclusive);
+    }
+
+    public static Period between(LocalDate startDate, LocalDate endDate) {
+        return Period.between(startDate, endDate);
+    }
+
+    public static Duration between(Date startDate, Date endDate) {
+        return Duration.between(startDate.toInstant(), endDate.toInstant());
+    }
+
+    public static String secondToTime(Long second) {
+        if (second != null && second != 0L) {
+            long days = second / 86400L;
+            second = second % 86400L;
+            long hours = second / 3600L;
+            second = second % 3600L;
+            long minutes = second / 60L;
+            second = second % 60L;
+            return days > 0L ? StringUtil.format("{}天{}小时{}分{}秒", new Object[]{days, hours, minutes, second}) : StringUtil.format("{}小时{}分{}秒", new Object[]{hours, minutes, second});
+        } else {
+            return "";
+        }
+    }
+
+    public static String today() {
+        return format(new Date(), "yyyyMMdd");
+    }
+
+    private DateUtil() {
+        throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
+    }
+}
+

+ 89 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/DigestUtil.java

@@ -0,0 +1,89 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import org.springframework.lang.Nullable;
+import org.springframework.util.DigestUtils;
+
+public class DigestUtil extends DigestUtils {
+    private static final char[] HEX_DIGITS = "0123456789abcdef".toCharArray();
+
+    public DigestUtil() {
+    }
+
+    public static String md5Hex(final String data) {
+        return md5DigestAsHex(data.getBytes(Charsets.UTF_8));
+    }
+
+    public static String md5Hex(final byte[] bytes) {
+        return md5DigestAsHex(bytes);
+    }
+
+    public static String sha1(String srcStr) {
+        return hash("SHA-1", srcStr);
+    }
+
+    public static String sha256(String srcStr) {
+        return hash("SHA-256", srcStr);
+    }
+
+    public static String sha384(String srcStr) {
+        return hash("SHA-384", srcStr);
+    }
+
+    public static String sha512(String srcStr) {
+        return hash("SHA-512", srcStr);
+    }
+
+    public static String hash(String algorithm, String srcStr) {
+        try {
+            MessageDigest md = MessageDigest.getInstance(algorithm);
+            byte[] bytes = md.digest(srcStr.getBytes(Charsets.UTF_8));
+            return toHex(bytes);
+        } catch (NoSuchAlgorithmException var4) {
+            throw Exceptions.unchecked(var4);
+        }
+    }
+
+    public static String toHex(byte[] bytes) {
+        StringBuilder ret = new StringBuilder(bytes.length * 2);
+
+        for(int i = 0; i < bytes.length; ++i) {
+            ret.append(HEX_DIGITS[bytes[i] >> 4 & 15]);
+            ret.append(HEX_DIGITS[bytes[i] & 15]);
+        }
+
+        return ret.toString();
+    }
+
+    public static boolean slowEquals(@Nullable String a, @Nullable String b) {
+        return a != null && b != null ? slowEquals(a.getBytes(Charsets.UTF_8), b.getBytes(Charsets.UTF_8)) : false;
+    }
+
+    public static boolean slowEquals(@Nullable byte[] a, @Nullable byte[] b) {
+        if (a != null && b != null) {
+            if (a.length != b.length) {
+                return false;
+            } else {
+                int diff = a.length ^ b.length;
+
+                for(int i = 0; i < a.length && i < b.length; ++i) {
+                    diff |= a[i] ^ b[i];
+                }
+
+                return diff == 0;
+            }
+        } else {
+            return false;
+        }
+    }
+
+    public static String encrypt(String data) {
+        return sha1(md5Hex(data));
+    }
+}

+ 581 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/Func.java

@@ -0,0 +1,581 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
+import java.io.Closeable;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.nio.charset.Charset;
+import java.time.Duration;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.Temporal;
+import java.time.temporal.TemporalAccessor;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.function.Supplier;
+
+import org.springframework.util.ObjectUtils;
+import org.zhongzheng.common.utils.JsonUtil;
+import org.springframework.beans.BeansException;
+import org.springframework.core.MethodParameter;
+import org.springframework.core.annotation.AnnotatedElementUtils;
+import org.springframework.lang.Nullable;
+import org.springframework.util.StringUtils;
+import org.springframework.web.method.HandlerMethod;
+
+public class Func {
+    public Func() {
+    }
+
+    public static <T> T requireNotNull(T obj) {
+        return Objects.requireNonNull(obj);
+    }
+
+    public static <T> T requireNotNull(T obj, String message) {
+        return Objects.requireNonNull(obj, message);
+    }
+
+    public static <T> T requireNotNull(T obj, Supplier<String> messageSupplier) {
+        return Objects.requireNonNull(obj, messageSupplier);
+    }
+
+    public static boolean isNull(@Nullable Object obj) {
+        return Objects.isNull(obj);
+    }
+
+    public static boolean notNull(@Nullable Object obj) {
+        return Objects.nonNull(obj);
+    }
+
+    public static String firstCharToLower(String str) {
+        return StringUtil.lowerFirst(str);
+    }
+
+    public static String firstCharToUpper(String str) {
+        return StringUtil.upperFirst(str);
+    }
+
+    public static boolean isBlank(@Nullable final CharSequence cs) {
+        return StringUtil.isBlank(cs);
+    }
+
+    public static boolean isNotBlank(@Nullable final CharSequence cs) {
+        return StringUtil.isNotBlank(cs);
+    }
+
+    public static boolean isAnyBlank(final CharSequence... css) {
+        return StringUtil.isAnyBlank(css);
+    }
+
+    public static boolean isNoneBlank(final CharSequence... css) {
+        return StringUtil.isNoneBlank(css);
+    }
+
+    public static boolean isArray(@Nullable Object obj) {
+        return ObjectUtils.isArray(obj);
+    }
+
+    public static boolean isEmpty(@Nullable Object obj) {
+        return ObjectUtils.isEmpty(obj);
+    }
+
+    public static boolean isNotEmpty(@Nullable Object obj) {
+        return !ObjectUtils.isEmpty(obj);
+    }
+
+    public static boolean isEmpty(@Nullable Object[] array) {
+        return ObjectUtils.isEmpty(array);
+    }
+
+    public static boolean isNotEmpty(@Nullable Object[] array) {
+        return !ObjectUtils.isEmpty(array);
+    }
+
+    public static boolean hasEmpty(Object... os) {
+        Object[] var1 = os;
+        int var2 = os.length;
+
+        for(int var3 = 0; var3 < var2; ++var3) {
+            Object o = var1[var3];
+            if (isEmpty(o)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    public static boolean allEmpty(Object... os) {
+        Object[] var1 = os;
+        int var2 = os.length;
+
+        for(int var3 = 0; var3 < var2; ++var3) {
+            Object o = var1[var3];
+            if (!isEmpty(o)) {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    public static boolean equals(Object obj1, Object obj2) {
+        return Objects.equals(obj1, obj2);
+    }
+
+    public static boolean equalsSafe(@Nullable Object o1, @Nullable Object o2) {
+        return ObjectUtils.nullSafeEquals(o1, o2);
+    }
+
+    public static <T> boolean contains(@Nullable T[] array, final T element) {
+        return CollectionUtil.contains(array, element);
+    }
+
+    public static boolean contains(@Nullable Iterator<?> iterator, Object element) {
+        return CollectionUtil.contains(iterator, element);
+    }
+
+    public static boolean contains(@Nullable Enumeration<?> enumeration, Object element) {
+        return CollectionUtil.contains(enumeration, element);
+    }
+
+    public static String toStr(Object str) {
+        return toStr(str, "");
+    }
+
+    public static String toStr(Object str, String defaultValue) {
+        return null == str ? defaultValue : String.valueOf(str);
+    }
+
+    public static String toStrWithEmpty(Object str, String defaultValue) {
+        return null != str && !str.equals("null") && !str.equals("") ? String.valueOf(str) : defaultValue;
+    }
+
+    public static boolean isNumeric(final CharSequence cs) {
+        return StringUtil.isNumeric(cs);
+    }
+
+    public static int toInt(final Object value) {
+        return NumberUtil.toInt(String.valueOf(value));
+    }
+
+    public static int toInt(final Object value, final int defaultValue) {
+        return NumberUtil.toInt(String.valueOf(value), defaultValue);
+    }
+
+    public static long toLong(final Object value) {
+        return NumberUtil.toLong(String.valueOf(value));
+    }
+
+    public static long toLong(final Object value, final long defaultValue) {
+        return NumberUtil.toLong(String.valueOf(value), defaultValue);
+    }
+
+    public static Double toDouble(Object value) {
+        return toDouble(String.valueOf(value), -1.0);
+    }
+
+    public static Double toDouble(Object value, Double defaultValue) {
+        return NumberUtil.toDouble(String.valueOf(value), defaultValue);
+    }
+
+    public static Float toFloat(Object value) {
+        return toFloat(String.valueOf(value), -1.0F);
+    }
+
+    public static Float toFloat(Object value, Float defaultValue) {
+        return NumberUtil.toFloat(String.valueOf(value), defaultValue);
+    }
+
+    public static Boolean toBoolean(Object value) {
+        return toBoolean(value, (Boolean)null);
+    }
+
+    public static Boolean toBoolean(Object value, Boolean defaultValue) {
+        if (value != null) {
+            String val = String.valueOf(value);
+            val = val.toLowerCase().trim();
+            return Boolean.parseBoolean(val);
+        } else {
+            return defaultValue;
+        }
+    }
+
+    public static Integer[] toIntArray(String str) {
+        return toIntArray(",", str);
+    }
+
+    public static Integer[] toIntArray(String split, String str) {
+        if (StringUtil.isEmpty(str)) {
+            return new Integer[0];
+        } else {
+            String[] arr = str.split(split);
+            Integer[] ints = new Integer[arr.length];
+
+            for(int i = 0; i < arr.length; ++i) {
+                Integer v = toInt(arr[i], 0);
+                ints[i] = v;
+            }
+
+            return ints;
+        }
+    }
+
+    public static List<Integer> toIntList(String str) {
+        return Arrays.asList(toIntArray(str));
+    }
+
+    public static List<Integer> toIntList(String split, String str) {
+        return Arrays.asList(toIntArray(split, str));
+    }
+
+    public static Long[] toLongArray(String str) {
+        return toLongArray(",", str);
+    }
+
+    public static Long[] toLongArray(String split, String str) {
+        if (StringUtil.isEmpty(str)) {
+            return new Long[0];
+        } else {
+            String[] arr = str.split(split);
+            Long[] longs = new Long[arr.length];
+
+            for(int i = 0; i < arr.length; ++i) {
+                Long v = toLong(arr[i], 0L);
+                longs[i] = v;
+            }
+
+            return longs;
+        }
+    }
+
+    public static List<Long> toLongList(String str) {
+        return Arrays.asList(toLongArray(str));
+    }
+
+    public static List<Long> toLongList(String split, String str) {
+        return Arrays.asList(toLongArray(split, str));
+    }
+
+    public static String[] toStrArray(String str) {
+        return toStrArray(",", str);
+    }
+
+    public static String[] toStrArray(String split, String str) {
+        return isBlank(str) ? new String[0] : str.split(split);
+    }
+
+    public static List<String> toStrList(String str) {
+        return Arrays.asList(toStrArray(str));
+    }
+
+    public static List<String> toStrList(String split, String str) {
+        return Arrays.asList(toStrArray(split, str));
+    }
+
+    public static String to62String(long num) {
+        return NumberUtil.to62String(num);
+    }
+
+    public static String join(Collection<?> coll) {
+        return StringUtil.join(coll);
+    }
+
+    public static String join(Collection<?> coll, String delim) {
+        return StringUtil.join(coll, delim);
+    }
+
+    public static String join(Object[] arr) {
+        return StringUtil.join(arr);
+    }
+
+    public static String join(Object[] arr, String delim) {
+        return StringUtil.join(arr, delim);
+    }
+
+    public static String randomUUID() {
+        return StringUtil.randomUUID();
+    }
+
+    public static String escapeHtml(String html) {
+        return StringUtil.escapeHtml(html);
+    }
+
+    public static String random(int count) {
+        return StringUtil.random(count);
+    }
+
+    public static String random(int count, RandomType randomType) {
+        return StringUtil.random(count, randomType);
+    }
+
+    public static String md5Hex(final String data) {
+        return DigestUtil.md5Hex(data);
+    }
+
+    public static String md5Hex(final byte[] bytes) {
+        return DigestUtil.md5Hex(bytes);
+    }
+
+    public static String sha1(String srcStr) {
+        return DigestUtil.sha1(srcStr);
+    }
+
+    public static String sha256(String srcStr) {
+        return DigestUtil.sha256(srcStr);
+    }
+
+    public static String sha384(String srcStr) {
+        return DigestUtil.sha384(srcStr);
+    }
+
+    public static String sha512(String srcStr) {
+        return DigestUtil.sha512(srcStr);
+    }
+
+    public static String encrypt(String data) {
+        return DigestUtil.encrypt(data);
+    }
+
+    public static String encodeBase64(String value) {
+        return Base64Util.encode(value);
+    }
+
+    public static String encodeBase64(String value, Charset charset) {
+        return Base64Util.encode(value, charset);
+    }
+
+    public static String encodeBase64UrlSafe(String value) {
+        return Base64Util.encodeUrlSafe(value);
+    }
+
+    public static String encodeBase64UrlSafe(String value, Charset charset) {
+        return Base64Util.encodeUrlSafe(value, charset);
+    }
+
+    public static String decodeBase64(String value) {
+        return Base64Util.decode(value);
+    }
+
+    public static String decodeBase64(String value, Charset charset) {
+        return Base64Util.decode(value, charset);
+    }
+
+    public static String decodeBase64UrlSafe(String value) {
+        return Base64Util.decodeUrlSafe(value);
+    }
+
+    public static String decodeBase64UrlSafe(String value, Charset charset) {
+        return Base64Util.decodeUrlSafe(value, charset);
+    }
+
+    public static void closeQuietly(@Nullable Closeable closeable) {
+        IoUtil.closeQuietly(closeable);
+    }
+
+    public static String toString(InputStream input) {
+        return IoUtil.toString(input);
+    }
+
+    public static String toString(@Nullable InputStream input, Charset charset) {
+        return IoUtil.toString(input, charset);
+    }
+
+    public static byte[] toByteArray(@Nullable InputStream input) {
+        return IoUtil.toByteArray(input);
+    }
+
+    public static String toJson(Object object) {
+        return JsonUtil.toJson(object);
+    }
+
+    public static byte[] toJsonAsBytes(Object object) {
+        return JsonUtil.toJsonAsBytes(object);
+    }
+
+    public static JsonNode readTree(String jsonString) {
+        return JsonUtil.readTree(jsonString);
+    }
+
+    public static JsonNode readTree(InputStream in) {
+        return JsonUtil.readTree(in);
+    }
+
+    public static JsonNode readTree(byte[] content) {
+        return JsonUtil.readTree(content);
+    }
+
+    public static JsonNode readTree(JsonParser jsonParser) {
+        return JsonUtil.readTree(jsonParser);
+    }
+
+    public static <T> T parse(byte[] bytes, Class<T> valueType) {
+        return JsonUtil.parse(bytes, valueType);
+    }
+
+    public static <T> T parse(String jsonString, Class<T> valueType) {
+        return JsonUtil.parse(jsonString, valueType);
+    }
+
+    public static <T> T parse(InputStream in, Class<T> valueType) {
+        return JsonUtil.parse(in, valueType);
+    }
+
+    public static <T> T parse(byte[] bytes, TypeReference<T> typeReference) {
+        return JsonUtil.parse(bytes, typeReference);
+    }
+
+    public static <T> T parse(String jsonString, TypeReference<T> typeReference) {
+        return JsonUtil.parse(jsonString, typeReference);
+    }
+
+    public static <T> T parse(InputStream in, TypeReference<T> typeReference) {
+        return JsonUtil.parse(in, typeReference);
+    }
+
+    public static String encode(String source) {
+        return UrlUtil.encode(source, Charsets.UTF_8);
+    }
+
+    public static String encode(String source, Charset charset) {
+        return UrlUtil.encode(source, charset);
+    }
+
+    public static String decode(String source) {
+        return StringUtils.uriDecode(source, Charsets.UTF_8);
+    }
+
+    public static String decode(String source, Charset charset) {
+        return StringUtils.uriDecode(source, charset);
+    }
+
+    public static String formatDateTime(Date date) {
+        return DateUtil.formatDateTime(date);
+    }
+
+    public static String formatDate(Date date) {
+        return DateUtil.formatDate(date);
+    }
+
+    public static String formatTime(Date date) {
+        return DateUtil.formatTime(date);
+    }
+
+    public static String format(Date date, String pattern) {
+        return DateUtil.format(date, pattern);
+    }
+
+    public static Date parseDate(String dateStr, String pattern) {
+        return DateUtil.parse(dateStr, pattern);
+    }
+
+    public static Date parse(String dateStr, ConcurrentDateFormat format) {
+        return DateUtil.parse(dateStr, format);
+    }
+
+    public static String formatDateTime(TemporalAccessor temporal) {
+        return DateTimeUtil.formatDateTime(temporal);
+    }
+
+    public static String formatDate(TemporalAccessor temporal) {
+        return DateTimeUtil.formatDate(temporal);
+    }
+
+    public static String formatTime(TemporalAccessor temporal) {
+        return DateTimeUtil.formatTime(temporal);
+    }
+
+    public static String format(TemporalAccessor temporal, String pattern) {
+        return DateTimeUtil.format(temporal, pattern);
+    }
+
+    public static TemporalAccessor parse(String dateStr, String pattern) {
+        return DateTimeUtil.parse(dateStr, pattern);
+    }
+
+    public static TemporalAccessor parse(String dateStr, DateTimeFormatter formatter) {
+        return DateTimeUtil.parse(dateStr, formatter);
+    }
+
+    public static Duration between(Temporal startInclusive, Temporal endExclusive) {
+        return Duration.between(startInclusive, endExclusive);
+    }
+
+    public static MethodParameter getMethodParameter(Constructor<?> constructor, int parameterIndex) {
+        return ClassUtil.getMethodParameter(constructor, parameterIndex);
+    }
+
+    public static MethodParameter getMethodParameter(Method method, int parameterIndex) {
+        return ClassUtil.getMethodParameter(method, parameterIndex);
+    }
+
+    @Nullable
+    public static <A extends Annotation> A getAnnotation(AnnotatedElement annotatedElement, Class<A> annotationType) {
+        return AnnotatedElementUtils.findMergedAnnotation(annotatedElement, annotationType);
+    }
+
+    @Nullable
+    public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationType) {
+        return ClassUtil.getAnnotation(method, annotationType);
+    }
+
+    @Nullable
+    public static <A extends Annotation> A getAnnotation(HandlerMethod handlerMethod, Class<A> annotationType) {
+        return ClassUtil.getAnnotation(handlerMethod, annotationType);
+    }
+
+    public static <T> T newInstance(Class<?> clazz) {
+        return (T)BeanUtil.instantiateClass(clazz);
+    }
+
+    public static <T> T newInstance(String clazzStr) {
+        return BeanUtil.newInstance(clazzStr);
+    }
+
+    public static Object getProperty(Object bean, String propertyName) {
+        return BeanUtil.getProperty(bean, propertyName);
+    }
+
+    public static void setProperty(Object bean, String propertyName, Object value) {
+        BeanUtil.setProperty(bean, propertyName, value);
+    }
+
+    public static <T> T clone(T source) {
+        return BeanUtil.clone(source);
+    }
+
+    public static <T> T copy(Object source, Class<T> clazz) {
+        return BeanUtil.copy(source, clazz);
+    }
+
+    public static void copy(Object source, Object targetBean) {
+        BeanUtil.copy(source, targetBean);
+    }
+
+    public static <T> T copyProperties(Object source, Class<T> clazz) throws BeansException {
+        return BeanUtil.copyProperties(source, clazz);
+    }
+
+    public static Map<String, Object> toMap(Object bean) {
+        return BeanUtil.toMap(bean);
+    }
+
+    public static <T> T toBean(Map<String, Object> beanMap, Class<T> valueType) {
+        return BeanUtil.toBean(beanMap, valueType);
+    }
+}

+ 99 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/HexUtil.java

@@ -0,0 +1,99 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+
+import java.nio.charset.Charset;
+import org.springframework.lang.Nullable;
+
+public class HexUtil {
+    public static final Charset DEFAULT_CHARSET;
+    private static final byte[] DIGITS_LOWER;
+    private static final byte[] DIGITS_UPPER;
+
+    public HexUtil() {
+    }
+
+    public static byte[] encode(byte[] data) {
+        return encode(data, true);
+    }
+
+    public static byte[] encode(byte[] data, boolean toLowerCase) {
+        return encode(data, toLowerCase ? DIGITS_LOWER : DIGITS_UPPER);
+    }
+
+    private static byte[] encode(byte[] data, byte[] digits) {
+        int len = data.length;
+        byte[] out = new byte[len << 1];
+        int i = 0;
+
+        for(int j = 0; i < len; ++i) {
+            out[j++] = digits[(240 & data[i]) >>> 4];
+            out[j++] = digits[15 & data[i]];
+        }
+
+        return out;
+    }
+
+    public static String encodeToString(byte[] data, boolean toLowerCase) {
+        return new String(encode(data, toLowerCase), DEFAULT_CHARSET);
+    }
+
+    public static String encodeToString(byte[] data) {
+        return new String(encode(data), DEFAULT_CHARSET);
+    }
+
+    @Nullable
+    public static String encodeToString(@Nullable String data) {
+        return StringUtil.isBlank(data) ? null : encodeToString(data.getBytes(DEFAULT_CHARSET));
+    }
+
+    @Nullable
+    public static byte[] decode(@Nullable String data) {
+        return StringUtil.isBlank(data) ? null : decode(data.getBytes(DEFAULT_CHARSET));
+    }
+
+    @Nullable
+    public static String decodeToString(@Nullable String data) {
+        byte[] decodeBytes = decode(data);
+        return decodeBytes == null ? null : new String(decodeBytes, DEFAULT_CHARSET);
+    }
+
+    public static byte[] decode(byte[] data) {
+        int len = data.length;
+        if ((len & 1) != 0) {
+            throw new IllegalArgumentException("hexBinary needs to be even-length: " + len);
+        } else {
+            byte[] out = new byte[len >> 1];
+            int i = 0;
+
+            for(int j = 0; j < len; ++i) {
+                int f = toDigit(data[j], j) << 4;
+                ++j;
+                f |= toDigit(data[j], j);
+                ++j;
+                out[i] = (byte)(f & 255);
+            }
+
+            return out;
+        }
+    }
+
+    private static int toDigit(byte b, int index) {
+        int digit = Character.digit(b, 16);
+        if (digit == -1) {
+            throw new IllegalArgumentException("Illegal hexadecimal byte " + b + " at index " + index);
+        } else {
+            return digit;
+        }
+    }
+
+    static {
+        DEFAULT_CHARSET = Charsets.UTF_8;
+        DIGITS_LOWER = new byte[]{48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102};
+        DIGITS_UPPER = new byte[]{48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70};
+    }
+}

+ 66 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/IoUtil.java

@@ -0,0 +1,66 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.charset.Charset;
+import org.springframework.lang.Nullable;
+import org.springframework.util.StreamUtils;
+
+public class IoUtil extends StreamUtils {
+    public IoUtil() {
+    }
+
+    public static void closeQuietly(@Nullable Closeable closeable) {
+        try {
+            if (closeable != null) {
+                closeable.close();
+            }
+        } catch (IOException var2) {
+        }
+
+    }
+
+    public static String toString(InputStream input) {
+        return toString(input, Charsets.UTF_8);
+    }
+
+    public static String toString(@Nullable InputStream input, Charset charset) {
+        String var2;
+        try {
+            var2 = copyToString(input, charset);
+        } catch (IOException var6) {
+            throw Exceptions.unchecked(var6);
+        } finally {
+            closeQuietly(input);
+        }
+
+        return var2;
+    }
+
+    public static byte[] toByteArray(@Nullable InputStream input) {
+        byte[] var1;
+        try {
+            var1 = copyToByteArray(input);
+        } catch (IOException var5) {
+            throw Exceptions.unchecked(var5);
+        } finally {
+            closeQuietly(input);
+        }
+
+        return var1;
+    }
+
+    public static void write(@Nullable final String data, final OutputStream output, final Charset encoding) throws IOException {
+        if (data != null) {
+            output.write(data.getBytes(encoding));
+        }
+
+    }
+}

+ 312 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/JsonUtil.java

@@ -0,0 +1,312 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonParser.Feature;
+import com.fasterxml.jackson.core.json.JsonReadFeature;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.time.ZoneId;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.TimeZone;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.ObjectUtils;
+import org.zhongzheng.common.utils.Exceptions;
+import org.zhongzheng.common.utils.StringUtil;
+import org.springframework.lang.Nullable;
+
+public class JsonUtil {
+    private static final Logger log = LoggerFactory.getLogger(JsonUtil.class);
+
+    public JsonUtil() {
+    }
+
+    public static <T> String toJson(T value) {
+        try {
+            return getInstance().writeValueAsString(value);
+        } catch (Exception var2) {
+            log.error(var2.getMessage(), var2);
+            return null;
+        }
+    }
+
+    public static byte[] toJsonAsBytes(Object object) {
+        try {
+            return getInstance().writeValueAsBytes(object);
+        } catch (JsonProcessingException var2) {
+            throw Exceptions.unchecked(var2);
+        }
+    }
+
+    public static <T> T parse(String content, Class<T> valueType) {
+        try {
+            return getInstance().readValue(content, valueType);
+        } catch (Exception var3) {
+            log.error(var3.getMessage(), var3);
+            return null;
+        }
+    }
+
+    public static <T> T parse(String content, TypeReference<T> typeReference) {
+        try {
+            return getInstance().readValue(content, typeReference);
+        } catch (IOException var3) {
+            throw Exceptions.unchecked(var3);
+        }
+    }
+
+    public static <T> T parse(byte[] bytes, Class<T> valueType) {
+        try {
+            return getInstance().readValue(bytes, valueType);
+        } catch (IOException var3) {
+            throw Exceptions.unchecked(var3);
+        }
+    }
+
+    public static <T> T parse(byte[] bytes, TypeReference<T> typeReference) {
+        try {
+            return getInstance().readValue(bytes, typeReference);
+        } catch (IOException var3) {
+            throw Exceptions.unchecked(var3);
+        }
+    }
+
+    public static <T> T parse(InputStream in, Class<T> valueType) {
+        try {
+            return getInstance().readValue(in, valueType);
+        } catch (IOException var3) {
+            throw Exceptions.unchecked(var3);
+        }
+    }
+
+    public static <T> T parse(InputStream in, TypeReference<T> typeReference) {
+        try {
+            return getInstance().readValue(in, typeReference);
+        } catch (IOException var3) {
+            throw Exceptions.unchecked(var3);
+        }
+    }
+
+    public static <T> List<T> parseArray(String content, Class<T> valueTypeRef) {
+        try {
+            if (!StringUtil.startsWithIgnoreCase(content, "[")) {
+                content = "[" + content + "]";
+            }
+
+            List<Map<String, Object>> list = (List)getInstance().readValue(content, new TypeReference<List<Map<String, Object>>>() {
+            });
+            List<T> result = new ArrayList();
+            Iterator var4 = list.iterator();
+
+            while(var4.hasNext()) {
+                Map<String, Object> map = (Map)var4.next();
+                result.add(toPojo(map, valueTypeRef));
+            }
+
+            return result;
+        } catch (IOException var6) {
+            log.error(var6.getMessage(), var6);
+            return null;
+        }
+    }
+
+    public static Map<String, Object> toMap(String content) {
+        try {
+            return (Map)getInstance().readValue(content, Map.class);
+        } catch (IOException var2) {
+            log.error(var2.getMessage(), var2);
+            return null;
+        }
+    }
+
+    public static <T> Map<String, T> toMap(String content, Class<T> valueTypeRef) {
+        try {
+            Map<String, Map<String, Object>> map = (Map)getInstance().readValue(content, new TypeReference<Map<String, Map<String, Object>>>() {
+            });
+            Map<String, T> result = new HashMap(16);
+            Iterator var4 = map.entrySet().iterator();
+
+            while(var4.hasNext()) {
+                Map.Entry<String, Map<String, Object>> entry = (Map.Entry)var4.next();
+                result.put(entry.getKey(), toPojo((Map)entry.getValue(), valueTypeRef));
+            }
+
+            return result;
+        } catch (IOException var6) {
+            log.error(var6.getMessage(), var6);
+            return null;
+        }
+    }
+
+    public static <T> T toPojo(Map fromValue, Class<T> toValueType) {
+        return getInstance().convertValue(fromValue, toValueType);
+    }
+
+    public static JsonNode readTree(String jsonString) {
+        try {
+            return getInstance().readTree(jsonString);
+        } catch (IOException var2) {
+            throw Exceptions.unchecked(var2);
+        }
+    }
+
+    public static JsonNode readTree(InputStream in) {
+        try {
+            return getInstance().readTree(in);
+        } catch (IOException var2) {
+            throw Exceptions.unchecked(var2);
+        }
+    }
+
+    public static JsonNode readTree(byte[] content) {
+        try {
+            return getInstance().readTree(content);
+        } catch (IOException var2) {
+            throw Exceptions.unchecked(var2);
+        }
+    }
+
+    @Nullable
+    public static <T> T readValue(@Nullable byte[] content, Class<T> valueType) {
+        if (ObjectUtils.isEmpty(content)) {
+            return null;
+        } else {
+            try {
+                return getInstance().readValue(content, valueType);
+            } catch (IOException var3) {
+                throw Exceptions.unchecked(var3);
+            }
+        }
+    }
+
+    @Nullable
+    public static <T> T readValue(@Nullable String jsonString, Class<T> valueType) {
+        if (StringUtil.isBlank(jsonString)) {
+            return null;
+        } else {
+            try {
+                return getInstance().readValue(jsonString, valueType);
+            } catch (IOException var3) {
+                throw Exceptions.unchecked(var3);
+            }
+        }
+    }
+
+    @Nullable
+    public static <T> T readValue(@Nullable InputStream in, Class<T> valueType) {
+        if (in == null) {
+            return null;
+        } else {
+            try {
+                return getInstance().readValue(in, valueType);
+            } catch (IOException var3) {
+                throw Exceptions.unchecked(var3);
+            }
+        }
+    }
+
+    @Nullable
+    public static <T> T readValue(@Nullable byte[] content, TypeReference<T> typeReference) {
+        if (ObjectUtils.isEmpty(content)) {
+            return null;
+        } else {
+            try {
+                return getInstance().readValue(content, typeReference);
+            } catch (IOException var3) {
+                throw Exceptions.unchecked(var3);
+            }
+        }
+    }
+
+    @Nullable
+    public static <T> T readValue(@Nullable String jsonString, TypeReference<T> typeReference) {
+        if (StringUtil.isBlank(jsonString)) {
+            return null;
+        } else {
+            try {
+                return getInstance().readValue(jsonString, typeReference);
+            } catch (IOException var3) {
+                throw Exceptions.unchecked(var3);
+            }
+        }
+    }
+
+    @Nullable
+    public static <T> T readValue(@Nullable InputStream in, TypeReference<T> typeReference) {
+        if (in == null) {
+            return null;
+        } else {
+            try {
+                return getInstance().readValue(in, typeReference);
+            } catch (IOException var3) {
+                throw Exceptions.unchecked(var3);
+            }
+        }
+    }
+
+    public static JsonNode readTree(JsonParser jsonParser) {
+        try {
+            return (JsonNode)getInstance().readTree(jsonParser);
+        } catch (IOException var2) {
+            throw Exceptions.unchecked(var2);
+        }
+    }
+
+    public static ObjectMapper getInstance() {
+        return JsonUtil.JacksonHolder.INSTANCE;
+    }
+
+    public static class JacksonObjectMapper extends ObjectMapper {
+        private static final long serialVersionUID = 4288193147502386170L;
+        private static final Locale CHINA;
+
+        public JacksonObjectMapper() {
+            super.setLocale(CHINA);
+            super.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+            super.setTimeZone(TimeZone.getTimeZone(ZoneId.systemDefault()));
+            super.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA));
+            super.configure(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS.mappedFeature(), true);
+            super.configure(JsonReadFeature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER.mappedFeature(), true);
+            super.findAndRegisterModules();
+            super.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+            super.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+            super.configure(Feature.ALLOW_SINGLE_QUOTES, true);
+            super.getDeserializationConfig().withoutFeatures(new DeserializationFeature[]{DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES});
+            super.registerModule(new ZhongZhengJavaTimeModule());
+            super.findAndRegisterModules();
+        }
+
+        public ObjectMapper copy() {
+            return super.copy();
+        }
+
+        static {
+            CHINA = Locale.CHINA;
+        }
+    }
+
+    private static class JacksonHolder {
+        private static ObjectMapper INSTANCE = new JacksonObjectMapper();
+
+        private JacksonHolder() {
+        }
+    }
+}
+

+ 102 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/Kv.java

@@ -0,0 +1,102 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.HashMap;
+import org.zhongzheng.common.utils.Func;
+import org.springframework.util.LinkedCaseInsensitiveMap;
+
+public class Kv extends LinkedCaseInsensitiveMap<Object> {
+    private Kv() {
+    }
+
+    public static Kv init() {
+        return new Kv();
+    }
+
+    public static Kv create() {
+        return new Kv();
+    }
+
+    public static <K, V> HashMap<K, V> newMap() {
+        return new HashMap(16);
+    }
+
+    public Kv set(String attr, Object value) {
+        this.put(attr, value);
+        return this;
+    }
+
+    public Kv setIgnoreNull(String attr, Object value) {
+        if (null != attr && null != value) {
+            this.set(attr, value);
+        }
+
+        return this;
+    }
+
+    public Object getObj(String key) {
+        return super.get(key);
+    }
+
+    public <T> T get(String attr, T defaultValue) {
+        Object result = this.get(attr);
+        return result != null ? (T)result : defaultValue;
+    }
+
+    public String getStr(String attr) {
+        return Func.toStr(this.get(attr), (String)null);
+    }
+
+    public Integer getInt(String attr) {
+        return Func.toInt(this.get(attr), -1);
+    }
+
+    public Long getLong(String attr) {
+        return Func.toLong(this.get(attr), -1L);
+    }
+
+    public Float getFloat(String attr) {
+        return Func.toFloat(this.get(attr), (Float)null);
+    }
+
+    public Double getDouble(String attr) {
+        return Func.toDouble(this.get(attr), (Double)null);
+    }
+
+    public Boolean getBool(String attr) {
+        return Func.toBoolean(this.get(attr), (Boolean)null);
+    }
+
+    public byte[] getBytes(String attr) {
+        return (byte[])this.get(attr, (Object)null);
+    }
+
+    public Date getDate(String attr) {
+        return (Date)this.get(attr, (Object)null);
+    }
+
+    public Time getTime(String attr) {
+        return (Time)this.get(attr, (Object)null);
+    }
+
+    public Timestamp getTimestamp(String attr) {
+        return (Timestamp)this.get(attr, (Object)null);
+    }
+
+    public Number getNumber(String attr) {
+        return (Number)this.get(attr, (Object)null);
+    }
+
+    public Kv clone() {
+        Kv clone = new Kv();
+        clone.putAll(this);
+        return clone;
+    }
+}

+ 56 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/StrFormatter.java

@@ -0,0 +1,56 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+
+import org.zhongzheng.common.utils.Func;
+
+public class StrFormatter {
+    public StrFormatter() {
+    }
+
+    public static String format(final String strPattern, final Object... argArray) {
+        if (!Func.isBlank(strPattern) && !Func.isEmpty(argArray)) {
+            int strPatternLength = strPattern.length();
+            StringBuilder sbuf = new StringBuilder(strPatternLength + 50);
+            int handledPosition = 0;
+
+            for(int argIndex = 0; argIndex < argArray.length; ++argIndex) {
+                int delimIndex = strPattern.indexOf("{}", handledPosition);
+                if (delimIndex == -1) {
+                    if (handledPosition == 0) {
+                        return strPattern;
+                    }
+
+                    sbuf.append(strPattern, handledPosition, strPatternLength);
+                    return sbuf.toString();
+                }
+
+                if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == '\\') {
+                    if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == '\\') {
+                        sbuf.append(strPattern, handledPosition, delimIndex - 1);
+                        sbuf.append(Func.toStr(argArray[argIndex]));
+                        handledPosition = delimIndex + 2;
+                    } else {
+                        --argIndex;
+                        sbuf.append(strPattern, handledPosition, delimIndex - 1);
+                        sbuf.append("{");
+                        handledPosition = delimIndex + 1;
+                    }
+                } else {
+                    sbuf.append(strPattern, handledPosition, delimIndex);
+                    sbuf.append(Func.toStr(argArray[argIndex]));
+                    handledPosition = delimIndex + 2;
+                }
+            }
+
+            sbuf.append(strPattern, handledPosition, strPattern.length());
+            return sbuf.toString();
+        } else {
+            return strPattern;
+        }
+    }
+}

+ 238 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/StrSpliter.java

@@ -0,0 +1,238 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.zhongzheng.common.utils.Func;
+import org.zhongzheng.common.utils.StringUtil;
+
+public class StrSpliter {
+    public StrSpliter() {
+    }
+
+    public static List<String> splitPath(String str) {
+        return splitPath(str, 0);
+    }
+
+    public static String[] splitPathToArray(String str) {
+        return toArray(splitPath(str));
+    }
+
+    public static List<String> splitPath(String str, int limit) {
+        return split(str, "/", limit, true, true);
+    }
+
+    public static String[] splitPathToArray(String str, int limit) {
+        return toArray(splitPath(str, limit));
+    }
+
+    public static List<String> splitTrim(String str, char separator, boolean ignoreEmpty) {
+        return split(str, separator, 0, true, ignoreEmpty);
+    }
+
+    public static List<String> split(String str, char separator, boolean isTrim, boolean ignoreEmpty) {
+        return split(str, separator, 0, isTrim, ignoreEmpty);
+    }
+
+    public static List<String> splitTrim(String str, char separator, int limit, boolean ignoreEmpty) {
+        return split(str, separator, limit, true, ignoreEmpty, false);
+    }
+
+    public static List<String> split(String str, char separator, int limit, boolean isTrim, boolean ignoreEmpty) {
+        return split(str, separator, limit, isTrim, ignoreEmpty, false);
+    }
+
+    public static List<String> splitIgnoreCase(String str, char separator, int limit, boolean isTrim, boolean ignoreEmpty) {
+        return split(str, separator, limit, isTrim, ignoreEmpty, true);
+    }
+
+    public static List<String> split(String str, char separator, int limit, boolean isTrim, boolean ignoreEmpty, boolean ignoreCase) {
+        if (StringUtil.isEmpty(str)) {
+            return new ArrayList(0);
+        } else if (limit == 1) {
+            return addToList(new ArrayList(1), str, isTrim, ignoreEmpty);
+        } else {
+            ArrayList<String> list = new ArrayList(limit > 0 ? limit : 16);
+            int len = str.length();
+            int start = 0;
+
+            for(int i = 0; i < len; ++i) {
+                if (Func.equals(separator, str.charAt(i))) {
+                    addToList(list, str.substring(start, i), isTrim, ignoreEmpty);
+                    start = i + 1;
+                    if (limit > 0 && list.size() > limit - 2) {
+                        break;
+                    }
+                }
+            }
+
+            return addToList(list, str.substring(start, len), isTrim, ignoreEmpty);
+        }
+    }
+
+    public static String[] splitToArray(String str, char separator, int limit, boolean isTrim, boolean ignoreEmpty) {
+        return toArray(split(str, separator, limit, isTrim, ignoreEmpty));
+    }
+
+    public static List<String> split(String str, String separator, boolean isTrim, boolean ignoreEmpty) {
+        return split(str, separator, -1, isTrim, ignoreEmpty, false);
+    }
+
+    public static List<String> splitTrim(String str, String separator, boolean ignoreEmpty) {
+        return split(str, separator, true, ignoreEmpty);
+    }
+
+    public static List<String> split(String str, String separator, int limit, boolean isTrim, boolean ignoreEmpty) {
+        return split(str, separator, limit, isTrim, ignoreEmpty, false);
+    }
+
+    public static List<String> splitTrim(String str, String separator, int limit, boolean ignoreEmpty) {
+        return split(str, separator, limit, true, ignoreEmpty);
+    }
+
+    public static List<String> splitIgnoreCase(String str, String separator, int limit, boolean isTrim, boolean ignoreEmpty) {
+        return split(str, separator, limit, isTrim, ignoreEmpty, true);
+    }
+
+    public static List<String> splitTrimIgnoreCase(String str, String separator, int limit, boolean ignoreEmpty) {
+        return split(str, separator, limit, true, ignoreEmpty, true);
+    }
+
+    public static List<String> split(String str, String separator, int limit, boolean isTrim, boolean ignoreEmpty, boolean ignoreCase) {
+        if (StringUtil.isEmpty(str)) {
+            return new ArrayList(0);
+        } else if (limit == 1) {
+            return addToList(new ArrayList(1), str, isTrim, ignoreEmpty);
+        } else if (StringUtil.isEmpty(separator)) {
+            return split(str, limit);
+        } else if (separator.length() == 1) {
+            return split(str, separator.charAt(0), limit, isTrim, ignoreEmpty, ignoreCase);
+        } else {
+            ArrayList<String> list = new ArrayList();
+            int len = str.length();
+            int separatorLen = separator.length();
+            int start = 0;
+            int i = 0;
+
+            while(i < len) {
+                i = StringUtil.indexOf(str, separator, start, ignoreCase);
+                if (i <= -1) {
+                    break;
+                }
+
+                addToList(list, str.substring(start, i), isTrim, ignoreEmpty);
+                start = i + separatorLen;
+                if (limit > 0 && list.size() > limit - 2) {
+                    break;
+                }
+            }
+
+            return addToList(list, str.substring(start, len), isTrim, ignoreEmpty);
+        }
+    }
+
+    public static String[] splitToArray(String str, String separator, int limit, boolean isTrim, boolean ignoreEmpty) {
+        return toArray(split(str, separator, limit, isTrim, ignoreEmpty));
+    }
+
+    public static List<String> split(String str, int limit) {
+        if (StringUtil.isEmpty(str)) {
+            return new ArrayList(0);
+        } else if (limit == 1) {
+            return addToList(new ArrayList(1), str, true, true);
+        } else {
+            ArrayList<String> list = new ArrayList();
+            int len = str.length();
+            int start = 0;
+
+            for(int i = 0; i < len; ++i) {
+                if (Func.isEmpty(str.charAt(i))) {
+                    addToList(list, str.substring(start, i), true, true);
+                    start = i + 1;
+                    if (limit > 0 && list.size() > limit - 2) {
+                        break;
+                    }
+                }
+            }
+
+            return addToList(list, str.substring(start, len), true, true);
+        }
+    }
+
+    public static String[] splitToArray(String str, int limit) {
+        return toArray(split(str, limit));
+    }
+
+    public static List<String> split(String str, Pattern separatorPattern, int limit, boolean isTrim, boolean ignoreEmpty) {
+        if (StringUtil.isEmpty(str)) {
+            return new ArrayList(0);
+        } else if (limit == 1) {
+            return addToList(new ArrayList(1), str, isTrim, ignoreEmpty);
+        } else if (null == separatorPattern) {
+            return split(str, limit);
+        } else {
+            Matcher matcher = separatorPattern.matcher(str);
+            ArrayList<String> list = new ArrayList();
+            int len = str.length();
+            int start = 0;
+
+            while(matcher.find()) {
+                addToList(list, str.substring(start, matcher.start()), isTrim, ignoreEmpty);
+                start = matcher.end();
+                if (limit > 0 && list.size() > limit - 2) {
+                    break;
+                }
+            }
+
+            return addToList(list, str.substring(start, len), isTrim, ignoreEmpty);
+        }
+    }
+
+    public static String[] splitToArray(String str, Pattern separatorPattern, int limit, boolean isTrim, boolean ignoreEmpty) {
+        return toArray(split(str, separatorPattern, limit, isTrim, ignoreEmpty));
+    }
+
+    public static String[] splitByLength(String str, int len) {
+        int partCount = str.length() / len;
+        int lastPartCount = str.length() % len;
+        int fixPart = 0;
+        if (lastPartCount != 0) {
+            fixPart = 1;
+        }
+
+        String[] strs = new String[partCount + fixPart];
+
+        for(int i = 0; i < partCount + fixPart; ++i) {
+            if (i == partCount + fixPart - 1 && lastPartCount != 0) {
+                strs[i] = str.substring(i * len, i * len + lastPartCount);
+            } else {
+                strs[i] = str.substring(i * len, i * len + len);
+            }
+        }
+
+        return strs;
+    }
+
+    private static List<String> addToList(List<String> list, String part, boolean isTrim, boolean ignoreEmpty) {
+        part = part.toString();
+        if (isTrim) {
+            part = part.trim();
+        }
+
+        if (!ignoreEmpty || !part.isEmpty()) {
+            list.add(part);
+        }
+
+        return list;
+    }
+
+    private static String[] toArray(List<String> list) {
+        return (String[])list.toArray(new String[list.size()]);
+    }
+}

+ 741 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/StringUtil.java

@@ -0,0 +1,741 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.stream.Stream;
+
+import org.springframework.util.ObjectUtils;
+import org.zhongzheng.common.utils.StrFormatter;
+import org.zhongzheng.common.utils.StrSpliter;
+import org.springframework.lang.Nullable;
+import org.springframework.util.Assert;
+import org.springframework.util.StringUtils;
+import org.springframework.web.util.HtmlUtils;
+
+public class StringUtil extends StringUtils {
+    public static final int INDEX_NOT_FOUND = -1;
+    private static final String S_INT = "0123456789";
+    private static final String S_STR = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+    private static final String S_ALL = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+
+    public StringUtil() {
+    }
+
+    public static boolean isBlank(final CharSequence cs) {
+        return !hasText(cs);
+    }
+
+    public static boolean isNotBlank(final CharSequence cs) {
+        return hasText(cs);
+    }
+
+    public static boolean isAnyBlank(final CharSequence... css) {
+        return ObjectUtils.isEmpty(css) ? true : Stream.of(css).anyMatch(StringUtil::isBlank);
+    }
+
+    public static boolean isNoneBlank(final CharSequence... css) {
+        return ObjectUtils.isEmpty(css) ? false : Stream.of(css).allMatch(StringUtil::isNotBlank);
+    }
+
+    public static boolean isNumeric(final CharSequence cs) {
+        if (isBlank(cs)) {
+            return false;
+        } else {
+            int i = cs.length();
+
+            char chr;
+            do {
+                --i;
+                if (i < 0) {
+                    return true;
+                }
+
+                chr = cs.charAt(i);
+            } while(chr >= '0' && chr <= '9');
+
+            return false;
+        }
+    }
+
+    public static String join(Collection<?> coll) {
+        return collectionToCommaDelimitedString(coll);
+    }
+
+    public static String join(Collection<?> coll, String delim) {
+        return collectionToDelimitedString(coll, delim);
+    }
+
+    public static String join(Object[] arr) {
+        return arrayToCommaDelimitedString(arr);
+    }
+
+    public static String join(Object[] arr, String delim) {
+        return arrayToDelimitedString(arr, delim);
+    }
+
+    public static String randomUUID() {
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        return (new UUID(random.nextLong(), random.nextLong())).toString().replace("-", "");
+    }
+
+    public static String escapeHtml(String html) {
+        return isBlank(html) ? "" : HtmlUtils.htmlEscape(html);
+    }
+
+    public static String cleanChars(String txt) {
+        return txt.replaceAll("[  `·•�\u0001\\f\\t\\v\\s]", "");
+    }
+
+    public static String random(int count) {
+        return random(count, RandomType.ALL);
+    }
+
+    public static String random(int count, RandomType randomType) {
+        if (count == 0) {
+            return "";
+        } else {
+            Assert.isTrue(count > 0, "Requested random string length " + count + " is less than 0.");
+            ThreadLocalRandom random = ThreadLocalRandom.current();
+            char[] buffer = new char[count];
+
+            for(int i = 0; i < count; ++i) {
+                if (RandomType.INT == randomType) {
+                    buffer[i] = "0123456789".charAt(random.nextInt("0123456789".length()));
+                } else if (RandomType.STRING == randomType) {
+                    buffer[i] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".charAt(random.nextInt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".length()));
+                } else {
+                    buffer[i] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".charAt(random.nextInt("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".length()));
+                }
+            }
+
+            return new String(buffer);
+        }
+    }
+
+    public static String format(CharSequence template, Object... params) {
+        if (null == template) {
+            return null;
+        } else {
+            return !Func.isEmpty(params) && !isBlank(template) ? StrFormatter.format(template.toString(), params) : template.toString();
+        }
+    }
+
+    public static String indexedFormat(CharSequence pattern, Object... arguments) {
+        return MessageFormat.format(pattern.toString(), arguments);
+    }
+
+    public static String format(CharSequence template, Map<?, ?> map) {
+        if (null == template) {
+            return null;
+        } else if (null != map && !map.isEmpty()) {
+            String template2 = template.toString();
+
+            Map.Entry entry;
+            for(Iterator var3 = map.entrySet().iterator(); var3.hasNext(); template2 = template2.replace("{" + entry.getKey() + "}", Func.toStr(entry.getValue()))) {
+                entry = (Map.Entry)var3.next();
+            }
+
+            return template2;
+        } else {
+            return template.toString();
+        }
+    }
+
+    @Nullable
+    public static String cleanIdentifier(@Nullable String param) {
+        if (param == null) {
+            return null;
+        } else {
+            StringBuilder paramBuilder = new StringBuilder();
+
+            for(int i = 0; i < param.length(); ++i) {
+                char c = param.charAt(i);
+                if (Character.isJavaIdentifierPart(c)) {
+                    paramBuilder.append(c);
+                }
+            }
+
+            return paramBuilder.toString();
+        }
+    }
+
+    public static List<String> split(CharSequence str, char separator, int limit) {
+        return split(str, separator, limit, false, false);
+    }
+
+    public static List<String> splitTrim(CharSequence str, char separator) {
+        return splitTrim(str, separator, -1);
+    }
+
+    public static List<String> splitTrim(CharSequence str, CharSequence separator) {
+        return splitTrim(str, separator, -1);
+    }
+
+    public static List<String> splitTrim(CharSequence str, char separator, int limit) {
+        return split(str, separator, limit, true, true);
+    }
+
+    public static List<String> splitTrim(CharSequence str, CharSequence separator, int limit) {
+        return split(str, separator, limit, true, true);
+    }
+
+    public static List<String> split(CharSequence str, char separator, boolean isTrim, boolean ignoreEmpty) {
+        return split(str, separator, 0, isTrim, ignoreEmpty);
+    }
+
+    public static List<String> split(CharSequence str, char separator, int limit, boolean isTrim, boolean ignoreEmpty) {
+        return (List)(null == str ? new ArrayList(0) : StrSpliter.split(str.toString(), separator, limit, isTrim, ignoreEmpty));
+    }
+
+    public static List<String> split(CharSequence str, CharSequence separator, int limit, boolean isTrim, boolean ignoreEmpty) {
+        if (null == str) {
+            return new ArrayList(0);
+        } else {
+            String separatorStr = null == separator ? null : separator.toString();
+            return StrSpliter.split(str.toString(), separatorStr, limit, isTrim, ignoreEmpty);
+        }
+    }
+
+    public static String[] split(CharSequence str, CharSequence separator) {
+        if (str == null) {
+            return new String[0];
+        } else {
+            String separatorStr = null == separator ? null : separator.toString();
+            return StrSpliter.splitToArray(str.toString(), separatorStr, 0, false, false);
+        }
+    }
+
+    public static String[] split(CharSequence str, int len) {
+        return null == str ? new String[0] : StrSpliter.splitByLength(str.toString(), len);
+    }
+
+    public static boolean contains(CharSequence str, char searchChar) {
+        return indexOf(str, searchChar) > -1;
+    }
+
+    public static boolean containsAny(CharSequence str, CharSequence... testStrs) {
+        return null != getContainsStr(str, testStrs);
+    }
+
+    public static String getContainsStr(CharSequence str, CharSequence... testStrs) {
+        if (!isEmpty(str) && !Func.isEmpty(testStrs)) {
+            CharSequence[] var2 = testStrs;
+            int var3 = testStrs.length;
+
+            for(int var4 = 0; var4 < var3; ++var4) {
+                CharSequence checkStr = var2[var4];
+                if (str.toString().contains(checkStr)) {
+                    return checkStr.toString();
+                }
+            }
+
+            return null;
+        } else {
+            return null;
+        }
+    }
+
+    public static boolean containsIgnoreCase(CharSequence str, CharSequence testStr) {
+        if (null == str) {
+            return null == testStr;
+        } else {
+            return str.toString().toLowerCase().contains(testStr.toString().toLowerCase());
+        }
+    }
+
+    public static boolean containsAnyIgnoreCase(CharSequence str, CharSequence... testStrs) {
+        return null != getContainsStrIgnoreCase(str, testStrs);
+    }
+
+    public static String getContainsStrIgnoreCase(CharSequence str, CharSequence... testStrs) {
+        if (!isEmpty(str) && !Func.isEmpty(testStrs)) {
+            CharSequence[] var2 = testStrs;
+            int var3 = testStrs.length;
+
+            for(int var4 = 0; var4 < var3; ++var4) {
+                CharSequence testStr = var2[var4];
+                if (containsIgnoreCase(str, testStr)) {
+                    return testStr.toString();
+                }
+            }
+
+            return null;
+        } else {
+            return null;
+        }
+    }
+
+    public static String sub(CharSequence str, int fromIndex, int toIndex) {
+        if (isEmpty(str)) {
+            return "";
+        } else {
+            int len = str.length();
+            if (fromIndex < 0) {
+                fromIndex += len;
+                if (fromIndex < 0) {
+                    fromIndex = 0;
+                }
+            } else if (fromIndex > len) {
+                fromIndex = len;
+            }
+
+            if (toIndex < 0) {
+                toIndex += len;
+                if (toIndex < 0) {
+                    toIndex = len;
+                }
+            } else if (toIndex > len) {
+                toIndex = len;
+            }
+
+            if (toIndex < fromIndex) {
+                int tmp = fromIndex;
+                fromIndex = toIndex;
+                toIndex = tmp;
+            }
+
+            return fromIndex == toIndex ? "" : str.toString().substring(fromIndex, toIndex);
+        }
+    }
+
+    public static String subBefore(CharSequence string, CharSequence separator, boolean isLastSeparator) {
+        if (!isEmpty(string) && separator != null) {
+            String str = string.toString();
+            String sep = separator.toString();
+            if (sep.isEmpty()) {
+                return "";
+            } else {
+                int pos = isLastSeparator ? str.lastIndexOf(sep) : str.indexOf(sep);
+                return pos == -1 ? str : str.substring(0, pos);
+            }
+        } else {
+            return null == string ? null : string.toString();
+        }
+    }
+
+    public static String subAfter(CharSequence string, CharSequence separator, boolean isLastSeparator) {
+        if (isEmpty(string)) {
+            return null == string ? null : string.toString();
+        } else if (separator == null) {
+            return "";
+        } else {
+            String str = string.toString();
+            String sep = separator.toString();
+            int pos = isLastSeparator ? str.lastIndexOf(sep) : str.indexOf(sep);
+            return pos == -1 ? "" : str.substring(pos + separator.length());
+        }
+    }
+
+    public static String subBetween(CharSequence str, CharSequence before, CharSequence after) {
+        if (str != null && before != null && after != null) {
+            String str2 = str.toString();
+            String before2 = before.toString();
+            String after2 = after.toString();
+            int start = str2.indexOf(before2);
+            if (start != -1) {
+                int end = str2.indexOf(after2, start + before2.length());
+                if (end != -1) {
+                    return str2.substring(start + before2.length(), end);
+                }
+            }
+
+            return null;
+        } else {
+            return null;
+        }
+    }
+
+    public static String subBetween(CharSequence str, CharSequence beforeAndAfter) {
+        return subBetween(str, beforeAndAfter, beforeAndAfter);
+    }
+
+    public static String removePrefix(CharSequence str, CharSequence prefix) {
+        if (!isEmpty(str) && !isEmpty(prefix)) {
+            String str2 = str.toString();
+            return str2.startsWith(prefix.toString()) ? subSuf(str2, prefix.length()) : str2;
+        } else {
+            return "";
+        }
+    }
+
+    public static String removePrefixIgnoreCase(CharSequence str, CharSequence prefix) {
+        if (!isEmpty(str) && !isEmpty(prefix)) {
+            String str2 = str.toString();
+            return str2.toLowerCase().startsWith(prefix.toString().toLowerCase()) ? subSuf(str2, prefix.length()) : str2;
+        } else {
+            return "";
+        }
+    }
+
+    public static String removeSuffix(CharSequence str, CharSequence suffix) {
+        if (!isEmpty(str) && !isEmpty(suffix)) {
+            String str2 = str.toString();
+            return str2.endsWith(suffix.toString()) ? subPre(str2, str2.length() - suffix.length()) : str2;
+        } else {
+            return "";
+        }
+    }
+
+    public static String removeSufAndLowerFirst(CharSequence str, CharSequence suffix) {
+        return lowerFirst(removeSuffix(str, suffix));
+    }
+
+    public static String removeSuffixIgnoreCase(CharSequence str, CharSequence suffix) {
+        if (!isEmpty(str) && !isEmpty(suffix)) {
+            String str2 = str.toString();
+            return str2.toLowerCase().endsWith(suffix.toString().toLowerCase()) ? subPre(str2, str2.length() - suffix.length()) : str2;
+        } else {
+            return "";
+        }
+    }
+
+    public static String lowerFirst(String str) {
+        char firstChar = str.charAt(0);
+        if (firstChar >= 'A' && firstChar <= 'Z') {
+            char[] arr = str.toCharArray();
+            arr[0] = (char)(arr[0] + 32);
+            return new String(arr);
+        } else {
+            return str;
+        }
+    }
+
+    public static String upperFirst(String str) {
+        char firstChar = str.charAt(0);
+        if (firstChar >= 'a' && firstChar <= 'z') {
+            char[] arr = str.toCharArray();
+            arr[0] = (char)(arr[0] - 32);
+            return new String(arr);
+        } else {
+            return str;
+        }
+    }
+
+    public static String subPre(CharSequence string, int toIndex) {
+        return sub(string, 0, toIndex);
+    }
+
+    public static String subSuf(CharSequence string, int fromIndex) {
+        return isEmpty(string) ? null : sub(string, fromIndex, string.length());
+    }
+
+    public static int indexOf(final CharSequence str, char searchChar) {
+        return indexOf(str, searchChar, 0);
+    }
+
+    public static int indexOf(final CharSequence str, char searchChar, int start) {
+        return str instanceof String ? ((String)str).indexOf(searchChar, start) : indexOf(str, searchChar, start, -1);
+    }
+
+    public static int indexOf(final CharSequence str, char searchChar, int start, int end) {
+        int len = str.length();
+        if (start < 0 || start > len) {
+            start = 0;
+        }
+
+        if (end > len || end < 0) {
+            end = len;
+        }
+
+        for(int i = start; i < end; ++i) {
+            if (str.charAt(i) == searchChar) {
+                return i;
+            }
+        }
+
+        return -1;
+    }
+
+    public static int indexOfIgnoreCase(final CharSequence str, final CharSequence searchStr) {
+        return indexOfIgnoreCase(str, searchStr, 0);
+    }
+
+    public static int indexOfIgnoreCase(final CharSequence str, final CharSequence searchStr, int fromIndex) {
+        return indexOf(str, searchStr, fromIndex, true);
+    }
+
+    public static int indexOf(final CharSequence str, CharSequence searchStr, int fromIndex, boolean ignoreCase) {
+        if (str != null && searchStr != null) {
+            if (fromIndex < 0) {
+                fromIndex = 0;
+            }
+
+            int endLimit = str.length() - searchStr.length() + 1;
+            if (fromIndex > endLimit) {
+                return -1;
+            } else if (searchStr.length() == 0) {
+                return fromIndex;
+            } else if (!ignoreCase) {
+                return str.toString().indexOf(searchStr.toString(), fromIndex);
+            } else {
+                for(int i = fromIndex; i < endLimit; ++i) {
+                    if (isSubEquals(str, i, searchStr, 0, searchStr.length(), true)) {
+                        return i;
+                    }
+                }
+
+                return -1;
+            }
+        } else {
+            return -1;
+        }
+    }
+
+    public static int lastIndexOfIgnoreCase(final CharSequence str, final CharSequence searchStr) {
+        return lastIndexOfIgnoreCase(str, searchStr, str.length());
+    }
+
+    public static int lastIndexOfIgnoreCase(final CharSequence str, final CharSequence searchStr, int fromIndex) {
+        return lastIndexOf(str, searchStr, fromIndex, true);
+    }
+
+    public static int lastIndexOf(final CharSequence str, final CharSequence searchStr, int fromIndex, boolean ignoreCase) {
+        if (str != null && searchStr != null) {
+            if (fromIndex < 0) {
+                fromIndex = 0;
+            }
+
+            fromIndex = Math.min(fromIndex, str.length());
+            if (searchStr.length() == 0) {
+                return fromIndex;
+            } else if (!ignoreCase) {
+                return str.toString().lastIndexOf(searchStr.toString(), fromIndex);
+            } else {
+                for(int i = fromIndex; i > 0; --i) {
+                    if (isSubEquals(str, i, searchStr, 0, searchStr.length(), true)) {
+                        return i;
+                    }
+                }
+
+                return -1;
+            }
+        } else {
+            return -1;
+        }
+    }
+
+    public static int ordinalIndexOf(String str, String searchStr, int ordinal) {
+        if (str != null && searchStr != null && ordinal > 0) {
+            if (searchStr.length() == 0) {
+                return 0;
+            } else {
+                int found = 0;
+                int index = -1;
+
+                do {
+                    index = str.indexOf(searchStr, index + 1);
+                    if (index < 0) {
+                        return index;
+                    }
+
+                    ++found;
+                } while(found < ordinal);
+
+                return index;
+            }
+        } else {
+            return -1;
+        }
+    }
+
+    public static boolean isSubEquals(CharSequence str1, int start1, CharSequence str2, int start2, int length, boolean ignoreCase) {
+        return null != str1 && null != str2 ? str1.toString().regionMatches(ignoreCase, start1, str2.toString(), start2, length) : false;
+    }
+
+    public static boolean equals(CharSequence str1, CharSequence str2) {
+        return equals(str1, str2, false);
+    }
+
+    public static boolean equalsIgnoreCase(CharSequence str1, CharSequence str2) {
+        return equals(str1, str2, true);
+    }
+
+    public static boolean equals(CharSequence str1, CharSequence str2, boolean ignoreCase) {
+        if (null == str1) {
+            return str2 == null;
+        } else if (null == str2) {
+            return false;
+        } else {
+            return ignoreCase ? str1.toString().equalsIgnoreCase(str2.toString()) : str1.equals(str2);
+        }
+    }
+
+    public static StringBuilder builder() {
+        return new StringBuilder();
+    }
+
+    public static StringBuilder builder(int capacity) {
+        return new StringBuilder(capacity);
+    }
+
+    public static StringBuilder builder(CharSequence... strs) {
+        StringBuilder sb = new StringBuilder();
+        CharSequence[] var2 = strs;
+        int var3 = strs.length;
+
+        for(int var4 = 0; var4 < var3; ++var4) {
+            CharSequence str = var2[var4];
+            sb.append(str);
+        }
+
+        return sb;
+    }
+
+    public static StringBuilder appendBuilder(StringBuilder sb, CharSequence... strs) {
+        CharSequence[] var2 = strs;
+        int var3 = strs.length;
+
+        for(int var4 = 0; var4 < var3; ++var4) {
+            CharSequence str = var2[var4];
+            sb.append(str);
+        }
+
+        return sb;
+    }
+
+    public static StringReader getReader(CharSequence str) {
+        return null == str ? null : new StringReader(str.toString());
+    }
+
+    public static StringWriter getWriter() {
+        return new StringWriter();
+    }
+
+    public static int count(CharSequence content, CharSequence strForSearch) {
+        if (!Func.hasEmpty(new Object[]{content, strForSearch}) && strForSearch.length() <= content.length()) {
+            int count = 0;
+            int idx = 0;
+            String content2 = content.toString();
+
+            for(String strForSearch2 = strForSearch.toString(); (idx = content2.indexOf(strForSearch2, idx)) > -1; idx += strForSearch.length()) {
+                ++count;
+            }
+
+            return count;
+        } else {
+            return 0;
+        }
+    }
+
+    public static int count(CharSequence content, char charForSearch) {
+        int count = 0;
+        if (isEmpty(content)) {
+            return 0;
+        } else {
+            int contentLength = content.length();
+
+            for(int i = 0; i < contentLength; ++i) {
+                if (charForSearch == content.charAt(i)) {
+                    ++count;
+                }
+            }
+
+            return count;
+        }
+    }
+
+    public static String underlineToHump(String para) {
+        StringBuilder result = new StringBuilder();
+        String[] a = para.split("_");
+        String[] var3 = a;
+        int var4 = a.length;
+
+        for(int var5 = 0; var5 < var4; ++var5) {
+            String s = var3[var5];
+            if (result.length() == 0) {
+                result.append(s.toLowerCase());
+            } else {
+                result.append(s.substring(0, 1).toUpperCase());
+                result.append(s.substring(1).toLowerCase());
+            }
+        }
+
+        return result.toString();
+    }
+
+    public static String humpToUnderline(String para) {
+        para = lowerFirst(para);
+        StringBuilder sb = new StringBuilder(para);
+        int temp = 0;
+
+        for(int i = 0; i < para.length(); ++i) {
+            if (Character.isUpperCase(para.charAt(i))) {
+                sb.insert(i + temp, "_");
+                ++temp;
+            }
+        }
+
+        return sb.toString().toLowerCase();
+    }
+
+    public static String lineToHump(String para) {
+        StringBuilder result = new StringBuilder();
+        String[] a = para.split("-");
+        String[] var3 = a;
+        int var4 = a.length;
+
+        for(int var5 = 0; var5 < var4; ++var5) {
+            String s = var3[var5];
+            if (result.length() == 0) {
+                result.append(s.toLowerCase());
+            } else {
+                result.append(s.substring(0, 1).toUpperCase());
+                result.append(s.substring(1).toLowerCase());
+            }
+        }
+
+        return result.toString();
+    }
+
+    public static String humpToLine(String para) {
+        para = lowerFirst(para);
+        StringBuilder sb = new StringBuilder(para);
+        int temp = 0;
+
+        for(int i = 0; i < para.length(); ++i) {
+            if (Character.isUpperCase(para.charAt(i))) {
+                sb.insert(i + temp, "-");
+                ++temp;
+            }
+        }
+
+        return sb.toString().toLowerCase();
+    }
+
+    public static String firstCharToLower(String str) {
+        char firstChar = str.charAt(0);
+        if (firstChar >= 'A' && firstChar <= 'Z') {
+            char[] arr = str.toCharArray();
+            arr[0] = (char)(arr[0] + 32);
+            return new String(arr);
+        } else {
+            return str;
+        }
+    }
+
+    public static String firstCharToUpper(String str) {
+        char firstChar = str.charAt(0);
+        if (firstChar >= 'a' && firstChar <= 'z') {
+            char[] arr = str.toCharArray();
+            arr[0] = (char)(arr[0] - 32);
+            return new String(arr);
+        } else {
+            return str;
+        }
+    }
+}
+

+ 269 - 0
zzbusiness-common/src/main/java/org/zhongzheng/common/utils/WebUtil.java

@@ -0,0 +1,269 @@
+package org.zhongzheng.common.utils;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.nio.charset.StandardCharsets;
+import java.util.Enumeration;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.zhongzheng.common.utils.JsonUtil;
+import org.springframework.lang.Nullable;
+import org.springframework.util.Assert;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import org.springframework.web.method.HandlerMethod;
+import org.springframework.web.util.WebUtils;
+
+public class WebUtil extends WebUtils {
+    private static final Logger log = LoggerFactory.getLogger(WebUtil.class);
+    public static final String USER_AGENT_HEADER = "user-agent";
+    public static final String UN_KNOWN = "unknown";
+
+    public WebUtil() {
+    }
+
+    public static boolean isBody(HandlerMethod handlerMethod) {
+        ResponseBody responseBody = (ResponseBody)ClassUtil.getAnnotation(handlerMethod, ResponseBody.class);
+        return responseBody != null;
+    }
+
+    @Nullable
+    public static String getCookieVal(String name) {
+        HttpServletRequest request = getRequest();
+        Assert.notNull(request, "request from RequestContextHolder is null");
+        return getCookieVal(request, name);
+    }
+
+    @Nullable
+    public static String getCookieVal(HttpServletRequest request, String name) {
+        Cookie cookie = getCookie(request, name);
+        return cookie != null ? cookie.getValue() : null;
+    }
+
+    public static void removeCookie(HttpServletResponse response, String key) {
+        setCookie(response, key, (String)null, 0);
+    }
+
+    public static void setCookie(HttpServletResponse response, String name, @Nullable String value, int maxAgeInSeconds) {
+        Cookie cookie = new Cookie(name, value);
+        cookie.setPath("/");
+        cookie.setMaxAge(maxAgeInSeconds);
+        cookie.setHttpOnly(true);
+        response.addCookie(cookie);
+    }
+
+    public static HttpServletRequest getRequest() {
+        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
+        return requestAttributes == null ? null : ((ServletRequestAttributes)requestAttributes).getRequest();
+    }
+
+    public static void renderJson(HttpServletResponse response, Object result) {
+        renderJson(response, result, "application/json");
+    }
+
+    public static void renderJson(HttpServletResponse response, Object result, String contentType) {
+        response.setCharacterEncoding("UTF-8");
+        response.setContentType(contentType);
+
+        try {
+            PrintWriter out = response.getWriter();
+            Throwable var4 = null;
+
+            try {
+                out.append(JsonUtil.toJson(result));
+            } catch (Throwable var14) {
+                var4 = var14;
+                throw var14;
+            } finally {
+                if (out != null) {
+                    if (var4 != null) {
+                        try {
+                            out.close();
+                        } catch (Throwable var13) {
+                            var4.addSuppressed(var13);
+                        }
+                    } else {
+                        out.close();
+                    }
+                }
+
+            }
+        } catch (IOException var16) {
+            log.error(var16.getMessage(), var16);
+        }
+
+    }
+
+    public static String getIP() {
+        return getIP(getRequest());
+    }
+
+    @Nullable
+    public static String getIP(HttpServletRequest request) {
+        Assert.notNull(request, "HttpServletRequest is null");
+        String ip = request.getHeader("X-Requested-For");
+        if (StringUtil.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getHeader("X-Forwarded-For");
+        }
+
+        if (StringUtil.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getHeader("Proxy-Client-IP");
+        }
+
+        if (StringUtil.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getHeader("WL-Proxy-Client-IP");
+        }
+
+        if (StringUtil.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getHeader("HTTP_CLIENT_IP");
+        }
+
+        if (StringUtil.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
+        }
+
+        if (StringUtil.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getRemoteAddr();
+        }
+
+        return StringUtil.isBlank(ip) ? null : ip.split(",")[0];
+    }
+
+    public static String getRequestParamString(HttpServletRequest request) {
+        try {
+            return getRequestStr(request);
+        } catch (Exception var2) {
+            return "";
+        }
+    }
+
+    public static String getRequestStr(HttpServletRequest request) throws IOException {
+        String queryString = request.getQueryString();
+        return StringUtil.isNotBlank(queryString) ? (new String(queryString.getBytes(Charsets.ISO_8859_1), Charsets.UTF_8)).replaceAll("&amp;", "&").replaceAll("%22", "\"") : getRequestStr(request, getRequestBytes(request));
+    }
+
+    public static byte[] getRequestBytes(HttpServletRequest request) throws IOException {
+        int contentLength = request.getContentLength();
+        if (contentLength < 0) {
+            return null;
+        } else {
+            byte[] buffer = new byte[contentLength];
+
+            int readlen;
+            for(int i = 0; i < contentLength; i += readlen) {
+                readlen = request.getInputStream().read(buffer, i, contentLength - i);
+                if (readlen == -1) {
+                    break;
+                }
+            }
+
+            return buffer;
+        }
+    }
+
+    public static String getRequestStr(HttpServletRequest request, byte[] buffer) throws IOException {
+        String charEncoding = request.getCharacterEncoding();
+        if (charEncoding == null) {
+            charEncoding = "UTF-8";
+        }
+
+        String str = (new String(buffer, charEncoding)).trim();
+        if (StringUtil.isBlank(str)) {
+            StringBuilder sb = new StringBuilder();
+            Enumeration<String> parameterNames = request.getParameterNames();
+
+            while(parameterNames.hasMoreElements()) {
+                String key = (String)parameterNames.nextElement();
+                String value = request.getParameter(key);
+                StringUtil.appendBuilder(sb, new CharSequence[]{key, "=", value, "&"});
+            }
+
+            str = StringUtil.removeSuffix(sb.toString(), "&");
+        }
+
+        return str.replaceAll("&amp;", "&");
+    }
+
+    public static String getRequestBody(ServletInputStream servletInputStream) {
+        StringBuilder sb = new StringBuilder();
+        BufferedReader reader = null;
+
+        try {
+            reader = new BufferedReader(new InputStreamReader(servletInputStream, StandardCharsets.UTF_8));
+
+            String line;
+            while((line = reader.readLine()) != null) {
+                sb.append(line);
+            }
+        } catch (IOException var16) {
+            var16.printStackTrace();
+        } finally {
+            if (servletInputStream != null) {
+                try {
+                    servletInputStream.close();
+                } catch (IOException var15) {
+                    var15.printStackTrace();
+                }
+            }
+
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (IOException var14) {
+                    var14.printStackTrace();
+                }
+            }
+
+        }
+
+        return sb.toString();
+    }
+
+    public static String getRequestContent(HttpServletRequest request) {
+        try {
+            String queryString = request.getQueryString();
+            if (StringUtil.isNotBlank(queryString)) {
+                return (new String(queryString.getBytes(Charsets.ISO_8859_1), Charsets.UTF_8)).replaceAll("&amp;", "&").replaceAll("%22", "\"");
+            } else {
+                String charEncoding = request.getCharacterEncoding();
+                if (charEncoding == null) {
+                    charEncoding = "UTF-8";
+                }
+
+                byte[] buffer = getRequestBody(request.getInputStream()).getBytes();
+                String str = (new String(buffer, charEncoding)).trim();
+                if (StringUtil.isBlank(str)) {
+                    StringBuilder sb = new StringBuilder();
+                    Enumeration<String> parameterNames = request.getParameterNames();
+
+                    while(parameterNames.hasMoreElements()) {
+                        String key = (String)parameterNames.nextElement();
+                        String value = request.getParameter(key);
+                        StringUtil.appendBuilder(sb, new CharSequence[]{key, "=", value, "&"});
+                    }
+
+                    str = StringUtil.removeSuffix(sb.toString(), "&");
+                }
+
+                return str.replaceAll("&amp;", "&");
+            }
+        } catch (Exception var9) {
+            var9.printStackTrace();
+            return "";
+        }
+    }
+}