田源
2024-07-26 889842eb8b64a0b72c449ce23ff21e4e8c935cae
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/VciBaseUtil.java
@@ -1,6 +1,8 @@
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;
@@ -55,7 +57,7 @@
     * @param e
     * @return
     */
    public static String getExceptionMessage(Exception e){
    public static String getExceptionMessage(Throwable e){
        String exceptionStr = VciExceptionTool.getExceptionStr(e);
        if(exceptionStr.contains("VciBaseException")){
            return e.getMessage();
@@ -81,6 +83,19 @@
    }
    /**
     * 雪花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 数字