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
f3dd3589
Commit
f3dd3589
authored
May 26, 2020
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自助指标解密
parent
6e322c63
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
FreeQueryServiceImpl.java
...ic/cloud/data/hook/service/impl/FreeQueryServiceImpl.java
+4
-2
FreeQueryController.java
...java/com/gic/cloud/data/hook/web/FreeQueryController.java
+5
-1
No files found.
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/impl/FreeQueryServiceImpl.java
View file @
f3dd3589
package
com
.
gic
.
cloud
.
data
.
hook
.
service
.
impl
;
import
cn.medubi.client.utils.LogPak
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.cloud.data.hook.api.dto.*
;
import
com.gic.cloud.data.hook.api.dto.DataDesensiType
;
import
com.gic.cloud.data.hook.api.entity.*
;
...
...
@@ -45,10 +46,10 @@ public class FreeQueryServiceImpl implements IFreeQueryService {
public
static
final
String
SAVE_FOLDER
=
"/usr/local/data-hook-file"
;
/** 脱敏字段 */
public
static
final
List
<
String
>
FILTERS_PHONE_ONLY
=
Arrays
.
asList
(
"mobile"
,
"phone"
,
"enterprise_name"
);
public
static
final
List
<
String
>
FILTERS_PHONE_ONLY
=
Arrays
.
asList
(
"mobile"
,
"phone"
,
"enterprise_name"
,
"phone_number"
);
/** 脱敏字段 */
public
static
final
List
<
String
>
FILTERS_PHONE_AND_CARD
=
Arrays
.
asList
(
"card_num"
,
"mobile"
,
"phone"
,
"enterprise_name"
);
public
static
final
List
<
String
>
FILTERS_PHONE_AND_CARD
=
Arrays
.
asList
(
"card_num"
,
"mobile"
,
"phone"
,
"enterprise_name"
,
"phone_number"
);
/** 获取指定脱敏类型的过滤字段集合
* @param desensiType
...
...
@@ -63,6 +64,7 @@ public class FreeQueryServiceImpl implements IFreeQueryService {
/** 是否为脱敏字段 */
public
static
boolean
isFilterFields
(
Integer
desensiType
,
String
fieldName
)
{
List
<
String
>
fieldsFilter
=
getFieldsFilters
(
desensiType
);
log
.
debug
(
"isFilterFields:"
,
JSON
.
toJSONString
(
fieldsFilter
)
+
"-"
+
desensiType
+
"-"
+
fieldName
);
for
(
String
filter
:
fieldsFilter
)
{
if
(
fieldName
.
contains
(
filter
))
return
true
;
}
// FOR OVER
...
...
gic-cloud-data-hook/src/main/java/com/gic/cloud/data/hook/web/FreeQueryController.java
View file @
f3dd3589
...
...
@@ -6,6 +6,7 @@ import com.gic.cloud.data.hook.api.entity.FlatQueryExecuteRequest;
import
com.gic.cloud.data.hook.api.entity.GeneralResult
;
import
com.gic.cloud.data.hook.api.service.IFlatQueryResultService
;
import
com.gic.cloud.data.hook.api.service.IFreeQueryService
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
@@ -26,6 +27,8 @@ public class FreeQueryController {
@SuppressWarnings
(
"SpringJavaInjectionPointsAutowiringInspection"
)
@Autowired
private
IFreeQueryService
freeQueryService
;
@Autowired
private
EnterpriseService
enterpriseService
;
/** 获取所有的自定义查询表信息
* @param request
...
...
@@ -127,7 +130,8 @@ public class FreeQueryController {
*/
@RequestMapping
(
"/get-free-query-result"
)
public
FreeQueryResult
getFreeQueryResult
(
String
sql
,
String
enterpriseId
,
Integer
queryDataType
,
Integer
desensiType
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
return
this
.
freeQueryService
.
getFreeQueryResult
(
"SELECT tmpTable.* FROM ("
+
sql
+
") AS tmpTable LIMIT 1000"
,
enterpriseId
,
queryDataType
,
desensiType
);
Integer
dataPermission
=
this
.
enterpriseService
.
getEnterpriseSettingByEnterpriseId
(
enterpriseId
).
getDataPermission
();
return
this
.
freeQueryService
.
getFreeQueryResult
(
"SELECT tmpTable.* FROM ("
+
sql
+
") AS tmpTable LIMIT 1000"
,
enterpriseId
,
queryDataType
,
dataPermission
);
}
...
...
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