From 3c1b0c83b6cc50dd94b3194fe4a80f322b663496 Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期二, 20 四月 2021 20:15:01 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/helper/encrypt/DoEncrytDecrypt.java | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/helper/encrypt/DoEncrytDecrypt.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/helper/encrypt/DoEncrytDecrypt.java
index 5c7e621..d67c1bb 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/helper/encrypt/DoEncrytDecrypt.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/helper/encrypt/DoEncrytDecrypt.java
@@ -32,8 +32,12 @@
log.debug("加密字段:" + field.getName());
Object fieldVal = field.get(parameterObject);
if(fieldVal!=null) {
- String encryptedStr = AESUtil.encrypt128(fieldVal.toString(), aesKey);
- field.set(parameterObject, encryptedStr);
+ try {
+ String encryptedStr = AESUtil.encrypt128(fieldVal.toString(), aesKey);
+ field.set(parameterObject, encryptedStr);
+ }catch (Exception e){
+ log.debug("加密失败");
+ }
}
}
}
@@ -53,8 +57,15 @@
if (annotation.annotationType() == EncryptDecryptField.class) {
log.debug("解密密字段:" + field.getName());
String fieldVal = field.get(result).toString();
- String decryptVal = AESUtil.decrypt128(fieldVal, aesKey);
- field.set(result, decryptVal!=null?decryptVal:fieldVal);
+ try {
+ String decryptVal = AESUtil.decrypt128(fieldVal, aesKey);
+ field.set(result, decryptVal != null ? decryptVal : fieldVal);
+ }catch (Exception e){
+ /**
+ * 兼容原始未加密数据
+ */
+ field.set(result, fieldVal);
+ }
}
}
}
--
Gitblit v1.7.1