Utils.java
505 Bytes
package com.viontech.fanxing.commons.utils;
/**
 * .
 *
 * @author 谢明辉
 * @date 2022/1/20
 */
public class Utils {
    public static Long cast2Long(Object item) {
        if (!(item instanceof Number)) {
            throw new RuntimeException(item.toString() + "不是数字类型");
        }
        if (item instanceof Long) {
            return (Long) item;
        } else if (item instanceof Integer) {
            return ((Integer) item).longValue();
        }
        return 0L;
    }
}