Przeglądaj źródła

删除无用信息

bihuisong 1 rok temu
rodzic
commit
5dac12a9f8

+ 0 - 53
src/main/java/com/sooka/sponest/dataexchange/util/HmacSHA256.java

@@ -1,53 +0,0 @@
-package com.sooka.sponest.dataexchange.util;
-
-import javax.crypto.Mac;
-import javax.crypto.spec.SecretKeySpec;
-import java.io.UnsupportedEncodingException;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-
-public class HmacSHA256 {
-
-    //十六进制字符集
-    private final static char[] DIGEST_ARRAYS = {
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
-    };
-
-    /**
-     * 功能:Signature生成算法
-     * 输入参数:
-     *          1.data: HMAC-SHA256的输入数据
-     *          2.key: App Key
-     * 输出参数:十六进制字符串编码的HMAC-SHA256值
-     */
-    public static String encode(String data, String key) {
-        byte[] hashByte;
-        try {
-            Mac sha256HMAC = Mac.getInstance("HmacSHA256");
-            SecretKeySpec secretKey = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA256");
-            sha256HMAC.init(secretKey);
-
-            hashByte = sha256HMAC.doFinal(data.getBytes("UTF-8"));
-        } catch (NoSuchAlgorithmException | UnsupportedEncodingException | InvalidKeyException e) {
-            return null;
-        }
-
-        return bytesToHex(hashByte);
-    }
-
-    /**
-     * 功能:byte类型数组转换成十六进制字符串
-     * 输入参数:
-     *          1.bytes:被转换的字节数组
-     * 输出参数:十六进制字符串
-     */
-    private static String bytesToHex(byte[] bytes) {
-        StringBuffer hexStr = new StringBuffer();
-        for (int i = 0; i < bytes.length; i++) {
-            hexStr.append(DIGEST_ARRAYS[bytes[i] >>> 4 & 0X0F]);
-            hexStr.append(DIGEST_ARRAYS[bytes[i] & 0X0F]);
-        }
-
-        return hexStr.toString();
-    }
-}

+ 0 - 95
src/main/java/com/sooka/sponest/dataexchange/util/hwMeetingCacheUtil.java

@@ -1,95 +0,0 @@
-package com.sooka.sponest.dataexchange.util;
-
-import com.ruoyi.common.core.utils.SpringUtils;
-import org.apache.shiro.cache.Cache;
-import org.apache.shiro.cache.CacheManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class hwMeetingCacheUtil {
-
-    private static Logger logger = LoggerFactory.getLogger(CacheUtils.class);
-
-    private static CacheManager cacheManager = SpringUtils.getBean(CacheManager.class);
-
-    private static final String CACHE = "hwMeetingCache";
-
-    /**
-     * 获取CACHE缓存
-     *
-     * @param key
-     * @return
-     */
-    public static Object get(String key)
-    {
-        return get(CACHE, key);
-    }
-
-    /**
-     * 获取缓存
-     *
-     * @param cacheName
-     * @param key
-     * @return
-     */
-    private static Object get(String cacheName, String key)
-    {
-        return getCache(cacheName).get(key);
-    }
-
-    /**
-     * 写入CACHE缓存
-     *
-     * @param key
-     * @return
-     */
-    public static void put(String key, Object value)
-    {
-        put(CACHE, key, value);
-    }
-
-
-    /**
-     * 写入缓存
-     *
-     * @param cacheName
-     * @param key
-     * @param value
-     */
-    private static void put(String cacheName, String key, Object value)
-    {
-        getCache(cacheName).put(key, value);
-    }
-
-    /**
-     * 判断是否有CACHE缓存
-     *
-     * @param key
-     * @return
-     */
-    public static boolean has(String key)
-    {
-        Object o = getCache(CACHE).get(key);
-        if(o == null){
-            return false;
-        }
-        return true;
-    }
-
-
-    /**
-     * 获得一个Cache,没有则显示日志。
-     *
-     * @param cacheName
-     * @return
-     */
-    private static Cache<String, Object> getCache(String cacheName)
-    {
-        Cache<String, Object> cache = cacheManager.getCache(cacheName);
-        if (cache == null)
-        {
-            throw new RuntimeException("当前系统中没有定义“" + cacheName + "”这个缓存。");
-        }
-        return cache;
-    }
-}