Bläddra i källkod

fix: 消费服务
1.人员卡余加密密钥获取错误问题

luoyb 1 år sedan
förälder
incheckning
780f356327

+ 6 - 2
ruoyi-common/ruoyi-common-encrypt/src/main/java/org/dromara/common/encrypt/utils/YcEncryptUtil.java

@@ -6,6 +6,8 @@ import cn.hutool.crypto.SecureUtil;
 import cn.hutool.crypto.asymmetric.KeyType;
 import cn.hutool.crypto.asymmetric.RSA;
 import cn.hutool.crypto.digest.MD5;
+import lombok.extern.slf4j.Slf4j;
+import lombok.extern.slf4j.XSlf4j;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.dromara.common.core.constant.CacheNames;
 import org.dromara.common.core.utils.DigitUtils;
@@ -27,6 +29,7 @@ import java.util.Map;
  * @version 0.1
  * @since JDK 1.8
  */
+@Slf4j
 public class YcEncryptUtil extends EncryptUtils {
     private static final String defaultCharset = "UTF-8";
     private static final String KEY_AES = "AES";
@@ -123,14 +126,15 @@ public class YcEncryptUtil extends EncryptUtils {
      */
     public static String getBalanceSecretKey(String publicKey, String data) {
         String secretKey;
-        Map<String, String> mapUserKey = new HashMap<>();
-        //String cacheKey = StrUtil.replace(CacheNames.USER_SECRET_KEY, "30d", data);
         String cacheKey = CacheNames.USER_SECRET_KEY + ":" + data;
+        log.info("[卡余加密缓存KEY]-[{}]",cacheKey);
         if (ObjectUtil.isNotNull(RedisUtils.getCacheObject(cacheKey))) {
             secretKey = RedisUtils.getCacheObject(cacheKey).toString();
+            log.info("[缓存获取到的密钥]-[{}]",secretKey);
         } else {
             String md5DigestData = getMd5DigestData(publicKey);
             secretKey = encryptByMd5WidthAes(data, md5DigestData, false);
+            log.info("[生成的密钥]-[{}]",secretKey);
             RedisUtils.setCacheObject(cacheKey, secretKey);
         }