- * 版本号具有以下含意: - *
- * 变体号具有以下含意: - *
- * 60 位的时间戳值根据此 {@code UUID} 的 time_low、time_mid 和 time_hi 字段构造。
- * 所得到的时间戳以 100 毫微秒为单位,从 UTC(通用协调时间) 1582 年 10 月 15 日零时开始。
- *
- *
- * 时间戳值仅在在基于时间的 UUID(其 version 类型为 1)中才有意义。
- * 如果此 {@code UUID} 不是基于时间的 UUID,则此方法抛出 UnsupportedOperationException。
- *
- * @throws UnsupportedOperationException 如果此 {@code UUID} 不是 version 为 1 的 UUID。
- */
- public long timestamp() throws UnsupportedOperationException
- {
- checkTimeBase();
- return (mostSigBits & 0x0FFFL) << 48//
- | ((mostSigBits >> 16) & 0x0FFFFL) << 32//
- | mostSigBits >>> 32;
- }
-
- /**
- * 与此 UUID 相关联的时钟序列值。
- *
- *
- * 14 位的时钟序列值根据此 UUID 的 clock_seq 字段构造。clock_seq 字段用于保证在基于时间的 UUID 中的时间唯一性。 - *
- * {@code clockSequence} 值仅在基于时间的 UUID(其 version 类型为 1)中才有意义。 如果此 UUID 不是基于时间的 UUID,则此方法抛出 - * UnsupportedOperationException。 - * - * @return 此 {@code UUID} 的时钟序列 - * - * @throws UnsupportedOperationException 如果此 UUID 的 version 不为 1 - */ - public int clockSequence() throws UnsupportedOperationException - { - checkTimeBase(); - return (int) ((leastSigBits & 0x3FFF000000000000L) >>> 48); - } - - /** - * 与此 UUID 相关的节点值。 - * - *
- * 48 位的节点值根据此 UUID 的 node 字段构造。此字段旨在用于保存机器的 IEEE 802 地址,该地址用于生成此 UUID 以保证空间唯一性。 - *
- * 节点值仅在基于时间的 UUID(其 version 类型为 1)中才有意义。
- * 如果此 UUID 不是基于时间的 UUID,则此方法抛出 UnsupportedOperationException。
- *
- * @return 此 {@code UUID} 的节点值
- *
- * @throws UnsupportedOperationException 如果此 UUID 的 version 不为 1
- */
- public long node() throws UnsupportedOperationException
- {
- checkTimeBase();
- return leastSigBits & 0x0000FFFFFFFFFFFFL;
- }
-
- /**
- * 返回此{@code UUID} 的字符串表现形式。
- *
- *
- * UUID 的字符串表示形式由此 BNF 描述: - * - *
- * {@code - * UUID =- * - * - * - * @return 此{@code UUID} 的字符串表现形式 - * @see #toString(boolean) - */ - @Override - public String toString() - { - return toString(false); - } - - /** - * 返回此{@code UUID} 的字符串表现形式。 - * - *- - - - - * time_low = 4* - * time_mid = 2* - * time_high_and_version = 2* - * variant_and_sequence = 2* - * node = 6* - * hexOctet = - * hexDigit = [0-9a-fA-F] - * } - *
- * UUID 的字符串表示形式由此 BNF 描述: - * - *
- * {@code - * UUID =- * - * - * - * @param isSimple 是否简单模式,简单模式为不带'-'的UUID字符串 - * @return 此{@code UUID} 的字符串表现形式 - */ - public String toString(boolean isSimple) - { - final StringBuilder builder = new StringBuilder(isSimple ? 32 : 36); - // time_low - builder.append(digits(mostSigBits >> 32, 8)); - if (false == isSimple) - { - builder.append('-'); - } - // time_mid - builder.append(digits(mostSigBits >> 16, 4)); - if (false == isSimple) - { - builder.append('-'); - } - // time_high_and_version - builder.append(digits(mostSigBits, 4)); - if (false == isSimple) - { - builder.append('-'); - } - // variant_and_sequence - builder.append(digits(leastSigBits >> 48, 4)); - if (false == isSimple) - { - builder.append('-'); - } - // node - builder.append(digits(leastSigBits, 12)); - - return builder.toString(); - } - - /** - * 返回此 UUID 的哈希码。 - * - * @return UUID 的哈希码值。 - */ - @Override - public int hashCode() - { - long hilo = mostSigBits ^ leastSigBits; - return ((int) (hilo >> 32)) ^ (int) hilo; - } - - /** - * 将此对象与指定对象比较。 - *- - - - - * time_low = 4* - * time_mid = 2* - * time_high_and_version = 2* - * variant_and_sequence = 2* - * node = 6* - * hexOctet = - * hexDigit = [0-9a-fA-F] - * } - *
- * 当且仅当参数不为 {@code null}、而是一个 UUID 对象、具有与此 UUID 相同的 varriant、包含相同的值(每一位均相同)时,结果才为 {@code true}。 - * - * @param obj 要与之比较的对象 - * - * @return 如果对象相同,则返回 {@code true};否则返回 {@code false} - */ - @Override - public boolean equals(Object obj) - { - if ((null == obj) || (obj.getClass() != UUID.class)) - { - return false; - } - UUID id = (UUID) obj; - return (mostSigBits == id.mostSigBits && leastSigBits == id.leastSigBits); - } - - // Comparison Operations - - /** - * 将此 UUID 与指定的 UUID 比较。 - * - *
- * 如果两个 UUID 不同,且第一个 UUID 的最高有效字段大于第二个 UUID 的对应字段,则第一个 UUID 大于第二个 UUID。
- *
- * @param val 与此 UUID 比较的 UUID
- *
- * @return 在此 UUID 小于、等于或大于 val 时,分别返回 -1、0 或 1。
- *
- */
- @Override
- public int compareTo(UUID val)
- {
- // The ordering is intentionally set up so that the UUIDs
- // can simply be numerically compared as two numbers
- return (this.mostSigBits < val.mostSigBits ? -1 : //
- (this.mostSigBits > val.mostSigBits ? 1 : //
- (this.leastSigBits < val.leastSigBits ? -1 : //
- (this.leastSigBits > val.leastSigBits ? 1 : //
- 0))));
- }
-
- // -------------------------------------------------------------------------------------------------------------------
- // Private method start
- /**
- * 返回指定数字对应的hex值
- *
- * @param val 值
- * @param digits 位
- * @return 值
- */
- private static String digits(long val, int digits)
- {
- long hi = 1L << (digits * 4);
- return Long.toHexString(hi | (val & (hi - 1))).substring(1);
- }
-
- /**
- * 检查是否为time-based版本UUID
- */
- private void checkTimeBase()
- {
- if (version() != 1)
- {
- throw new UnsupportedOperationException("Not a time-based UUID");
- }
- }
-
- /**
- * 获取{@link SecureRandom},类提供加密的强随机数生成器 (RNG)
- *
- * @return {@link SecureRandom}
- */
- public static SecureRandom getSecureRandom()
- {
- try
- {
- return SecureRandom.getInstance("SHA1PRNG");
- }
- catch (NoSuchAlgorithmException e)
- {
- throw new UtilException(e);
- }
- }
-
- /**
- * 获取随机数生成器对象
- * ThreadLocalRandom是JDK 7之后提供并发产生随机数,能够解决多个线程发生的竞争争夺。
- *
- * @return {@link ThreadLocalRandom}
- */
- public static ThreadLocalRandom getRandom()
- {
- return ThreadLocalRandom.current();
- }
-}
diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml
index 1100a293..d738880e 100644
--- a/ruoyi-framework/pom.xml
+++ b/ruoyi-framework/pom.xml
@@ -55,18 +55,6 @@