public static String beanToString(Object o) {
        if (o == null) {
            return null;
        }

        Field[] fields = o.getClass().getDeclaredFields();
        StringBuilder buffer = new StringBuilder();
        buffer.append("[");
        for (Field field : fields) {
            Object val = null;
            try {
                val = ReflectionUtil.getFieldValue(o, field);
            } catch (RuntimeException e) {
                LOGGER.warn("get field value failed", e);
            }
            if (val != null) {
                buffer.append(field.getName()).append("=").append(val).append(", ");
            }
        }
        if (buffer.length() > 2) {
            buffer.delete(buffer.length() - 2, buffer.length());
        }
        buffer.append("]");
        return buffer.toString();
    }
@Test
    public void testBeanToString() {
        BranchDO branchDO = new BranchDO("xid123123", 123L, 1, 2.2, new Date());
        Assertions.assertNotNull(BeanUtils.beanToString(branchDO));
        // null object
        Assertions.assertNull(BeanUtils.beanToString(null));
        // buffer length < 2
        Assertions.assertNotNull(BeanUtils.beanToString(new Object()));
        // null val
        Assertions.assertNotNull(BeanUtils.beanToString(new BranchDO(null, null, null, null, null)));
    }