Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-cloud
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data-hook
gic-cloud
Commits
b0ab32a0
Commit
b0ab32a0
authored
Sep 24, 2021
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
取数平台调整
parent
22be29c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
8 deletions
+25
-8
DecryptUtils.java
...in/java/com/gic/cloud/data/hook/service/DecryptUtils.java
+17
-0
CsvResultSetHelper.java
...ic/cloud/data/hook/service/entity/CsvResultSetHelper.java
+1
-1
FlatQueryResultServiceImpl.java
...ud/data/hook/service/impl/FlatQueryResultServiceImpl.java
+7
-7
No files found.
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/DecryptUtils.java
View file @
b0ab32a0
package
com
.
gic
.
cloud
.
data
.
hook
.
service
;
import
com.alibaba.dubbo.common.utils.StringUtils
;
import
com.gic.cloud.data.hook.api.entity.FlatQueryCondition
;
import
com.gic.cloud.data.hook.service.impl.FreeQueryServiceImpl
;
import
com.gic.data.shield.SdkEnv
;
import
com.gic.data.shield.decrypt.DataDecryptionClient
;
import
com.gic.data.shield.exception.DecryptException
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
public
class
DecryptUtils
{
private
static
DataDecryptionClient
decryptionClient
=
null
;
...
...
@@ -50,5 +54,18 @@ public class DecryptUtils {
return
stringBuffer
.
toString
();
}
public
static
boolean
isName
(
String
columnName
,
List
<
FlatQueryCondition
>
allFields
){
if
(
StringUtils
.
isBlank
(
columnName
)){
return
false
;
}
for
(
FlatQueryCondition
condition
:
allFields
){
if
(
condition
.
getFieldMark
().
equals
(
columnName
)){
if
(
FreeQueryServiceImpl
.
FILETERS_USER_NAME
.
contains
(
condition
.
getFieldName
())){
return
true
;
}
}
}
return
false
;
}
}
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/entity/CsvResultSetHelper.java
View file @
b0ab32a0
...
...
@@ -102,7 +102,7 @@ public class CsvResultSetHelper implements ResultSetHelper {
// 数据处理
if
(
doDesensi
)
{
// 如果需要脱敏处理
if
(
allFields
!=
null
&&
isName
(
columnName
)){
result
[
i
]
=
DecryptUtils
.
dataSecurityProcessUserName
(
resultSet
.
getString
(
columnName
));
result
[
i
]
=
DecryptUtils
.
dataSecurityProcessUserName
(
DecryptUtils
.
decrypt
(
resultSet
.
getString
(
columnName
)
));
}
else
if
(
allFields
==
null
&&
FreeQueryServiceImpl
.
FILETERS_USER_NAME
.
contains
(
columnName
))
{
result
[
i
]
=
DecryptUtils
.
dataSecurityProcessUserName
(
resultSet
.
getString
(
columnName
));
}
else
{
...
...
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/impl/FlatQueryResultServiceImpl.java
View file @
b0ab32a0
...
...
@@ -609,15 +609,11 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
//row.createCell(j).setCellValue(c);
String
cName
=
rs
.
getMetaData
().
getColumnName
(
j
+
1
);
List
<
String
>
cFilters
=
condition
.
getDecryptFilters
();
if
(
task
.
getQueryDataType
()
==
QueryDataType
.
FULL
&&
(
cFilters
.
contains
(
cName
)
||
FreeQueryServiceImpl
.
FILETERS_USER_NAME
.
contains
(
cName
)))
{
if
(
task
.
getQueryDataType
()
==
QueryDataType
.
FULL
&&
(
cFilters
.
contains
(
cName
)
||
DecryptUtils
.
isName
(
cName
,
condition
.
getConditions
()
)))
{
String
tmpResult
=
rs
.
getString
(
j
+
1
);
if
(
StringUtils
.
isNotBlank
(
tmpResult
))
tmpResult
=
DecryptUtils
.
getInstance
().
decrypt
(
tmpResult
);
row
.
createCell
(
j
).
setCellValue
(
tmpResult
);
}
else
{
if
(
FreeQueryServiceImpl
.
FILETERS_USER_NAME
.
contains
(
cName
)){
String
name
=
DecryptUtils
.
getInstance
().
decrypt
(
rs
.
getString
(
j
+
1
));
DecryptUtils
.
dataSecurityProcessUserName
(
name
);
}
int
cType
=
rs
.
getMetaData
().
getColumnType
(
j
+
1
);
switch
(
cType
)
{
case
Types
.
TIMESTAMP
:
...
...
@@ -632,7 +628,9 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
default
:
if
(
cFilters
.
contains
(
cName
)){
row
.
createCell
(
j
).
setCellValue
(
"******"
);
}
else
{
}
else
if
(
DecryptUtils
.
isName
(
cName
,
condition
.
getConditions
())){
row
.
createCell
(
j
).
setCellValue
(
DecryptUtils
.
dataSecurityProcessUserName
(
DecryptUtils
.
decrypt
(
rs
.
getString
(
j
+
1
))));
}
else
{
row
.
createCell
(
j
).
setCellValue
(
rs
.
getString
(
j
+
1
));
}
break
;
...
...
@@ -802,7 +800,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
//row.createCell(j).setCellValue(c);
String
cName
=
rs
.
getMetaData
().
getColumnName
(
j
+
1
);
List
<
String
>
cFilters
=
condition
.
getDecryptFilters
();
if
(
task
.
getQueryDataType
()
==
QueryDataType
.
FULL
&&
cFilters
.
contains
(
cName
))
{
if
(
task
.
getQueryDataType
()
==
QueryDataType
.
FULL
&&
(
cFilters
.
contains
(
cName
)
||
DecryptUtils
.
isName
(
cName
,
condition
.
getConditions
())
))
{
String
tmpResult
=
rs
.
getString
(
j
+
1
);
if
(
StringUtils
.
isNotBlank
(
tmpResult
))
tmpResult
=
DecryptUtils
.
getInstance
().
decrypt
(
tmpResult
);
row
.
createCell
(
j
).
setCellValue
(
tmpResult
);
...
...
@@ -821,6 +819,8 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
default
:
if
(
cFilters
.
contains
(
cName
)){
row
.
createCell
(
j
).
setCellValue
(
"******"
);
}
else
if
(
DecryptUtils
.
isName
(
cName
,
condition
.
getConditions
())){
row
.
createCell
(
j
).
setCellValue
(
DecryptUtils
.
dataSecurityProcessUserName
(
DecryptUtils
.
decrypt
(
rs
.
getString
(
j
+
1
))));
}
else
{
row
.
createCell
(
j
).
setCellValue
(
rs
.
getString
(
j
+
1
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment