| | |
| | | package com.vci.starter.web.util; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.vci.common.exception.VciExceptionTool; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 雪花ID |
| | | * @return |
| | | */ |
| | | public static String getSnowflakePk() { |
| | | return String.valueOf(getSnowflakePk(1,1)); |
| | | } |
| | | |
| | | public static Long getSnowflakePk(long workerId,long dataCenterId){ |
| | | Snowflake snowflake = IdUtil.getSnowflake(workerId,dataCenterId); |
| | | return snowflake.nextId(); |
| | | } |
| | | |
| | | /** |
| | | * 字符串转数字 |
| | | * @param string 字符串 |
| | | * @return 数字 |