From aef219e6e7e9fb1f3592806d5e64ce714adf6848 Mon Sep 17 00:00:00 2001 From: xyh <18782104331@139.com> Date: 星期五, 18 六月 2021 15:39:51 +0800 Subject: [PATCH] bug-424-【后端-宣传教育-新增 】 宣传人数只能输入大于等于0的正正数,8位长度字符 --- 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