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
ed2c86da
Commit
ed2c86da
authored
Nov 03, 2021
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
取数平台调整
parent
d82a32d6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
32 deletions
+76
-32
FilterFieldUtils.java
...ava/com/gic/cloud/data/hook/service/FilterFieldUtils.java
+21
-22
TestHive.java
...c/main/java/com/gic/cloud/data/hook/service/TestHive.java
+18
-3
FreeQueryServiceImpl.java
...ic/cloud/data/hook/service/impl/FreeQueryServiceImpl.java
+15
-0
FlatQueryController.java
...java/com/gic/cloud/data/hook/web/FlatQueryController.java
+5
-6
FreeQueryController.java
...java/com/gic/cloud/data/hook/web/FreeQueryController.java
+17
-1
No files found.
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/FilterFieldUtils.java
View file @
ed2c86da
...
...
@@ -29,34 +29,33 @@ public class FilterFieldUtils {
@PostConstruct
public
void
init
(){
Config
config
=
ConfigService
.
getConfig
(
"application"
);
String
phoneNumberField
=
config
.
getProperty
(
"phoneNumberField"
,
""
);
String
cardNumField
=
config
.
getProperty
(
"cardNumField"
,
""
);
String
userNameField
=
config
.
getProperty
(
"userNameField"
,
""
);
if
(
StringUtils
.
isNotBlank
(
phoneNumberField
)){
FILTERS_PHONE_ONLY
=
Arrays
.
asList
(
phoneNumberField
.
split
(
","
));
FILTERS_PHONE_AND_CARD
=
new
ArrayList
<>();
for
(
String
s
:
phoneNumberField
.
split
(
","
)){
FILTERS_PHONE_AND_CARD
.
add
(
s
);
}
}
if
(
StringUtils
.
isNotBlank
(
cardNumField
)){
for
(
String
s
:
cardNumField
.
split
(
","
)){
FILTERS_PHONE_AND_CARD
.
add
(
s
);
}
}
if
(
StringUtils
.
isNotBlank
(
userNameField
)){
FILETERS_USER_NAME
=
Arrays
.
asList
(
userNameField
.
split
(
","
));
}
//initTimer();
initTimer
();
}
private
void
initTimer
(){
timer
.
scheduleAtFixedRate
(
new
Runnable
()
{
@Override
public
void
run
()
{
init
();
Config
config
=
ConfigService
.
getConfig
(
"application"
);
String
phoneNumberField
=
config
.
getProperty
(
"phoneNumberField"
,
""
);
String
cardNumField
=
config
.
getProperty
(
"cardNumField"
,
""
);
String
userNameField
=
config
.
getProperty
(
"userNameField"
,
""
);
if
(
StringUtils
.
isNotBlank
(
phoneNumberField
)){
FILTERS_PHONE_ONLY
=
Arrays
.
asList
(
phoneNumberField
.
split
(
","
));
FILTERS_PHONE_AND_CARD
=
new
ArrayList
<>();
for
(
String
s
:
phoneNumberField
.
split
(
","
)){
FILTERS_PHONE_AND_CARD
.
add
(
s
);
}
}
if
(
StringUtils
.
isNotBlank
(
cardNumField
)){
for
(
String
s
:
cardNumField
.
split
(
","
)){
FILTERS_PHONE_AND_CARD
.
add
(
s
);
}
}
if
(
StringUtils
.
isNotBlank
(
userNameField
)){
FILETERS_USER_NAME
=
Arrays
.
asList
(
userNameField
.
split
(
","
));
}
}
},
5
,
5
,
TimeUnit
.
MINUTE
S
);
},
5
,
5
,
TimeUnit
.
SECOND
S
);
}
}
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/TestHive.java
View file @
ed2c86da
...
...
@@ -19,9 +19,24 @@ public class TestHive {
private
static
org
.
slf4j
.
Logger
logger
=
LoggerFactory
.
getLogger
(
IFlatQueryTableService
.
class
);
public
static
void
main
(
String
[]
args
)
{
String
s
=
FileUploadUtil
.
simpleUploadFileFromLocal
(
new
File
(
"C:\\Users\\d\\Desktop\\企业\\1635737005993.csv"
),
"1635737005993.csv"
,
BucketNameEnum
.
REPORT_50000
.
getName
());
System
.
out
.
println
(
"s = "
+
s
);
String
sql
=
"select from tab_gic_store limit 10000"
;
String
curLimit
=
""
;
if
(
sql
.
indexOf
(
"limit"
)>
0
||
sql
.
indexOf
(
"LIMIT"
)>
0
){
int
start
=
0
;
if
(
sql
.
indexOf
(
"limit"
)>
0
){
start
=
sql
.
indexOf
(
"limit"
)
+
6
;
}
else
{
start
=
sql
.
indexOf
(
"LIMIT"
)
+
6
;
}
curLimit
=
sql
.
substring
(
start
);
if
(
curLimit
.
indexOf
(
","
)
>
0
){
curLimit
=
curLimit
.
substring
(
curLimit
.
indexOf
(
","
)+
1
);
}
if
(
Integer
.
valueOf
(
curLimit
)
>
1000
){
curLimit
=
1000
+
""
;
}
}
System
.
out
.
println
(
"sql = "
+
sql
+
" limit "
+
curLimit
);
}
...
...
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/impl/FreeQueryServiceImpl.java
View file @
ed2c86da
...
...
@@ -350,6 +350,21 @@ public class FreeQueryServiceImpl implements IFreeQueryService {
}
}
@Override
public
List
<
String
>
listFilterPhoneField
()
{
return
FilterFieldUtils
.
FILTERS_PHONE_ONLY
;
}
@Override
public
List
<
String
>
listFilterPhoneAndCardNoField
()
{
return
FilterFieldUtils
.
FILTERS_PHONE_AND_CARD
;
}
@Override
public
List
<
String
>
listFilterUserName
()
{
return
FilterFieldUtils
.
FILETERS_USER_NAME
;
}
private
static
SimpleDateFormat
datetimeFormatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
private
static
SimpleDateFormat
dateFormatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
...
...
gic-cloud-data-hook/src/main/java/com/gic/cloud/data/hook/web/FlatQueryController.java
View file @
ed2c86da
...
...
@@ -12,10 +12,7 @@ import com.gic.cloud.data.hook.api.entity.FlatQueryCondition;
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.entity.Global
;
import
com.gic.cloud.data.hook.api.service.IFlatQueryResultService
;
import
com.gic.cloud.data.hook.api.service.IFlatQueryTableService
;
import
com.gic.cloud.data.hook.api.service.IMyFlatQueryService
;
import
com.gic.cloud.data.hook.api.service.SearchLogService
;
import
com.gic.cloud.data.hook.api.service.*
;
import
com.gic.enterprise.api.constant.StoreWidget
;
import
com.gic.enterprise.api.dto.EnterpriseSettingDTO
;
import
com.gic.enterprise.api.dto.StoreWidgetDTO
;
...
...
@@ -74,6 +71,8 @@ public class FlatQueryController {
private
RightService
rightService
;
@Autowired
private
SearchLogService
searchLogService
;
@Autowired
private
IFreeQueryService
freeQueryService
;
/** 查询表定义及下载量等信息
...
...
@@ -217,14 +216,14 @@ public class FlatQueryController {
if
(
dataPermission
!=
null
){
for
(
FlatQueryCondition
condition
:
queryConditions
){
if
(
dataPermission
==
1
){
if
(
FILTERS_PHONE_ONLY
.
contains
(
condition
.
getFieldName
())){
if
(
freeQueryService
.
listFilterPhoneField
()
.
contains
(
condition
.
getFieldName
())){
condition
.
setEnableEncrypt
(
true
);
}
else
{
condition
.
setEnableEncrypt
(
false
);
}
}
if
(
dataPermission
==
2
){
if
(
FILTERS_PHONE_AND_CARD
.
contains
(
condition
.
getFieldName
())){
if
(
freeQueryService
.
listFilterPhoneAndCardNoField
()
.
contains
(
condition
.
getFieldName
())){
condition
.
setEnableEncrypt
(
true
);
}
else
{
condition
.
setEnableEncrypt
(
false
);
...
...
gic-cloud-data-hook/src/main/java/com/gic/cloud/data/hook/web/FreeQueryController.java
View file @
ed2c86da
...
...
@@ -160,7 +160,23 @@ public class FreeQueryController {
dto
.
setStartTime
(
new
Date
());
Integer
dataPermission
=
this
.
enterpriseService
.
getEnterpriseSettingByEnterpriseId
(
SessionContextUtils
.
getLoginUserEnterpriseId
()).
getDataPermission
();
System
.
out
.
println
(
"!!!!!!!!:"
+
dataPermission
);
FreeQueryResult
freeQueryResult
=
this
.
freeQueryService
.
getFreeQueryResult
(
"SELECT tmpTable.* FROM ("
+
sql
+
") AS tmpTable LIMIT 1000"
,
enterpriseId
,
queryDataType
,
dataPermission
);
String
curLimit
=
""
;
if
(
sql
.
indexOf
(
"limit"
)>
0
||
sql
.
indexOf
(
"LIMIT"
)>
0
){
int
start
=
0
;
if
(
sql
.
indexOf
(
"limit"
)>
0
){
start
=
sql
.
indexOf
(
"limit"
)
+
6
;
}
else
{
start
=
sql
.
indexOf
(
"LIMIT"
)
+
6
;
}
curLimit
=
sql
.
substring
(
start
);
if
(
curLimit
.
indexOf
(
","
)
>
0
){
curLimit
=
curLimit
.
substring
(
curLimit
.
indexOf
(
","
)+
1
);
}
if
(
Integer
.
valueOf
(
curLimit
)
>
1000
){
curLimit
=
1000
+
""
;
}
}
FreeQueryResult
freeQueryResult
=
this
.
freeQueryService
.
getFreeQueryResult
(
sql
+
" limit "
+
curLimit
,
enterpriseId
,
queryDataType
,
dataPermission
);
dto
.
setEndTime
(
new
Date
());
this
.
searchLogService
.
saveLog
(
dto
);
return
freeQueryResult
;
...
...
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