package com.ycwl.basic.utils;


import cn.hutool.core.lang.Snowflake;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Date;

@Slf4j
@Component
public class SnowFlakeUtil {

    private static final Long machineId = 1L;

    private static final Long datacenterId =1L;

    private static final Snowflake snowflake = new Snowflake(null, machineId, datacenterId, true);

    public static String getId() {
        return snowflake.nextIdStr();
    }

    public static Long getLongId(){
        return snowflake.nextId();
    }

}
