package com.crm.ucard.util;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;

/**
 * @author: test
 * @date: 2023/12/27 11:07
 * @describe:
 */
public class ObjectIdUtil {

    private static final int WORKER_ID = 6;
    private static final int DATA_CENTER_ID = 12;

    public static Long genSnowFlakeId() {
        Snowflake snowflake = IdUtil.getSnowflake(WORKER_ID, DATA_CENTER_ID);
        return snowflake.nextId();
    }

    public static String genSnowFlakeIdStr() {
        return String.valueOf(genSnowFlakeId());
    }

    public static String genSnowFlakeIdStr(String tag) {
        return tag + genSnowFlakeId();
    }

}
