From 8555f974846ca5b4f4734f52b51e39cd4502df44 Mon Sep 17 00:00:00 2001
From: DESKTOP-71BH0QO\L、ming <172680469@qq.com>
Date: 星期五, 02 四月 2021 15:46:30 +0800
Subject: [PATCH] fix:修改bug

---
 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