Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
E
estateplat-encrypt
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
狄熙卜
estateplat-encrypt
Commits
452db1e3
提交
452db1e3
authored
3月 20, 2024
作者:
狄熙卜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改错误拼写
上级
f5c2ec91
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
272 行增加
和
272 行删除
+272
-272
CryptProperties.java
...ain/java/cn/gtmap/bdcdj/core/encrypt/CryptProperties.java
+38
-38
DbEncryptXmlConfig.java
.../java/cn/gtmap/bdcdj/core/encrypt/DbEncryptXmlConfig.java
+173
-173
EncryptAdapterBuilder.java
...va/cn/gtmap/bdcdj/core/encrypt/EncryptAdapterBuilder.java
+6
-6
EncryptInterceptor.java
.../java/cn/gtmap/bdcdj/core/encrypt/EncryptInterceptor.java
+14
-14
CommonEncryptAdapter.java
...dj/core/encrypt/adapter/encrypt/CommonEncryptAdapter.java
+2
-2
Encrypt.java
.../java/cn/gtmap/bdcdj/core/encrypt/annotation/Encrypt.java
+5
-5
BaseConfig.java
...n/java/cn/gtmap/bdcdj/core/encrypt/config/BaseConfig.java
+6
-6
QlrConfig.java
...in/java/cn/gtmap/bdcdj/core/encrypt/config/QlrConfig.java
+6
-6
QlrlxdhConfig.java
...ava/cn/gtmap/bdcdj/core/encrypt/config/QlrlxdhConfig.java
+6
-6
ZlConfig.java
...ain/java/cn/gtmap/bdcdj/core/encrypt/config/ZlConfig.java
+6
-6
BeanCryptHandler.java
...cn/gtmap/bdcdj/core/encrypt/handler/BeanCryptHandler.java
+10
-10
没有找到文件。
src/main/java/cn/gtmap/bdcdj/core/encrypt/CryptProperties.java
浏览文件 @
452db1e3
...
@@ -28,17 +28,17 @@ public class CryptProperties {
...
@@ -28,17 +28,17 @@ public class CryptProperties {
//entity中全局加解密字段的例外(在例外中不加解密)
//entity中全局加解密字段的例外(在例外中不加解密)
private
List
<
Map
>
globalDisableMapFields
;
private
List
<
Map
>
globalDisableMapFields
;
//sql加解密字段
//sql加解密字段
private
List
<
Map
>
sqlFi
le
ds
;
private
List
<
Map
>
sqlFi
el
ds
;
//sql仅加密字段
//sql仅加密字段
private
List
<
Map
>
sqlEncryptFi
le
ds
;
private
List
<
Map
>
sqlEncryptFi
el
ds
;
//sql仅解密字段
//sql仅解密字段
private
List
<
Map
>
sqlDecryptFi
le
ds
;
private
List
<
Map
>
sqlDecryptFi
el
ds
;
//实体加解密字段
//实体加解密字段
private
List
<
Map
>
entityFi
le
ds
;
private
List
<
Map
>
entityFi
el
ds
;
//sql参数为单独的string,对参数加密(等价于注解)
//sql参数为单独的string,对参数加密(等价于注解)
private
List
<
String
>
sqlSingleEncryptFi
le
ds
;
private
List
<
String
>
sqlSingleEncryptFi
el
ds
;
//sql返回值为单独的string,对返回值加密(等价于注解)
//sql返回值为单独的string,对返回值加密(等价于注解)
private
List
<
String
>
sqlSingleDecryptFi
le
ds
;
private
List
<
String
>
sqlSingleDecryptFi
el
ds
;
public
CryptProperties
(
boolean
cryptEnable
)
{
public
CryptProperties
(
boolean
cryptEnable
)
{
this
.
cryptEnable
=
cryptEnable
;
this
.
cryptEnable
=
cryptEnable
;
}
}
...
@@ -47,20 +47,20 @@ public class CryptProperties {
...
@@ -47,20 +47,20 @@ public class CryptProperties {
this
.
cryptType
=
cryptType
;
this
.
cryptType
=
cryptType
;
}
}
public
List
<
String
>
getSqlSingleEncryptFi
le
ds
()
{
public
List
<
String
>
getSqlSingleEncryptFi
el
ds
()
{
return
sqlSingleEncryptFi
le
ds
;
return
sqlSingleEncryptFi
el
ds
;
}
}
public
void
setSqlSingleEncryptFi
leds
(
List
<
String
>
sqlSingleEncryptFile
ds
)
{
public
void
setSqlSingleEncryptFi
elds
(
List
<
String
>
sqlSingleEncryptFiel
ds
)
{
this
.
sqlSingleEncryptFi
leds
=
sqlSingleEncryptFile
ds
;
this
.
sqlSingleEncryptFi
elds
=
sqlSingleEncryptFiel
ds
;
}
}
public
List
<
String
>
getSqlSingleDecryptFi
le
ds
()
{
public
List
<
String
>
getSqlSingleDecryptFi
el
ds
()
{
return
sqlSingleDecryptFi
le
ds
;
return
sqlSingleDecryptFi
el
ds
;
}
}
public
void
setSqlSingleDecryptFi
leds
(
List
<
String
>
sqlSingleDecryptFile
ds
)
{
public
void
setSqlSingleDecryptFi
elds
(
List
<
String
>
sqlSingleDecryptFiel
ds
)
{
this
.
sqlSingleDecryptFi
leds
=
sqlSingleDecryptFile
ds
;
this
.
sqlSingleDecryptFi
elds
=
sqlSingleDecryptFiel
ds
;
}
}
public
boolean
isUserSm4KeyEnable
()
{
public
boolean
isUserSm4KeyEnable
()
{
...
@@ -144,36 +144,36 @@ public class CryptProperties {
...
@@ -144,36 +144,36 @@ public class CryptProperties {
this
.
globalDisableMapFields
=
globalDisableMapFields
;
this
.
globalDisableMapFields
=
globalDisableMapFields
;
}
}
public
List
<
Map
>
getSqlFi
le
ds
()
{
public
List
<
Map
>
getSqlFi
el
ds
()
{
return
sqlFi
le
ds
;
return
sqlFi
el
ds
;
}
}
public
void
setSqlFi
leds
(
List
<
Map
>
sqlFile
ds
)
{
public
void
setSqlFi
elds
(
List
<
Map
>
sqlFiel
ds
)
{
this
.
sqlFi
leds
=
sqlFile
ds
;
this
.
sqlFi
elds
=
sqlFiel
ds
;
}
}
public
List
<
Map
>
getSqlEncryptFi
le
ds
()
{
public
List
<
Map
>
getSqlEncryptFi
el
ds
()
{
return
sqlEncryptFi
le
ds
;
return
sqlEncryptFi
el
ds
;
}
}
public
void
setSqlEncryptFi
leds
(
List
<
Map
>
sqlEncryptFile
ds
)
{
public
void
setSqlEncryptFi
elds
(
List
<
Map
>
sqlEncryptFiel
ds
)
{
this
.
sqlEncryptFi
leds
=
sqlEncryptFile
ds
;
this
.
sqlEncryptFi
elds
=
sqlEncryptFiel
ds
;
}
}
public
List
<
Map
>
getSqlDecryptFi
le
ds
()
{
public
List
<
Map
>
getSqlDecryptFi
el
ds
()
{
return
sqlDecryptFi
le
ds
;
return
sqlDecryptFi
el
ds
;
}
}
public
void
setSqlDecryptFi
leds
(
List
<
Map
>
sqlDecryptFile
ds
)
{
public
void
setSqlDecryptFi
elds
(
List
<
Map
>
sqlDecryptFiel
ds
)
{
this
.
sqlDecryptFi
leds
=
sqlDecryptFile
ds
;
this
.
sqlDecryptFi
elds
=
sqlDecryptFiel
ds
;
}
}
public
List
<
Map
>
getEntityFi
le
ds
()
{
public
List
<
Map
>
getEntityFi
el
ds
()
{
return
entityFi
le
ds
;
return
entityFi
el
ds
;
}
}
public
void
setEntityFi
leds
(
List
<
Map
>
entityFile
ds
)
{
public
void
setEntityFi
elds
(
List
<
Map
>
entityFiel
ds
)
{
this
.
entityFi
leds
=
entityFile
ds
;
this
.
entityFi
elds
=
entityFiel
ds
;
}
}
public
boolean
isEncryptDecryptEntityField
(
String
entityName
,
String
fieldName
)
{
public
boolean
isEncryptDecryptEntityField
(
String
entityName
,
String
fieldName
)
{
...
@@ -183,8 +183,8 @@ public class CryptProperties {
...
@@ -183,8 +183,8 @@ public class CryptProperties {
if
(
isGlobalFields
(
null
,
entityName
,
fieldName
)){
if
(
isGlobalFields
(
null
,
entityName
,
fieldName
)){
return
true
;
return
true
;
}
else
{
}
else
{
List
<
Map
>
entityFi
leds
=
getEntityFile
ds
();
List
<
Map
>
entityFi
elds
=
getEntityFiel
ds
();
if
(
getEntityContainsField
(
entityFi
le
ds
,
entityName
,
fieldName
)){
if
(
getEntityContainsField
(
entityFi
el
ds
,
entityName
,
fieldName
)){
return
true
;
return
true
;
}
else
{
}
else
{
return
false
;
return
false
;
...
@@ -199,9 +199,9 @@ public class CryptProperties {
...
@@ -199,9 +199,9 @@ public class CryptProperties {
if
(
isGlobalFields
(
mapid
,
null
,
fieldName
)){
if
(
isGlobalFields
(
mapid
,
null
,
fieldName
)){
return
true
;
return
true
;
}
else
{
}
else
{
List
<
Map
>
sqlFi
leds
=
getSqlFile
ds
();
List
<
Map
>
sqlFi
elds
=
getSqlFiel
ds
();
List
<
Map
>
sqlEncryptFi
leds
=
getSqlEncryptFile
ds
();
List
<
Map
>
sqlEncryptFi
elds
=
getSqlEncryptFiel
ds
();
if
(
getMapContainsField
(
sqlFi
leds
,
mapid
,
fieldName
)
||
getMapContainsField
(
sqlEncryptFile
ds
,
mapid
,
fieldName
)){
if
(
getMapContainsField
(
sqlFi
elds
,
mapid
,
fieldName
)
||
getMapContainsField
(
sqlEncryptFiel
ds
,
mapid
,
fieldName
)){
return
true
;
return
true
;
}
else
{
}
else
{
return
false
;
return
false
;
...
@@ -216,9 +216,9 @@ public class CryptProperties {
...
@@ -216,9 +216,9 @@ public class CryptProperties {
if
(
isGlobalFields
(
mapid
,
null
,
fieldName
)){
if
(
isGlobalFields
(
mapid
,
null
,
fieldName
)){
return
true
;
return
true
;
}
else
{
}
else
{
List
<
Map
>
sqlFi
leds
=
getSqlFile
ds
();
List
<
Map
>
sqlFi
elds
=
getSqlFiel
ds
();
List
<
Map
>
sqlDecryptFi
leds
=
getSqlDecryptFile
ds
();
List
<
Map
>
sqlDecryptFi
elds
=
getSqlDecryptFiel
ds
();
if
(
getMapContainsField
(
sqlFi
leds
,
mapid
,
fieldName
)
||
getMapContainsField
(
sqlDecryptFile
ds
,
mapid
,
fieldName
)){
if
(
getMapContainsField
(
sqlFi
elds
,
mapid
,
fieldName
)
||
getMapContainsField
(
sqlDecryptFiel
ds
,
mapid
,
fieldName
)){
return
true
;
return
true
;
}
else
{
}
else
{
return
false
;
return
false
;
...
...
src/main/java/cn/gtmap/bdcdj/core/encrypt/DbEncryptXmlConfig.java
浏览文件 @
452db1e3
...
@@ -45,17 +45,17 @@ public class DbEncryptXmlConfig {
...
@@ -45,17 +45,17 @@ public class DbEncryptXmlConfig {
//entity中全局加解密字段的例外(在例外中不加解密)
//entity中全局加解密字段的例外(在例外中不加解密)
private
List
<
Map
>
globalDisableMapFields
;
private
List
<
Map
>
globalDisableMapFields
;
//sql加解密字段
//sql加解密字段
private
List
<
Map
>
sqlFi
le
ds
;
private
List
<
Map
>
sqlFi
el
ds
;
//sql仅加密字段
//sql仅加密字段
private
List
<
Map
>
sqlEncryptFi
le
ds
;
private
List
<
Map
>
sqlEncryptFi
el
ds
;
//sql仅解密字段
//sql仅解密字段
private
List
<
Map
>
sqlDecryptFi
le
ds
;
private
List
<
Map
>
sqlDecryptFi
el
ds
;
//实体加解密字段
//实体加解密字段
private
List
<
Map
>
entityFi
le
ds
;
private
List
<
Map
>
entityFi
el
ds
;
//sql参数为单独的string,对参数加密(等价于注解)
//sql参数为单独的string,对参数加密(等价于注解)
private
List
<
String
>
sqlSingleEncryptFi
le
ds
;
private
List
<
String
>
sqlSingleEncryptFi
el
ds
;
//sql返回值为单独的string,对返回值加密(等价于注解)
//sql返回值为单独的string,对返回值加密(等价于注解)
private
List
<
String
>
sqlSingleDecryptFi
le
ds
;
private
List
<
String
>
sqlSingleDecryptFi
el
ds
;
//接口加解密列表
//接口加解密列表
private
List
<
String
>
interfaceEncryptList
;
private
List
<
String
>
interfaceEncryptList
;
private
String
interfaceSm2DecodeKey
;
//接口加解密时,sm2解密的私钥
private
String
interfaceSm2DecodeKey
;
//接口加解密时,sm2解密的私钥
...
@@ -89,28 +89,28 @@ public class DbEncryptXmlConfig {
...
@@ -89,28 +89,28 @@ public class DbEncryptXmlConfig {
this
.
globalDisableMapFields
=
globalDisableMapFields
;
this
.
globalDisableMapFields
=
globalDisableMapFields
;
}
}
public
void
setSqlFi
leds
(
List
<
Map
>
sqlFile
ds
)
{
public
void
setSqlFi
elds
(
List
<
Map
>
sqlFiel
ds
)
{
this
.
sqlFi
leds
=
sqlFile
ds
;
this
.
sqlFi
elds
=
sqlFiel
ds
;
}
}
public
void
setSqlEncryptFi
leds
(
List
<
Map
>
sqlEncryptFile
ds
)
{
public
void
setSqlEncryptFi
elds
(
List
<
Map
>
sqlEncryptFiel
ds
)
{
this
.
sqlEncryptFi
leds
=
sqlEncryptFile
ds
;
this
.
sqlEncryptFi
elds
=
sqlEncryptFiel
ds
;
}
}
public
void
setSqlDecryptFi
leds
(
List
<
Map
>
sqlDecryptFile
ds
)
{
public
void
setSqlDecryptFi
elds
(
List
<
Map
>
sqlDecryptFiel
ds
)
{
this
.
sqlDecryptFi
leds
=
sqlDecryptFile
ds
;
this
.
sqlDecryptFi
elds
=
sqlDecryptFiel
ds
;
}
}
public
void
setEntityFi
leds
(
List
<
Map
>
entityFile
ds
)
{
public
void
setEntityFi
elds
(
List
<
Map
>
entityFiel
ds
)
{
this
.
entityFi
leds
=
entityFile
ds
;
this
.
entityFi
elds
=
entityFiel
ds
;
}
}
public
void
setSqlSingleEncryptFi
leds
(
List
<
String
>
sqlSingleEncryptFile
ds
)
{
public
void
setSqlSingleEncryptFi
elds
(
List
<
String
>
sqlSingleEncryptFiel
ds
)
{
this
.
sqlSingleEncryptFi
leds
=
sqlSingleEncryptFile
ds
;
this
.
sqlSingleEncryptFi
elds
=
sqlSingleEncryptFiel
ds
;
}
}
public
void
setSqlSingleDecryptFi
leds
(
List
<
String
>
sqlSingleDecryptFile
ds
)
{
public
void
setSqlSingleDecryptFi
elds
(
List
<
String
>
sqlSingleDecryptFiel
ds
)
{
this
.
sqlSingleDecryptFi
leds
=
sqlSingleDecryptFile
ds
;
this
.
sqlSingleDecryptFi
elds
=
sqlSingleDecryptFiel
ds
;
}
}
public
void
setInterfaceEncryptList
(
List
<
String
>
interfaceEncryptList
)
{
public
void
setInterfaceEncryptList
(
List
<
String
>
interfaceEncryptList
)
{
...
@@ -142,12 +142,12 @@ public class DbEncryptXmlConfig {
...
@@ -142,12 +142,12 @@ public class DbEncryptXmlConfig {
setGlobalEnableFields
(
null
);
setGlobalEnableFields
(
null
);
setGlobalDisableEntityFields
(
null
);
setGlobalDisableEntityFields
(
null
);
setGlobalDisableMapFields
(
null
);
setGlobalDisableMapFields
(
null
);
setSqlFi
le
ds
(
null
);
setSqlFi
el
ds
(
null
);
setSqlEncryptFi
le
ds
(
null
);
setSqlEncryptFi
el
ds
(
null
);
setSqlDecryptFi
le
ds
(
null
);
setSqlDecryptFi
el
ds
(
null
);
setEntityFi
le
ds
(
null
);
setEntityFi
el
ds
(
null
);
setSqlSingleEncryptFi
le
ds
(
null
);
setSqlSingleEncryptFi
el
ds
(
null
);
setSqlSingleDecryptFi
le
ds
(
null
);
setSqlSingleDecryptFi
el
ds
(
null
);
setInterfaceEncryptList
(
null
);
setInterfaceEncryptList
(
null
);
setInterfaceSm2DecodeKey
(
null
);
setInterfaceSm2DecodeKey
(
null
);
setInterfaceSm2EncodeKey
(
null
);
setInterfaceSm2EncodeKey
(
null
);
...
@@ -177,25 +177,25 @@ public class DbEncryptXmlConfig {
...
@@ -177,25 +177,25 @@ public class DbEncryptXmlConfig {
return
this
.
interfaceEncryptList
;
return
this
.
interfaceEncryptList
;
}
else
{
}
else
{
List
<
String
>
list
=
new
ArrayList
<
String
>();
List
<
String
>
list
=
new
ArrayList
<
String
>();
list
=
getFieldsInOneFi
le
d
(
"IneterfaceEcnrypt"
,
"patternUrl"
);
list
=
getFieldsInOneFi
el
d
(
"IneterfaceEcnrypt"
,
"patternUrl"
);
this
.
interfaceEncryptList
=
list
;
this
.
interfaceEncryptList
=
list
;
return
list
;
return
list
;
}
}
}
}
public
List
<
String
>
getSqlSingleEncryptFi
le
ds
(){
public
List
<
String
>
getSqlSingleEncryptFi
el
ds
(){
if
(
CollectionUtils
.
isNotEmpty
(
this
.
sqlSingleEncryptFi
le
ds
)){
if
(
CollectionUtils
.
isNotEmpty
(
this
.
sqlSingleEncryptFi
el
ds
)){
return
this
.
sqlSingleEncryptFi
le
ds
;
return
this
.
sqlSingleEncryptFi
el
ds
;
}
else
{
}
else
{
this
.
sqlSingleEncryptFi
leds
=
getArrFields
(
"SqlSingleEncryptFile
ds"
);
this
.
sqlSingleEncryptFi
elds
=
getArrFields
(
"SqlSingleEncryptFiel
ds"
);
return
this
.
sqlSingleEncryptFi
le
ds
;
return
this
.
sqlSingleEncryptFi
el
ds
;
}
}
}
}
public
List
<
String
>
getSqlSingleDecryptFi
le
ds
(){
public
List
<
String
>
getSqlSingleDecryptFi
el
ds
(){
if
(
CollectionUtils
.
isNotEmpty
(
this
.
sqlSingleDecryptFi
le
ds
)){
if
(
CollectionUtils
.
isNotEmpty
(
this
.
sqlSingleDecryptFi
el
ds
)){
return
this
.
sqlSingleDecryptFi
le
ds
;
return
this
.
sqlSingleDecryptFi
el
ds
;
}
else
{
}
else
{
this
.
sqlSingleDecryptFi
leds
=
getArrFields
(
"SqlSingleDecryptFile
ds"
);
this
.
sqlSingleDecryptFi
elds
=
getArrFields
(
"SqlSingleDecryptFiel
ds"
);
return
this
.
sqlSingleDecryptFi
le
ds
;
return
this
.
sqlSingleDecryptFi
el
ds
;
}
}
}
}
...
@@ -249,80 +249,80 @@ public class DbEncryptXmlConfig {
...
@@ -249,80 +249,80 @@ public class DbEncryptXmlConfig {
return
globalDisableEntityFields
;
return
globalDisableEntityFields
;
}
}
public
List
<
Map
>
getSqlFi
le
ds
()
{
public
List
<
Map
>
getSqlFi
el
ds
()
{
if
(
sqlFi
le
ds
==
null
){
if
(
sqlFi
el
ds
==
null
){
List
<
String
>
getSqlFi
ledsList
=
getArrFields
(
"SqlFile
ds"
);
List
<
String
>
getSqlFi
eldsList
=
getArrFields
(
"SqlFiel
ds"
);
if
(
CollectionUtils
.
isNotEmpty
(
getSqlFi
le
dsList
)){
if
(
CollectionUtils
.
isNotEmpty
(
getSqlFi
el
dsList
)){
sqlFi
le
ds
=
new
ArrayList
<
Map
>();
sqlFi
el
ds
=
new
ArrayList
<
Map
>();
for
(
String
s
:
getSqlFi
le
dsList
)
{
for
(
String
s
:
getSqlFi
el
dsList
)
{
int
i
=
s
.
lastIndexOf
(
"."
);
int
i
=
s
.
lastIndexOf
(
"."
);
String
mapid
=
s
.
substring
(
0
,
i
);
String
mapid
=
s
.
substring
(
0
,
i
);
String
fieldName
=
s
.
substring
(
i
+
1
);
String
fieldName
=
s
.
substring
(
i
+
1
);
Map
sqlFi
le
dsMap
=
new
HashMap
<
String
,
Object
>();
Map
sqlFi
el
dsMap
=
new
HashMap
<
String
,
Object
>();
sqlFi
le
dsMap
.
put
(
"mapid"
,
mapid
);
sqlFi
el
dsMap
.
put
(
"mapid"
,
mapid
);
sqlFi
le
dsMap
.
put
(
"field"
,
fieldName
);
sqlFi
el
dsMap
.
put
(
"field"
,
fieldName
);
sqlFi
leds
.
add
(
sqlFile
dsMap
);
sqlFi
elds
.
add
(
sqlFiel
dsMap
);
}
}
}
}
}
}
return
sqlFi
le
ds
;
return
sqlFi
el
ds
;
}
}
public
List
<
Map
>
getSqlEncryptFi
le
ds
()
{
public
List
<
Map
>
getSqlEncryptFi
el
ds
()
{
if
(
sqlEncryptFi
le
ds
==
null
){
if
(
sqlEncryptFi
el
ds
==
null
){
List
<
String
>
getSqlEncryptFi
ledsList
=
getArrFields
(
"SqlEncryptFile
ds"
);
List
<
String
>
getSqlEncryptFi
eldsList
=
getArrFields
(
"SqlEncryptFiel
ds"
);
if
(
CollectionUtils
.
isNotEmpty
(
getSqlEncryptFi
le
dsList
)){
if
(
CollectionUtils
.
isNotEmpty
(
getSqlEncryptFi
el
dsList
)){
sqlEncryptFi
le
ds
=
new
ArrayList
<
Map
>();
sqlEncryptFi
el
ds
=
new
ArrayList
<
Map
>();
for
(
String
s
:
getSqlEncryptFi
le
dsList
)
{
for
(
String
s
:
getSqlEncryptFi
el
dsList
)
{
int
i
=
s
.
lastIndexOf
(
"."
);
int
i
=
s
.
lastIndexOf
(
"."
);
String
mapid
=
s
.
substring
(
0
,
i
);
String
mapid
=
s
.
substring
(
0
,
i
);
String
fieldName
=
s
.
substring
(
i
+
1
);
String
fieldName
=
s
.
substring
(
i
+
1
);
Map
sqlEncryptFi
le
dsMap
=
new
HashMap
<
String
,
Object
>();
Map
sqlEncryptFi
el
dsMap
=
new
HashMap
<
String
,
Object
>();
sqlEncryptFi
le
dsMap
.
put
(
"mapid"
,
mapid
);
sqlEncryptFi
el
dsMap
.
put
(
"mapid"
,
mapid
);
sqlEncryptFi
le
dsMap
.
put
(
"field"
,
fieldName
);
sqlEncryptFi
el
dsMap
.
put
(
"field"
,
fieldName
);
sqlEncryptFi
leds
.
add
(
sqlEncryptFile
dsMap
);
sqlEncryptFi
elds
.
add
(
sqlEncryptFiel
dsMap
);
}
}
}
}
}
}
return
sqlEncryptFi
le
ds
;
return
sqlEncryptFi
el
ds
;
}
}
public
List
<
Map
>
getSqlDecryptFi
le
ds
()
{
public
List
<
Map
>
getSqlDecryptFi
el
ds
()
{
if
(
sqlDecryptFi
le
ds
==
null
){
if
(
sqlDecryptFi
el
ds
==
null
){
List
<
String
>
getSqlDecryptFi
ledsList
=
getArrFields
(
"SqlDecryptFile
ds"
);
List
<
String
>
getSqlDecryptFi
eldsList
=
getArrFields
(
"SqlDecryptFiel
ds"
);
if
(
CollectionUtils
.
isNotEmpty
(
getSqlDecryptFi
le
dsList
)){
if
(
CollectionUtils
.
isNotEmpty
(
getSqlDecryptFi
el
dsList
)){
sqlDecryptFi
le
ds
=
new
ArrayList
<
Map
>();
sqlDecryptFi
el
ds
=
new
ArrayList
<
Map
>();
for
(
String
s
:
getSqlDecryptFi
le
dsList
)
{
for
(
String
s
:
getSqlDecryptFi
el
dsList
)
{
int
i
=
s
.
lastIndexOf
(
"."
);
int
i
=
s
.
lastIndexOf
(
"."
);
String
mapid
=
s
.
substring
(
0
,
i
);
String
mapid
=
s
.
substring
(
0
,
i
);
String
fieldName
=
s
.
substring
(
i
+
1
);
String
fieldName
=
s
.
substring
(
i
+
1
);
Map
sqlDecryptFi
le
dsMap
=
new
HashMap
<
String
,
Object
>();
Map
sqlDecryptFi
el
dsMap
=
new
HashMap
<
String
,
Object
>();
sqlDecryptFi
le
dsMap
.
put
(
"mapid"
,
mapid
);
sqlDecryptFi
el
dsMap
.
put
(
"mapid"
,
mapid
);
sqlDecryptFi
le
dsMap
.
put
(
"field"
,
fieldName
);
sqlDecryptFi
el
dsMap
.
put
(
"field"
,
fieldName
);
sqlDecryptFi
leds
.
add
(
sqlDecryptFile
dsMap
);
sqlDecryptFi
elds
.
add
(
sqlDecryptFiel
dsMap
);
}
}
}
}
}
}
return
sqlDecryptFi
le
ds
;
return
sqlDecryptFi
el
ds
;
}
}
public
List
<
Map
>
getEntityFi
le
ds
()
{
public
List
<
Map
>
getEntityFi
el
ds
()
{
if
(
entityFi
le
ds
==
null
){
if
(
entityFi
el
ds
==
null
){
List
<
String
>
getEntityFi
ledsList
=
getArrFields
(
"EntityFile
ds"
);
List
<
String
>
getEntityFi
eldsList
=
getArrFields
(
"EntityFiel
ds"
);
if
(
CollectionUtils
.
isNotEmpty
(
getEntityFi
le
dsList
)){
if
(
CollectionUtils
.
isNotEmpty
(
getEntityFi
el
dsList
)){
entityFi
le
ds
=
new
ArrayList
<
Map
>();
entityFi
el
ds
=
new
ArrayList
<
Map
>();
for
(
String
s
:
getEntityFi
le
dsList
)
{
for
(
String
s
:
getEntityFi
el
dsList
)
{
int
i
=
s
.
lastIndexOf
(
"."
);
int
i
=
s
.
lastIndexOf
(
"."
);
String
mapid
=
s
.
substring
(
0
,
i
);
String
mapid
=
s
.
substring
(
0
,
i
);
String
fieldName
=
s
.
substring
(
i
+
1
);
String
fieldName
=
s
.
substring
(
i
+
1
);
Map
entityFi
le
dsMap
=
new
HashMap
<
String
,
Object
>();
Map
entityFi
el
dsMap
=
new
HashMap
<
String
,
Object
>();
entityFi
le
dsMap
.
put
(
"entity"
,
mapid
);
entityFi
el
dsMap
.
put
(
"entity"
,
mapid
);
entityFi
le
dsMap
.
put
(
"field"
,
fieldName
);
entityFi
el
dsMap
.
put
(
"field"
,
fieldName
);
entityFi
leds
.
add
(
entityFile
dsMap
);
entityFi
elds
.
add
(
entityFiel
dsMap
);
}
}
}
}
}
}
return
entityFi
le
ds
;
return
entityFi
el
ds
;
}
}
...
@@ -361,7 +361,7 @@ public class DbEncryptXmlConfig {
...
@@ -361,7 +361,7 @@ public class DbEncryptXmlConfig {
}
}
return
result
;
return
result
;
}
}
public
List
<
String
>
getFieldsInOneFi
le
d
(
String
fieldName
,
String
secondFieldName
){
public
List
<
String
>
getFieldsInOneFi
el
d
(
String
fieldName
,
String
secondFieldName
){
SAXReader
sr
=
new
SAXReader
();
SAXReader
sr
=
new
SAXReader
();
Document
document
=
null
;
Document
document
=
null
;
List
<
String
>
result
=
new
ArrayList
<
String
>();
List
<
String
>
result
=
new
ArrayList
<
String
>();
...
@@ -451,7 +451,7 @@ public class DbEncryptXmlConfig {
...
@@ -451,7 +451,7 @@ public class DbEncryptXmlConfig {
/**
/**
* 从java文件中读取预置的加解密字段
* 从java文件中读取预置的加解密字段
*/
*/
public
void
addBaseConfigFi
le
ds
()
{
public
void
addBaseConfigFi
el
ds
()
{
List
<
String
>
baseConfigOptions
=
this
.
getBaseConfigOptions
();
List
<
String
>
baseConfigOptions
=
this
.
getBaseConfigOptions
();
if
(
CollectionUtils
.
isNotEmpty
(
baseConfig
)){
if
(
CollectionUtils
.
isNotEmpty
(
baseConfig
)){
for
(
BaseConfig
config
:
baseConfig
)
{
for
(
BaseConfig
config
:
baseConfig
)
{
...
@@ -466,46 +466,46 @@ public class DbEncryptXmlConfig {
...
@@ -466,46 +466,46 @@ public class DbEncryptXmlConfig {
globalEnableFields
.
addAll
(
config
.
getGlobalEnableFields
());
globalEnableFields
.
addAll
(
config
.
getGlobalEnableFields
());
}
}
//预置的sql加解密字段(正向配置)
//预置的sql加解密字段(正向配置)
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getSqlFi
le
ds
())){
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getSqlFi
el
ds
())){
if
(
CollectionUtils
.
isEmpty
(
sqlFi
le
ds
)){
if
(
CollectionUtils
.
isEmpty
(
sqlFi
el
ds
)){
sqlFi
le
ds
=
new
ArrayList
<
Map
>();
sqlFi
el
ds
=
new
ArrayList
<
Map
>();
}
}
sqlFi
leds
.
addAll
(
config
.
getSqlFile
ds
());
sqlFi
elds
.
addAll
(
config
.
getSqlFiel
ds
());
}
}
//预置的sql加密字段(正向配置)
//预置的sql加密字段(正向配置)
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getSqlEncryptFi
le
ds
())){
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getSqlEncryptFi
el
ds
())){
if
(
CollectionUtils
.
isEmpty
(
sqlEncryptFi
le
ds
)){
if
(
CollectionUtils
.
isEmpty
(
sqlEncryptFi
el
ds
)){
sqlEncryptFi
le
ds
=
new
ArrayList
<
Map
>();
sqlEncryptFi
el
ds
=
new
ArrayList
<
Map
>();
}
}
sqlEncryptFi
leds
.
addAll
(
config
.
getSqlEncryptFile
ds
());
sqlEncryptFi
elds
.
addAll
(
config
.
getSqlEncryptFiel
ds
());
}
}
//预置的sql解密字段(正向配置)
//预置的sql解密字段(正向配置)
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getSqlDecryptFi
le
ds
())){
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getSqlDecryptFi
el
ds
())){
if
(
CollectionUtils
.
isEmpty
(
sqlDecryptFi
le
ds
)){
if
(
CollectionUtils
.
isEmpty
(
sqlDecryptFi
el
ds
)){
sqlDecryptFi
le
ds
=
new
ArrayList
<
Map
>();
sqlDecryptFi
el
ds
=
new
ArrayList
<
Map
>();
}
}
sqlDecryptFi
leds
.
addAll
(
config
.
getSqlDecryptFile
ds
());
sqlDecryptFi
elds
.
addAll
(
config
.
getSqlDecryptFiel
ds
());
}
}
//预置的实体加解密字段(正向配置)
//预置的实体加解密字段(正向配置)
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getEntityFi
le
ds
())){
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getEntityFi
el
ds
())){
if
(
CollectionUtils
.
isEmpty
(
entityFi
le
ds
)){
if
(
CollectionUtils
.
isEmpty
(
entityFi
el
ds
)){
entityFi
le
ds
=
new
ArrayList
<
Map
>();
entityFi
el
ds
=
new
ArrayList
<
Map
>();
}
}
entityFi
leds
.
addAll
(
config
.
getEntityFile
ds
());
entityFi
elds
.
addAll
(
config
.
getEntityFiel
ds
());
}
}
//单一string作为参数加密(正向配置)
//单一string作为参数加密(正向配置)
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getSqlSingleEncryptFi
le
ds
())){
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getSqlSingleEncryptFi
el
ds
())){
if
(
CollectionUtils
.
isEmpty
(
sqlSingleEncryptFi
le
ds
)){
if
(
CollectionUtils
.
isEmpty
(
sqlSingleEncryptFi
el
ds
)){
sqlSingleEncryptFi
le
ds
=
new
ArrayList
<
String
>();
sqlSingleEncryptFi
el
ds
=
new
ArrayList
<
String
>();
}
}
sqlSingleEncryptFi
leds
.
addAll
(
config
.
getSqlSingleEncryptFile
ds
());
sqlSingleEncryptFi
elds
.
addAll
(
config
.
getSqlSingleEncryptFiel
ds
());
}
}
//单一string作为返回值解密(正向配置)
//单一string作为返回值解密(正向配置)
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getSqlSingleDecryptFi
le
ds
())){
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getSqlSingleDecryptFi
el
ds
())){
if
(
CollectionUtils
.
isEmpty
(
sqlSingleDecryptFi
le
ds
)){
if
(
CollectionUtils
.
isEmpty
(
sqlSingleDecryptFi
el
ds
)){
sqlSingleDecryptFi
le
ds
=
new
ArrayList
<
String
>();
sqlSingleDecryptFi
el
ds
=
new
ArrayList
<
String
>();
}
}
sqlSingleDecryptFi
leds
.
addAll
(
config
.
getSqlSingleDecryptFile
ds
());
sqlSingleDecryptFi
elds
.
addAll
(
config
.
getSqlSingleDecryptFiel
ds
());
}
}
//全局加密字段在sql中的反向配置(配置在其中的不进行加解密处理) 反向配置
//全局加密字段在sql中的反向配置(配置在其中的不进行加解密处理) 反向配置
//不需要做特殊处理逻辑,因为在判断是否为加解密字段时,判断顺序为:是否为全局加解密字段-》是否为全局非加解密字段-》是否为加解密字段,所以是否为加解密字段本身优先级高于全局配置,不需要在此处根据已有的是否为加解密字段配置调整是否为全局非加解密字段
//不需要做特殊处理逻辑,因为在判断是否为加解密字段时,判断顺序为:是否为全局加解密字段-》是否为全局非加解密字段-》是否为加解密字段,所以是否为加解密字段本身优先级高于全局配置,不需要在此处根据已有的是否为加解密字段配置调整是否为全局非加解密字段
...
@@ -571,7 +571,7 @@ public class DbEncryptXmlConfig {
...
@@ -571,7 +571,7 @@ public class DbEncryptXmlConfig {
this
.
annoSqlPackage
=
annoSqlPackage
;
this
.
annoSqlPackage
=
annoSqlPackage
;
}
}
public
void
addAnnotationConfigFi
le
ds
()
{
public
void
addAnnotationConfigFi
el
ds
()
{
long
begin
=
System
.
currentTimeMillis
();
long
begin
=
System
.
currentTimeMillis
();
//获取注解加解密总开关
//获取注解加解密总开关
if
(!
isAnnoEnable
()){
if
(!
isAnnoEnable
()){
...
@@ -589,7 +589,7 @@ public class DbEncryptXmlConfig {
...
@@ -589,7 +589,7 @@ public class DbEncryptXmlConfig {
.
setUrls
(
ClasspathHelper
.
forPackage
(
annoEntityPackage
))
.
setUrls
(
ClasspathHelper
.
forPackage
(
annoEntityPackage
))
.
addScanners
(
new
FieldAnnotationsScanner
()));
.
addScanners
(
new
FieldAnnotationsScanner
()));
Set
<
Field
>
encryptAnnoFields
=
ref
.
getFieldsAnnotatedWith
(
Encrypt
.
class
);
Set
<
Field
>
encryptAnnoFields
=
ref
.
getFieldsAnnotatedWith
(
Encrypt
.
class
);
List
<
Map
>
annoEntityFi
le
ds
=
new
ArrayList
<
Map
>();
List
<
Map
>
annoEntityFi
el
ds
=
new
ArrayList
<
Map
>();
if
(
CollectionUtils
.
isNotEmpty
(
encryptAnnoFields
))
{
if
(
CollectionUtils
.
isNotEmpty
(
encryptAnnoFields
))
{
for
(
Field
field
:
encryptAnnoFields
)
{
for
(
Field
field
:
encryptAnnoFields
)
{
Encrypt
annotation
=
field
.
getAnnotation
(
Encrypt
.
class
);
Encrypt
annotation
=
field
.
getAnnotation
(
Encrypt
.
class
);
...
@@ -604,14 +604,14 @@ public class DbEncryptXmlConfig {
...
@@ -604,14 +604,14 @@ public class DbEncryptXmlConfig {
Map
map
=
new
HashMap
<
String
,
Object
>();
Map
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"entity"
,
className
);
map
.
put
(
"entity"
,
className
);
map
.
put
(
"field"
,
field
.
getName
());
map
.
put
(
"field"
,
field
.
getName
());
annoEntityFi
le
ds
.
add
(
map
);
annoEntityFi
el
ds
.
add
(
map
);
}
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
annoEntityFi
le
ds
))
{
if
(
CollectionUtils
.
isNotEmpty
(
annoEntityFi
el
ds
))
{
if
(
CollectionUtils
.
isEmpty
(
entityFi
le
ds
))
{
if
(
CollectionUtils
.
isEmpty
(
entityFi
el
ds
))
{
entityFi
le
ds
=
new
ArrayList
<
Map
>();
entityFi
el
ds
=
new
ArrayList
<
Map
>();
}
}
entityFi
leds
.
addAll
(
annoEntityFile
ds
);
entityFi
elds
.
addAll
(
annoEntityFiel
ds
);
}
}
}
}
...
@@ -632,21 +632,21 @@ public class DbEncryptXmlConfig {
...
@@ -632,21 +632,21 @@ public class DbEncryptXmlConfig {
return
;
return
;
}
}
//sql加解密字段
//sql加解密字段
List
<
Map
>
annoSqlFi
le
ds
=
new
ArrayList
<
Map
>();
List
<
Map
>
annoSqlFi
el
ds
=
new
ArrayList
<
Map
>();
//sql仅加密字段
//sql仅加密字段
List
<
Map
>
annoSqlEncryptFi
le
ds
=
new
ArrayList
<
Map
>();
List
<
Map
>
annoSqlEncryptFi
el
ds
=
new
ArrayList
<
Map
>();
//sql仅解密字段
//sql仅解密字段
List
<
Map
>
annoSqlDecryptFi
le
ds
=
new
ArrayList
<
Map
>();
List
<
Map
>
annoSqlDecryptFi
el
ds
=
new
ArrayList
<
Map
>();
//sql参数为单独的string,对参数加密(等价于注解)
//sql参数为单独的string,对参数加密(等价于注解)
List
<
String
>
annoSqlSingleEncryptFi
le
ds
=
new
ArrayList
<
String
>();
List
<
String
>
annoSqlSingleEncryptFi
el
ds
=
new
ArrayList
<
String
>();
//sql返回值为单独的string,对返回值加密(等价于注解)
//sql返回值为单独的string,对返回值加密(等价于注解)
List
<
String
>
annoSqlSingleDecryptFi
le
ds
=
new
ArrayList
<
String
>();
List
<
String
>
annoSqlSingleDecryptFi
el
ds
=
new
ArrayList
<
String
>();
//处理方法上的Encrypt注解
//处理方法上的Encrypt注解
if
(
CollectionUtils
.
isNotEmpty
(
enctyptMethods
)){
if
(
CollectionUtils
.
isNotEmpty
(
enctyptMethods
)){
for
(
Method
method
:
enctyptMethods
)
{
for
(
Method
method
:
enctyptMethods
)
{
Encrypt
annotation
=
method
.
getAnnotation
(
Encrypt
.
class
);
Encrypt
annotation
=
method
.
getAnnotation
(
Encrypt
.
class
);
getFieldsFromAnno
(
annoSqlFi
leds
,
annoSqlEncryptFileds
,
annoSqlDecryptFileds
,
annoSqlSingleEncryptFile
ds
,
getFieldsFromAnno
(
annoSqlFi
elds
,
annoSqlEncryptFields
,
annoSqlDecryptFields
,
annoSqlSingleEncryptFiel
ds
,
annoSqlSingleDecryptFi
le
ds
,
method
,
annotation
);
annoSqlSingleDecryptFi
el
ds
,
method
,
annotation
);
}
}
}
}
//处理方法上的Encrypts注解
//处理方法上的Encrypts注解
...
@@ -656,46 +656,46 @@ public class DbEncryptXmlConfig {
...
@@ -656,46 +656,46 @@ public class DbEncryptXmlConfig {
Encrypt
[]
value
=
annotation
.
value
();
Encrypt
[]
value
=
annotation
.
value
();
if
(
value
!=
null
&&
value
.
length
>
0
){
if
(
value
!=
null
&&
value
.
length
>
0
){
for
(
Encrypt
encrypt
:
value
)
{
for
(
Encrypt
encrypt
:
value
)
{
getFieldsFromAnno
(
annoSqlFi
leds
,
annoSqlEncryptFileds
,
annoSqlDecryptFileds
,
annoSqlSingleEncryptFile
ds
,
getFieldsFromAnno
(
annoSqlFi
elds
,
annoSqlEncryptFields
,
annoSqlDecryptFields
,
annoSqlSingleEncryptFiel
ds
,
annoSqlSingleDecryptFi
le
ds
,
method
,
encrypt
);
annoSqlSingleDecryptFi
el
ds
,
method
,
encrypt
);
}
}
}
}
}
}
}
}
//预置的sql加解密字段(正向配置)
//预置的sql加解密字段(正向配置)
if
(
CollectionUtils
.
isNotEmpty
(
annoSqlFi
le
ds
)){
if
(
CollectionUtils
.
isNotEmpty
(
annoSqlFi
el
ds
)){
if
(
CollectionUtils
.
isEmpty
(
sqlFi
le
ds
)){
if
(
CollectionUtils
.
isEmpty
(
sqlFi
el
ds
)){
sqlFi
le
ds
=
new
ArrayList
<
Map
>();
sqlFi
el
ds
=
new
ArrayList
<
Map
>();
}
}
sqlFi
leds
.
addAll
(
annoSqlFile
ds
);
sqlFi
elds
.
addAll
(
annoSqlFiel
ds
);
}
}
//预置的sql加密字段(正向配置)
//预置的sql加密字段(正向配置)
if
(
CollectionUtils
.
isNotEmpty
(
annoSqlEncryptFi
le
ds
)){
if
(
CollectionUtils
.
isNotEmpty
(
annoSqlEncryptFi
el
ds
)){
if
(
CollectionUtils
.
isEmpty
(
sqlEncryptFi
le
ds
)){
if
(
CollectionUtils
.
isEmpty
(
sqlEncryptFi
el
ds
)){
sqlEncryptFi
le
ds
=
new
ArrayList
<
Map
>();
sqlEncryptFi
el
ds
=
new
ArrayList
<
Map
>();
}
}
sqlEncryptFi
leds
.
addAll
(
annoSqlEncryptFile
ds
);
sqlEncryptFi
elds
.
addAll
(
annoSqlEncryptFiel
ds
);
}
}
//预置的sql解密字段(正向配置)
//预置的sql解密字段(正向配置)
if
(
CollectionUtils
.
isNotEmpty
(
annoSqlDecryptFi
le
ds
)){
if
(
CollectionUtils
.
isNotEmpty
(
annoSqlDecryptFi
el
ds
)){
if
(
CollectionUtils
.
isEmpty
(
sqlDecryptFi
le
ds
)){
if
(
CollectionUtils
.
isEmpty
(
sqlDecryptFi
el
ds
)){
sqlDecryptFi
le
ds
=
new
ArrayList
<
Map
>();
sqlDecryptFi
el
ds
=
new
ArrayList
<
Map
>();
}
}
sqlDecryptFi
leds
.
addAll
(
annoSqlDecryptFile
ds
);
sqlDecryptFi
elds
.
addAll
(
annoSqlDecryptFiel
ds
);
}
}
//单一string作为参数加密(正向配置)
//单一string作为参数加密(正向配置)
if
(
CollectionUtils
.
isNotEmpty
(
annoSqlSingleEncryptFi
le
ds
)){
if
(
CollectionUtils
.
isNotEmpty
(
annoSqlSingleEncryptFi
el
ds
)){
if
(
CollectionUtils
.
isEmpty
(
sqlSingleEncryptFi
le
ds
)){
if
(
CollectionUtils
.
isEmpty
(
sqlSingleEncryptFi
el
ds
)){
sqlSingleEncryptFi
le
ds
=
new
ArrayList
<
String
>();
sqlSingleEncryptFi
el
ds
=
new
ArrayList
<
String
>();
}
}
sqlSingleEncryptFi
leds
.
addAll
(
annoSqlSingleEncryptFile
ds
);
sqlSingleEncryptFi
elds
.
addAll
(
annoSqlSingleEncryptFiel
ds
);
}
}
//单一string作为返回值解密(正向配置)
//单一string作为返回值解密(正向配置)
if
(
CollectionUtils
.
isNotEmpty
(
annoSqlSingleDecryptFi
le
ds
)){
if
(
CollectionUtils
.
isNotEmpty
(
annoSqlSingleDecryptFi
el
ds
)){
if
(
CollectionUtils
.
isEmpty
(
sqlSingleDecryptFi
le
ds
)){
if
(
CollectionUtils
.
isEmpty
(
sqlSingleDecryptFi
el
ds
)){
sqlSingleDecryptFi
le
ds
=
new
ArrayList
<
String
>();
sqlSingleDecryptFi
el
ds
=
new
ArrayList
<
String
>();
}
}
sqlSingleDecryptFi
leds
.
addAll
(
annoSqlSingleDecryptFile
ds
);
sqlSingleDecryptFi
elds
.
addAll
(
annoSqlSingleDecryptFiel
ds
);
}
}
long
end
=
System
.
currentTimeMillis
();
long
end
=
System
.
currentTimeMillis
();
LOGGER
.
error
(
"anno scan used time:"
+(
end
-
begin
));
LOGGER
.
error
(
"anno scan used time:"
+(
end
-
begin
));
...
@@ -704,63 +704,63 @@ public class DbEncryptXmlConfig {
...
@@ -704,63 +704,63 @@ public class DbEncryptXmlConfig {
/**
/**
* 同时提供方法和注解参数,便于代码的复用
* 同时提供方法和注解参数,便于代码的复用
* @param annoSqlFi
le
ds
* @param annoSqlFi
el
ds
* @param annoSqlEncryptFi
le
ds
* @param annoSqlEncryptFi
el
ds
* @param annoSqlDecryptFi
le
ds
* @param annoSqlDecryptFi
el
ds
* @param annoSqlSingleEncryptFi
le
ds
* @param annoSqlSingleEncryptFi
el
ds
* @param annoSqlSingleDecryptFi
le
ds
* @param annoSqlSingleDecryptFi
el
ds
* @param method
* @param method
* @param annotation
* @param annotation
*/
*/
private
void
getFieldsFromAnno
(
List
<
Map
>
annoSqlFi
leds
,
List
<
Map
>
annoSqlEncryptFileds
,
List
<
Map
>
annoSqlDecryptFile
ds
,
private
void
getFieldsFromAnno
(
List
<
Map
>
annoSqlFi
elds
,
List
<
Map
>
annoSqlEncryptFields
,
List
<
Map
>
annoSqlDecryptFiel
ds
,
List
<
String
>
annoSqlSingleEncryptFi
leds
,
List
<
String
>
annoSqlSingleDecryptFile
ds
,
Method
method
,
Encrypt
annotation
){
List
<
String
>
annoSqlSingleEncryptFi
elds
,
List
<
String
>
annoSqlSingleDecryptFiel
ds
,
Method
method
,
Encrypt
annotation
){
if
(
annotation
==
null
||
!
annoGroupNames
.
contains
(
annotation
.
group
())){
if
(
annotation
==
null
||
!
annoGroupNames
.
contains
(
annotation
.
group
())){
return
;
return
;
}
}
String
className
=
method
.
getDeclaringClass
().
getName
();
String
className
=
method
.
getDeclaringClass
().
getName
();
String
fileds
=
annotation
.
file
ds
();
//注解的加解密属性处理
String
Fields
=
annotation
.
fiel
ds
();
//注解的加解密属性处理
if
(
StringUtils
.
isNotBlank
(
file
ds
)){
if
(
StringUtils
.
isNotBlank
(
Fiel
ds
)){
String
[]
split
=
file
ds
.
split
(
","
);
String
[]
split
=
Fiel
ds
.
split
(
","
);
if
(
split
!=
null
&&
split
.
length
>
0
){
if
(
split
!=
null
&&
split
.
length
>
0
){
for
(
String
s
:
split
)
{
for
(
String
s
:
split
)
{
Map
sqlFi
le
dMap
=
new
HashMap
<
String
,
Object
>();
Map
sqlFi
el
dMap
=
new
HashMap
<
String
,
Object
>();
sqlFi
le
dMap
.
put
(
"mapid"
,
className
+
"."
+
method
.
getName
());
sqlFi
el
dMap
.
put
(
"mapid"
,
className
+
"."
+
method
.
getName
());
sqlFi
le
dMap
.
put
(
"field"
,
s
);
sqlFi
el
dMap
.
put
(
"field"
,
s
);
annoSqlFi
leds
.
add
(
sqlFiledMap
);
annoSqlFi
elds
.
add
(
sqlFieldMap
);
}
}
}
}
}
}
String
encodeFi
leds
=
annotation
.
encodeFile
ds
();
//注解的加密属性处理
String
encodeFi
elds
=
annotation
.
encodeFiel
ds
();
//注解的加密属性处理
if
(
StringUtils
.
isNotBlank
(
encodeFi
le
ds
)){
if
(
StringUtils
.
isNotBlank
(
encodeFi
el
ds
)){
String
[]
split
=
encodeFi
le
ds
.
split
(
","
);
String
[]
split
=
encodeFi
el
ds
.
split
(
","
);
if
(
split
!=
null
&&
split
.
length
>
0
){
if
(
split
!=
null
&&
split
.
length
>
0
){
for
(
String
s
:
split
)
{
for
(
String
s
:
split
)
{
Map
sqlEncryptFi
le
dMap
=
new
HashMap
<
String
,
Object
>();
Map
sqlEncryptFi
el
dMap
=
new
HashMap
<
String
,
Object
>();
sqlEncryptFi
le
dMap
.
put
(
"mapid"
,
className
+
"."
+
method
.
getName
());
sqlEncryptFi
el
dMap
.
put
(
"mapid"
,
className
+
"."
+
method
.
getName
());
sqlEncryptFi
le
dMap
.
put
(
"field"
,
s
);
sqlEncryptFi
el
dMap
.
put
(
"field"
,
s
);
annoSqlEncryptFi
leds
.
add
(
sqlEncryptFile
dMap
);
annoSqlEncryptFi
elds
.
add
(
sqlEncryptFiel
dMap
);
}
}
}
}
}
}
String
decodeFi
leds
=
annotation
.
decodeFile
ds
();
//注解的解密属性处理
String
decodeFi
elds
=
annotation
.
decodeFiel
ds
();
//注解的解密属性处理
if
(
StringUtils
.
isNotBlank
(
decodeFi
le
ds
)){
if
(
StringUtils
.
isNotBlank
(
decodeFi
el
ds
)){
String
[]
split
=
decodeFi
le
ds
.
split
(
","
);
String
[]
split
=
decodeFi
el
ds
.
split
(
","
);
if
(
split
!=
null
&&
split
.
length
>
0
)
{
if
(
split
!=
null
&&
split
.
length
>
0
)
{
for
(
String
s
:
split
)
{
for
(
String
s
:
split
)
{
Map
sqlDecryptFi
le
dMap
=
new
HashMap
<
String
,
Object
>();
Map
sqlDecryptFi
el
dMap
=
new
HashMap
<
String
,
Object
>();
sqlDecryptFi
le
dMap
.
put
(
"mapid"
,
className
+
"."
+
method
.
getName
());
sqlDecryptFi
el
dMap
.
put
(
"mapid"
,
className
+
"."
+
method
.
getName
());
sqlDecryptFi
le
dMap
.
put
(
"field"
,
s
);
sqlDecryptFi
el
dMap
.
put
(
"field"
,
s
);
annoSqlDecryptFi
leds
.
add
(
sqlDecryptFile
dMap
);
annoSqlDecryptFi
elds
.
add
(
sqlDecryptFiel
dMap
);
}
}
}
}
}
}
boolean
singleEncrypt
=
annotation
.
singleEncryptFi
le
ds
();
//注解的仅一个参数加密属性
boolean
singleEncrypt
=
annotation
.
singleEncryptFi
el
ds
();
//注解的仅一个参数加密属性
if
(
singleEncrypt
){
if
(
singleEncrypt
){
annoSqlSingleEncryptFi
le
ds
.
add
(
className
+
"."
+
method
.
getName
());
annoSqlSingleEncryptFi
el
ds
.
add
(
className
+
"."
+
method
.
getName
());
}
}
boolean
singleDecrypt
=
annotation
.
singleDecryptFi
le
ds
();
//注解的仅有要给返回值解密属性
boolean
singleDecrypt
=
annotation
.
singleDecryptFi
el
ds
();
//注解的仅有要给返回值解密属性
if
(
singleDecrypt
){
if
(
singleDecrypt
){
annoSqlSingleDecryptFi
le
ds
.
add
(
className
+
"."
+
method
.
getName
());
annoSqlSingleDecryptFi
el
ds
.
add
(
className
+
"."
+
method
.
getName
());
}
}
}
}
}
}
src/main/java/cn/gtmap/bdcdj/core/encrypt/EncryptAdapterBuilder.java
浏览文件 @
452db1e3
...
@@ -122,10 +122,10 @@ public class EncryptAdapterBuilder {
...
@@ -122,10 +122,10 @@ public class EncryptAdapterBuilder {
}
}
}
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
cryptProperties
.
getSqlSingleEncryptFi
le
ds
())){
if
(
CollectionUtils
.
isNotEmpty
(
cryptProperties
.
getSqlSingleEncryptFi
el
ds
())){
for
(
String
fi
led
:
cryptProperties
.
getSqlSingleEncryptFile
ds
())
{
for
(
String
fi
eld
:
cryptProperties
.
getSqlSingleEncryptFiel
ds
())
{
String
name
=
method
.
getDeclaringClass
().
getName
()+
"."
+
method
.
getName
();
String
name
=
method
.
getDeclaringClass
().
getName
()+
"."
+
method
.
getName
();
if
(
StringUtils
.
isNotBlank
(
name
)
&&
name
.
endsWith
(
fi
le
d
)){
if
(
StringUtils
.
isNotBlank
(
name
)
&&
name
.
endsWith
(
fi
el
d
)){
return
true
;
return
true
;
}
}
}
}
...
@@ -166,10 +166,10 @@ public class EncryptAdapterBuilder {
...
@@ -166,10 +166,10 @@ public class EncryptAdapterBuilder {
if
(
annotation
!=
null
){
if
(
annotation
!=
null
){
return
true
;
return
true
;
}
}
if
(
CollectionUtils
.
isNotEmpty
(
cryptProperties
.
getSqlSingleDecryptFi
le
ds
())){
if
(
CollectionUtils
.
isNotEmpty
(
cryptProperties
.
getSqlSingleDecryptFi
el
ds
())){
for
(
String
fi
led
:
cryptProperties
.
getSqlSingleDecryptFile
ds
())
{
for
(
String
fi
eld
:
cryptProperties
.
getSqlSingleDecryptFiel
ds
())
{
String
name
=
method
.
getDeclaringClass
().
getName
()+
"."
+
method
.
getName
();
String
name
=
method
.
getDeclaringClass
().
getName
()+
"."
+
method
.
getName
();
if
(
StringUtils
.
isNotBlank
(
name
)
&&
name
.
endsWith
(
fi
le
d
)){
if
(
StringUtils
.
isNotBlank
(
name
)
&&
name
.
endsWith
(
fi
el
d
)){
return
true
;
return
true
;
}
}
}
}
...
...
src/main/java/cn/gtmap/bdcdj/core/encrypt/EncryptInterceptor.java
浏览文件 @
452db1e3
...
@@ -126,24 +126,24 @@ public class EncryptInterceptor implements Interceptor {
...
@@ -126,24 +126,24 @@ public class EncryptInterceptor implements Interceptor {
dbEncryptXmlConfig
.
getGlobalEnableFields
();
dbEncryptXmlConfig
.
getGlobalEnableFields
();
dbEncryptXmlConfig
.
getGlobalDisableMapFields
();
dbEncryptXmlConfig
.
getGlobalDisableMapFields
();
dbEncryptXmlConfig
.
getGlobalDisableEntityFields
();
dbEncryptXmlConfig
.
getGlobalDisableEntityFields
();
dbEncryptXmlConfig
.
getSqlFi
le
ds
();
dbEncryptXmlConfig
.
getSqlFi
el
ds
();
dbEncryptXmlConfig
.
getSqlEncryptFi
le
ds
();
dbEncryptXmlConfig
.
getSqlEncryptFi
el
ds
();
dbEncryptXmlConfig
.
getSqlDecryptFi
le
ds
();
dbEncryptXmlConfig
.
getSqlDecryptFi
el
ds
();
dbEncryptXmlConfig
.
getEntityFi
le
ds
();
dbEncryptXmlConfig
.
getEntityFi
el
ds
();
dbEncryptXmlConfig
.
getSqlSingleEncryptFi
le
ds
();
dbEncryptXmlConfig
.
getSqlSingleEncryptFi
el
ds
();
dbEncryptXmlConfig
.
getSqlSingleDecryptFi
le
ds
();
dbEncryptXmlConfig
.
getSqlSingleDecryptFi
el
ds
();
//添加预置的字段
//添加预置的字段
dbEncryptXmlConfig
.
addBaseConfigFi
le
ds
();
dbEncryptXmlConfig
.
addBaseConfigFi
el
ds
();
//根据注解获取加解密配置
//根据注解获取加解密配置
dbEncryptXmlConfig
.
addAnnotationConfigFi
le
ds
();
dbEncryptXmlConfig
.
addAnnotationConfigFi
el
ds
();
this
.
cryptProperties
.
setGlobalEnableFields
(
dbEncryptXmlConfig
.
getGlobalEnableFields
());
this
.
cryptProperties
.
setGlobalEnableFields
(
dbEncryptXmlConfig
.
getGlobalEnableFields
());
this
.
cryptProperties
.
setGlobalDisableMapFields
(
dbEncryptXmlConfig
.
getGlobalDisableMapFields
());
this
.
cryptProperties
.
setGlobalDisableMapFields
(
dbEncryptXmlConfig
.
getGlobalDisableMapFields
());
this
.
cryptProperties
.
setGlobalDisableEntityFields
(
dbEncryptXmlConfig
.
getGlobalDisableEntityFields
());
this
.
cryptProperties
.
setGlobalDisableEntityFields
(
dbEncryptXmlConfig
.
getGlobalDisableEntityFields
());
this
.
cryptProperties
.
setSqlFi
leds
(
dbEncryptXmlConfig
.
getSqlFile
ds
());
this
.
cryptProperties
.
setSqlFi
elds
(
dbEncryptXmlConfig
.
getSqlFiel
ds
());
this
.
cryptProperties
.
setSqlEncryptFi
leds
(
dbEncryptXmlConfig
.
getSqlEncryptFile
ds
());
this
.
cryptProperties
.
setSqlEncryptFi
elds
(
dbEncryptXmlConfig
.
getSqlEncryptFiel
ds
());
this
.
cryptProperties
.
setSqlDecryptFi
leds
(
dbEncryptXmlConfig
.
getSqlDecryptFile
ds
());
this
.
cryptProperties
.
setSqlDecryptFi
elds
(
dbEncryptXmlConfig
.
getSqlDecryptFiel
ds
());
this
.
cryptProperties
.
setEntityFi
leds
(
dbEncryptXmlConfig
.
getEntityFile
ds
());
this
.
cryptProperties
.
setEntityFi
elds
(
dbEncryptXmlConfig
.
getEntityFiel
ds
());
this
.
cryptProperties
.
setSqlSingleEncryptFi
leds
(
dbEncryptXmlConfig
.
getSqlSingleEncryptFile
ds
());
this
.
cryptProperties
.
setSqlSingleEncryptFi
elds
(
dbEncryptXmlConfig
.
getSqlSingleEncryptFiel
ds
());
this
.
cryptProperties
.
setSqlSingleDecryptFi
leds
(
dbEncryptXmlConfig
.
getSqlSingleDecryptFile
ds
());
this
.
cryptProperties
.
setSqlSingleDecryptFi
elds
(
dbEncryptXmlConfig
.
getSqlSingleDecryptFiel
ds
());
}
}
}
}
src/main/java/cn/gtmap/bdcdj/core/encrypt/adapter/encrypt/CommonEncryptAdapter.java
浏览文件 @
452db1e3
...
@@ -108,8 +108,8 @@ public class CommonEncryptAdapter implements EncryptAdapter {
...
@@ -108,8 +108,8 @@ public class CommonEncryptAdapter implements EncryptAdapter {
if (MapUtils.isEmpty(cryptFieldMap)) {
if (MapUtils.isEmpty(cryptFieldMap)) {
return param;
return param;
}
}
Map<String, Crypt> needCryptFi
ledMap = this.getNeedCryptFile
dMap(cryptFieldMap, example);
Map<String, Crypt> needCryptFi
eldMap = this.getNeedCryptFiel
dMap(cryptFieldMap, example);
if (MapUtils.isEmpty(needCryptFi
le
dMap)) {
if (MapUtils.isEmpty(needCryptFi
el
dMap)) {
return param;
return param;
}*/
}*/
List
<
String
>
cryptFieldList
=
this
.
getCryptFieldList
(
fields
,
entityclass
);
List
<
String
>
cryptFieldList
=
this
.
getCryptFieldList
(
fields
,
entityclass
);
...
...
src/main/java/cn/gtmap/bdcdj/core/encrypt/annotation/Encrypt.java
浏览文件 @
452db1e3
...
@@ -11,13 +11,13 @@ public @interface Encrypt {
...
@@ -11,13 +11,13 @@ public @interface Encrypt {
//分组 分组之后才能进行加解密
//分组 分组之后才能进行加解密
String
group
();
String
group
();
//方法上使用的字段 对sql中的字段进行加解密
//方法上使用的字段 对sql中的字段进行加解密
String
fi
le
ds
()
default
""
;
String
fi
el
ds
()
default
""
;
//方法上使用的字段 对sql中入参的字段进行加密
//方法上使用的字段 对sql中入参的字段进行加密
String
encodeFi
le
ds
()
default
""
;
String
encodeFi
el
ds
()
default
""
;
//方法上使用的字段 对sql中返回值的字段进行解密
//方法上使用的字段 对sql中返回值的字段进行解密
String
decodeFi
le
ds
()
default
""
;
String
decodeFi
el
ds
()
default
""
;
//方法上使用的字段 在只有一个参数时加密
//方法上使用的字段 在只有一个参数时加密
boolean
singleEncryptFi
le
ds
()
default
false
;
boolean
singleEncryptFi
el
ds
()
default
false
;
//方法上使用的字段 在只有一个参数时解密
//方法上使用的字段 在只有一个参数时解密
boolean
singleDecryptFi
le
ds
()
default
false
;
boolean
singleDecryptFi
el
ds
()
default
false
;
}
}
src/main/java/cn/gtmap/bdcdj/core/encrypt/config/BaseConfig.java
浏览文件 @
452db1e3
...
@@ -11,17 +11,17 @@ public interface BaseConfig {
...
@@ -11,17 +11,17 @@ public interface BaseConfig {
//全局加密字段 正向
//全局加密字段 正向
List
<
String
>
getGlobalEnableFields
();
List
<
String
>
getGlobalEnableFields
();
//sql加解密字段 正向
//sql加解密字段 正向
List
<
Map
>
getSqlFi
le
ds
();
List
<
Map
>
getSqlFi
el
ds
();
//sql加密字段 正向
//sql加密字段 正向
List
<
Map
>
getSqlEncryptFi
le
ds
();
List
<
Map
>
getSqlEncryptFi
el
ds
();
//sql解密字段 正向
//sql解密字段 正向
List
<
Map
>
getSqlDecryptFi
le
ds
();
List
<
Map
>
getSqlDecryptFi
el
ds
();
//实体加解密字段 正向
//实体加解密字段 正向
List
<
Map
>
getEntityFi
le
ds
();
List
<
Map
>
getEntityFi
el
ds
();
//单一string作为参数加密 正向
//单一string作为参数加密 正向
List
<
String
>
getSqlSingleEncryptFi
le
ds
();
List
<
String
>
getSqlSingleEncryptFi
el
ds
();
//单一string作为返回值解密 正向
//单一string作为返回值解密 正向
List
<
String
>
getSqlSingleDecryptFi
le
ds
();
List
<
String
>
getSqlSingleDecryptFi
el
ds
();
//全局加密字段在sql中的反向配置(配置在其中的不进行加解密处理) 反向
//全局加密字段在sql中的反向配置(配置在其中的不进行加解密处理) 反向
List
<
Map
>
getGlobalDisableMapFields
();
List
<
Map
>
getGlobalDisableMapFields
();
...
...
src/main/java/cn/gtmap/bdcdj/core/encrypt/config/QlrConfig.java
浏览文件 @
452db1e3
...
@@ -19,22 +19,22 @@ public class QlrConfig implements BaseConfig {
...
@@ -19,22 +19,22 @@ public class QlrConfig implements BaseConfig {
}
}
@Override
@Override
public
List
<
Map
>
getSqlFi
le
ds
()
{
public
List
<
Map
>
getSqlFi
el
ds
()
{
return
null
;
return
null
;
}
}
@Override
@Override
public
List
<
Map
>
getSqlEncryptFi
le
ds
()
{
public
List
<
Map
>
getSqlEncryptFi
el
ds
()
{
return
null
;
return
null
;
}
}
@Override
@Override
public
List
<
Map
>
getSqlDecryptFi
le
ds
()
{
public
List
<
Map
>
getSqlDecryptFi
el
ds
()
{
return
null
;
return
null
;
}
}
@Override
@Override
public
List
<
Map
>
getEntityFi
le
ds
()
{
public
List
<
Map
>
getEntityFi
el
ds
()
{
List
<
Map
>
result
=
new
ArrayList
<
Map
>();
List
<
Map
>
result
=
new
ArrayList
<
Map
>();
Map
map
=
new
HashMap
<
String
,
Object
>();
Map
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"entity"
,
"cn.gtmap.bdcdj.core.entity.BdcZs"
);
map
.
put
(
"entity"
,
"cn.gtmap.bdcdj.core.entity.BdcZs"
);
...
@@ -44,12 +44,12 @@ public class QlrConfig implements BaseConfig {
...
@@ -44,12 +44,12 @@ public class QlrConfig implements BaseConfig {
}
}
@Override
@Override
public
List
<
String
>
getSqlSingleEncryptFi
le
ds
()
{
public
List
<
String
>
getSqlSingleEncryptFi
el
ds
()
{
return
null
;
return
null
;
}
}
@Override
@Override
public
List
<
String
>
getSqlSingleDecryptFi
le
ds
()
{
public
List
<
String
>
getSqlSingleDecryptFi
el
ds
()
{
return
null
;
return
null
;
}
}
...
...
src/main/java/cn/gtmap/bdcdj/core/encrypt/config/QlrlxdhConfig.java
浏览文件 @
452db1e3
...
@@ -16,32 +16,32 @@ public class QlrlxdhConfig implements BaseConfig{
...
@@ -16,32 +16,32 @@ public class QlrlxdhConfig implements BaseConfig{
}
}
@Override
@Override
public
List
<
Map
>
getSqlFi
le
ds
()
{
public
List
<
Map
>
getSqlFi
el
ds
()
{
return
null
;
return
null
;
}
}
@Override
@Override
public
List
<
Map
>
getSqlEncryptFi
le
ds
()
{
public
List
<
Map
>
getSqlEncryptFi
el
ds
()
{
return
null
;
return
null
;
}
}
@Override
@Override
public
List
<
Map
>
getSqlDecryptFi
le
ds
()
{
public
List
<
Map
>
getSqlDecryptFi
el
ds
()
{
return
null
;
return
null
;
}
}
@Override
@Override
public
List
<
Map
>
getEntityFi
le
ds
()
{
public
List
<
Map
>
getEntityFi
el
ds
()
{
return
null
;
return
null
;
}
}
@Override
@Override
public
List
<
String
>
getSqlSingleEncryptFi
le
ds
()
{
public
List
<
String
>
getSqlSingleEncryptFi
el
ds
()
{
return
null
;
return
null
;
}
}
@Override
@Override
public
List
<
String
>
getSqlSingleDecryptFi
le
ds
()
{
public
List
<
String
>
getSqlSingleDecryptFi
el
ds
()
{
return
null
;
return
null
;
}
}
...
...
src/main/java/cn/gtmap/bdcdj/core/encrypt/config/ZlConfig.java
浏览文件 @
452db1e3
...
@@ -16,32 +16,32 @@ public class ZlConfig implements BaseConfig{
...
@@ -16,32 +16,32 @@ public class ZlConfig implements BaseConfig{
}
}
@Override
@Override
public
List
<
Map
>
getSqlFi
le
ds
()
{
public
List
<
Map
>
getSqlFi
el
ds
()
{
return
null
;
return
null
;
}
}
@Override
@Override
public
List
<
Map
>
getSqlEncryptFi
le
ds
()
{
public
List
<
Map
>
getSqlEncryptFi
el
ds
()
{
return
null
;
return
null
;
}
}
@Override
@Override
public
List
<
Map
>
getSqlDecryptFi
le
ds
()
{
public
List
<
Map
>
getSqlDecryptFi
el
ds
()
{
return
null
;
return
null
;
}
}
@Override
@Override
public
List
<
Map
>
getEntityFi
le
ds
()
{
public
List
<
Map
>
getEntityFi
el
ds
()
{
return
null
;
return
null
;
}
}
@Override
@Override
public
List
<
String
>
getSqlSingleEncryptFi
le
ds
()
{
public
List
<
String
>
getSqlSingleEncryptFi
el
ds
()
{
return
null
;
return
null
;
}
}
@Override
@Override
public
List
<
String
>
getSqlSingleDecryptFi
le
ds
()
{
public
List
<
String
>
getSqlSingleDecryptFi
el
ds
()
{
return
null
;
return
null
;
}
}
...
...
src/main/java/cn/gtmap/bdcdj/core/encrypt/handler/BeanCryptHandler.java
浏览文件 @
452db1e3
...
@@ -31,11 +31,11 @@ public class BeanCryptHandler implements CryptHandler<Object> {
...
@@ -31,11 +31,11 @@ public class BeanCryptHandler implements CryptHandler<Object> {
LOGGER
.
error
(
"BeanCryptHandler.encrypt.getresult"
+
var11
.
getMessage
());
LOGGER
.
error
(
"BeanCryptHandler.encrypt.getresult"
+
var11
.
getMessage
());
}
}
List
<
Field
>
fi
le
dList
=
this
.
getEncryptDecryptFields
(
result
.
getClass
(),
cryptProperties
);
List
<
Field
>
fi
el
dList
=
this
.
getEncryptDecryptFields
(
result
.
getClass
(),
cryptProperties
);
if
(
CollectionUtils
.
isEmpty
(
fi
le
dList
))
{
if
(
CollectionUtils
.
isEmpty
(
fi
el
dList
))
{
return
bean
;
return
bean
;
}
else
{
}
else
{
for
(
Field
field
:
fi
le
dList
)
{
for
(
Field
field
:
fi
el
dList
)
{
try
{
try
{
field
.
setAccessible
(
true
);
field
.
setAccessible
(
true
);
Object
o
=
field
.
get
(
result
);
Object
o
=
field
.
get
(
result
);
...
@@ -60,9 +60,9 @@ public class BeanCryptHandler implements CryptHandler<Object> {
...
@@ -60,9 +60,9 @@ public class BeanCryptHandler implements CryptHandler<Object> {
if
(
param
==
null
)
{
if
(
param
==
null
)
{
return
null
;
return
null
;
}
else
{
}
else
{
List
<
Field
>
fi
le
dList
=
this
.
getEncryptDecryptFields
(
param
.
getClass
(),
cryptProperties
);
List
<
Field
>
fi
el
dList
=
this
.
getEncryptDecryptFields
(
param
.
getClass
(),
cryptProperties
);
if
(
CollectionUtils
.
isNotEmpty
(
fi
le
dList
)){
if
(
CollectionUtils
.
isNotEmpty
(
fi
el
dList
)){
for
(
Field
field
:
fi
le
dList
)
{
for
(
Field
field
:
fi
el
dList
)
{
try
{
try
{
field
.
setAccessible
(
true
);
field
.
setAccessible
(
true
);
Object
o
=
field
.
get
(
param
);
Object
o
=
field
.
get
(
param
);
...
@@ -83,9 +83,9 @@ public class BeanCryptHandler implements CryptHandler<Object> {
...
@@ -83,9 +83,9 @@ public class BeanCryptHandler implements CryptHandler<Object> {
//对bean来说,加密字段和解密字段应该一致
//对bean来说,加密字段和解密字段应该一致
private
List
<
Field
>
getEncryptDecryptFields
(
Class
clazz
,
CryptProperties
cryptProperties
)
{
private
List
<
Field
>
getEncryptDecryptFields
(
Class
clazz
,
CryptProperties
cryptProperties
)
{
List
<
Field
>
fi
le
dList
=
new
ArrayList
();
List
<
Field
>
fi
el
dList
=
new
ArrayList
();
if
(
clazz
==
null
)
{
if
(
clazz
==
null
)
{
return
fi
le
dList
;
return
fi
el
dList
;
}
else
{
}
else
{
Field
[]
fields
=
clazz
.
getDeclaredFields
();
Field
[]
fields
=
clazz
.
getDeclaredFields
();
String
fieldName
=
""
;
String
fieldName
=
""
;
...
@@ -94,11 +94,11 @@ public class BeanCryptHandler implements CryptHandler<Object> {
...
@@ -94,11 +94,11 @@ public class BeanCryptHandler implements CryptHandler<Object> {
for
(
Field
field
:
fields
)
{
for
(
Field
field
:
fields
)
{
fieldName
=
field
.
getName
();
fieldName
=
field
.
getName
();
if
(
cryptProperties
.
isEncryptDecryptEntityField
(
className
,
fieldName
)){
if
(
cryptProperties
.
isEncryptDecryptEntityField
(
className
,
fieldName
)){
fi
le
dList
.
add
(
field
);
fi
el
dList
.
add
(
field
);
}
}
}
}
}
}
return
fi
le
dList
;
return
fi
el
dList
;
}
}
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论