package com.zhongshu.card.server.core.test;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.github.microservice.models.property.PostGetPropertyParam;
import com.zhongshu.card.client.type.CommonEnum;

import java.util.Calendar;

/**
 * @author TRX
 * @date 2024/5/31
 */
public class Test {
    public static void main(String[] args) {
//        Snowflake snowflake = new Snowflake();
//        String orderNo = String.valueOf(snowflake.nextId());
//        System.out.println(orderNo + " = " + orderNo.length());
//
//        String str = "123abc@";
//        ValidateResult result = ValidateUtils.validatePassWord(str);
//        System.out.println("结果：" + result.isSuccess() + " = " + result.getMsg()
//                + " == " + ValidateUtils.isPhoneNumber("18723497166"));
//
//        Map<String, Object> map = new HashMap<>();
//        map.put("orderNo", orderNo);
//        map.put("age", 24);
//        map.put("money", BigDecimal.valueOf(563.21));
//        System.out.println("map = " + JSONUtil.toJsonStr(map));
//
//        BigDecimal b1 = BigDecimal.valueOf(54.32);
//        BigDecimal b2 = BigDecimal.valueOf(564.32);
//        System.out.println("m= " + b1.divide(b2, 5, RoundingMode.HALF_UP));
//
//        GroovyShell groovyShell = new GroovyShell();
//        String res = " println 'Hello, Groovy!' ";
//        Object result1 = groovyShell.evaluate(res);
//        System.out.println("result1 = " + result1);
//
//        try {
//            String stt = "我是";
//            byte[] encoded = Base64.getEncoder().encode(stt.getBytes("utf-8"));
//            System.out.println("base64 = " + new String(encoded));
//            byte[] stt1 = Base64.getDecoder().decode(encoded);
//            System.out.println("stt1 = " + new String(stt1));
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
        PostGetPropertyParam propertyParam = new PostGetPropertyParam();
        propertyParam.addProperty("a001", "name");
        propertyParam.addProperty("a001", "name");
        propertyParam.addProperty("a001", "age");

        JSONObject data = JSONUtil.parseObj(propertyParam);
        System.out.println(JSONUtil.toJsonStr(data));

        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, 5);
        System.out.println(calendar.get(Calendar.DAY_OF_WEEK));
    }

    public static void test(Enum[] enums) {
        for (Enum e : enums) {
            System.out.println(e.name());
            if (e instanceof CommonEnum) {
                CommonEnum superEnum = (CommonEnum) e;
                String str = ((CommonEnum) e).getRemark();
                System.out.println(str);
            }
        }
    }
}
