From 69f6865e4744094d657a538e9c013cb9d97df01a Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期三, 09 十月 2024 17:03:01 +0800
Subject: [PATCH] 在线用户统计报错修改,UI上下文三个克隆接口测试完成上传

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/Func.java |   64 ++++++++++++++++++++++++++++++++
 1 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/Func.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/Func.java
index 86007ae..14206fd 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/Func.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/Func.java
@@ -40,6 +40,60 @@
 public class Func {
 
     /**
+     * 閫氬父鐢ㄤ簬灏嗕富閿畂id杞崲鎴�8浣嶅敮涓�hash鐮佸��
+     * @return
+     */
+    public static String oidEnHash(String oid){
+        UUID originalUUID = UUID.fromString(oid);
+        // 浣跨敤Base64缂栫爜灏嗗師濮婾UID杞崲涓鸿緝鐭殑瀛楃涓�
+        String base64String = Base64.getUrlEncoder().withoutPadding().encodeToString(new byte[] {
+                (byte)(originalUUID.getMostSignificantBits()>>>56),
+                (byte)(originalUUID.getMostSignificantBits()>>>48),
+                (byte)(originalUUID.getMostSignificantBits()>>>40),
+                (byte)(originalUUID.getMostSignificantBits()>>>32),
+                (byte)(originalUUID.getMostSignificantBits()>>>24),
+                (byte)(originalUUID.getMostSignificantBits()>>>16),
+                (byte)(originalUUID.getMostSignificantBits()>>>8),
+                (byte)(originalUUID.getMostSignificantBits()),
+                (byte)(originalUUID.getLeastSignificantBits()>>>56),
+                (byte)(originalUUID.getLeastSignificantBits()>>>48),
+                (byte)(originalUUID.getLeastSignificantBits()>>>40),
+                (byte)(originalUUID.getLeastSignificantBits()>>>32),
+                (byte)(originalUUID.getLeastSignificantBits()>>>24),
+                (byte)(originalUUID.getLeastSignificantBits()>>>16),
+                (byte)(originalUUID.getLeastSignificantBits()>>>8),
+                (byte)(originalUUID.getLeastSignificantBits())});
+        return base64String;
+    }
+
+    /**
+     * 閫氬父鐢ㄤ簬灏嗕富閿畂id杞崲鎴愮殑8浣嶅敮涓�hash鐮侊紝鍙嶈浆涓簅id
+     * @param base64String
+     * @return
+     */
+    public static String oidDeHash(String base64String){
+        // 鍙嶆帹鍥炲師濮嬬殑UUID瀛楃涓�
+        byte[] bytes = Base64.getUrlDecoder().decode(base64String);
+        UUID reconstructedUUID = new UUID(((long)(bytes[0] & 0xff) << 56)
+                | ((long)(bytes[1] & 0xff) << 48)
+                | ((long)(bytes[2] & 0xff) << 40)
+                | ((long)(bytes[3] & 0xff) << 32)
+                | ((long)(bytes[4] & 0xff) << 24)
+                | ((long)(bytes[5] & 0xff) << 16)
+                | ((long)(bytes[6] & 0xff) << 8)
+                | (bytes[7] & 0xff),
+                ((long)(bytes[8] & 0xff) << 56)
+                        | ((long)(bytes[9] & 0xff) << 48)
+                        | ((long)(bytes[10] & 0xff) << 40)
+                        | ((long)(bytes[11] & 0xff) << 32)
+                        | ((long)(bytes[12] & 0xff) << 24)
+                        | ((long)(bytes[13] & 0xff) << 16)
+                        | ((long)(bytes[14] & 0xff) << 8)
+                        | (bytes[15] & 0xff));
+        return reconstructedUUID.toString().toUpperCase(Locale.ROOT);
+    }
+
+    /**
      * 鏂█锛屽繀椤讳笉鑳戒负 null
      * <blockquote><pre>
      * public Foo(Bar bar) {
@@ -1178,6 +1232,16 @@
     }
 
     /**
+     * AES 瑙e瘑
+     * @param encryptedData
+     * @param secretKey
+     * @return
+     */
+    public static String decryptAes(String encryptedData, String secretKey) throws Exception {
+        return DigestUtil.decryptAes(encryptedData, secretKey);
+    }
+
+    /**
      * hmacMd5 Hex
      *
      * @param bytes Data to digest

--
Gitblit v1.9.3