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
a8becf4e
Commit
a8becf4e
authored
May 28, 2020
by
陶光胜
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' into 'master'
Developer See merge request
!1
parents
2a1600a8
a76066c3
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
196 additions
and
43 deletions
+196
-43
pom.xml
gic-cloud-data-hook-api/pom.xml
+66
-15
IFlatQueryResultService.java
.../cloud/data/hook/api/service/IFlatQueryResultService.java
+1
-1
pom.xml
gic-cloud-data-hook-service/pom.xml
+6
-2
HiveHelper.java
...main/java/com/gic/cloud/data/hook/service/HiveHelper.java
+1
-1
FlatQueryResultServiceImpl.java
...ud/data/hook/service/impl/FlatQueryResultServiceImpl.java
+31
-5
FreeQueryServiceImpl.java
...ic/cloud/data/hook/service/impl/FreeQueryServiceImpl.java
+4
-2
app.properties
...a-hook-service/src/main/resources/META-INF/app.properties
+2
-0
applicationContext-conf.xml
...ok-service/src/main/resources/applicationContext-conf.xml
+6
-3
data-hook-flat-query-source.xml
...ervice/src/main/resources/data-hook-flat-query-source.xml
+5
-3
data-hook-free-query-source.xml
...ervice/src/main/resources/data-hook-free-query-source.xml
+3
-1
data-hook-service-druid-prod.xml
...rvice/src/main/resources/data-hook-service-druid-prod.xml
+6
-3
data-hook-service-dubbo-config.xml
...ice/src/main/resources/data-hook-service-dubbo-config.xml
+1
-1
pom.xml
gic-cloud-data-hook/pom.xml
+21
-1
FlatQueryController.java
...java/com/gic/cloud/data/hook/web/FlatQueryController.java
+28
-2
FreeQueryController.java
...java/com/gic/cloud/data/hook/web/FreeQueryController.java
+7
-1
applicationContext-conf.xml
...-hook/src/main/webapp/WEB-INF/applicationContext-conf.xml
+2
-1
data-hook-dubbo-config.xml
...a-hook/src/main/webapp/WEB-INF/data-hook-dubbo-config.xml
+5
-1
spring-servlet.xml
...loud-data-hook/src/main/webapp/WEB-INF/spring-servlet.xml
+1
-0
No files found.
gic-cloud-data-hook-api/pom.xml
View file @
a8becf4e
...
...
@@ -7,24 +7,20 @@
<!--<groupId>com.gic</groupId>-->
<!--<version>1.0</version>-->
<!--</parent>-->
<parent>
<groupId>
com.gic
</groupId>
<artifactId>
gic-pom-base
</artifactId>
<version>
3.0-SNAPSHOT
</version>
</parent>
<groupId>
com.gic
</groupId>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
gic-cloud-data-hook-api
</artifactId>
<packaging>
jar
</packaging>
<version>
${
dataHook
Version}
</version>
<version>
${
library
Version}
</version>
<name>
${project.artifactId}
</name>
<properties>
<dataHookVersion>
1.0-SNAPSHOT
</dataHookVersion>
<cloudCommonsVersion>
3.0-SNAPSHOT
</cloudCommonsVersion>
<cloudServiceVersion>
3.0-SNAPSHOT
</cloudServiceVersion>
<serviceVersion>
3.0-SNAPSHOT
</serviceVersion>
<commonsVersion>
3.0-SNAPSHOT
</commonsVersion>
<memcachedVersion>
3.0-SNAPSHOT
</memcachedVersion>
<esVersion>
3.0-SNAPSHOT
</esVersion>
<mongoVersion>
3.0-SNAPSHOT
</mongoVersion>
<proTradeVersion>
3.0-SNAPSHOT
</proTradeVersion>
<platformConfigVersion>
3.0-SNAPSHOT
</platformConfigVersion>
</properties>
<distributionManagement>
<snapshotRepository>
...
...
@@ -56,7 +52,7 @@
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-cloud-web-service-api
</artifactId>
<version>
${
cloudServiceVersion
}
</version>
<version>
${
gic-cloud-web-service-api
}
</version>
<exclusions>
<exclusion>
<groupId>
org.slf4j
</groupId>
...
...
@@ -78,10 +74,10 @@
<artifactId>gic-cloud-communicate-api</artifactId>
<version>${cloudServiceVersion}</version>
</dependency>-->
<dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-cloud-commons
</artifactId>
<version>
${
cloudServiceVersion
}
</version>
<version>
${
gic-cloud-commons
}
</version>
<exclusions>
<exclusion>
<groupId>
org.slf4j
</groupId>
...
...
@@ -96,7 +92,7 @@
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-platform-config
</artifactId>
<version>
${
platformConfigVersion
}
</version>
<version>
${
gic-platform-config
}
</version>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
...
...
@@ -122,6 +118,61 @@
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
flatten-maven-plugin
</artifactId>
<!--<version>1.1.0-SNAPSHOT</version> -->
<configuration>
<flattenMode>
defaults
</flattenMode>
</configuration>
<executions>
<!-- enable flattening -->
<execution>
<id>
flatten
</id>
<phase>
process-resources
</phase>
<goals>
<goal>
flatten
</goal>
</goals>
</execution>
<!-- ensure proper cleanup -->
<execution>
<id>
flatten.clean
</id>
<phase>
clean
</phase>
<goals>
<goal>
clean
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>
maven-deploy-plugin
</artifactId>
<version>
2.7
</version>
<executions>
<execution>
<id>
default-deploy
</id>
<phase>
deploy
</phase>
<goals>
<goal>
deploy
</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 要将源码放上去,需要加入这个插件 -->
<plugin>
<artifactId>
maven-source-plugin
</artifactId>
<version>
2.1
</version>
<configuration>
<attach>
true
</attach>
</configuration>
<executions>
<execution>
<phase>
compile
</phase>
<goals>
<goal>
jar
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
...
gic-cloud-data-hook-api/src/main/java/com/gic/cloud/data/hook/api/service/IFlatQueryResultService.java
View file @
a8becf4e
...
...
@@ -22,7 +22,7 @@ public interface IFlatQueryResultService {
* @return
*/
public
FlatQueryResult
getFlatQueryResult
(
String
tableId
,
List
<
String
>
enterpriseIds
,
List
<
FlatQueryCondition
>
queryConditions
,
String
orderField
,
String
orderDir
,
Boolean
execDistinct
,
Integer
queryDataType
,
Integer
limitRange
);
Boolean
execDistinct
,
Integer
queryDataType
,
Integer
limitRange
,
int
dataPermission
);
/** 评估自助指标查询下载任务数据量
* @param tableId
...
...
gic-cloud-data-hook-service/pom.xml
View file @
a8becf4e
...
...
@@ -2,7 +2,11 @@
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<groupId>
com.gic
</groupId>
<artifactId>
gic-pom-base
</artifactId>
<version>
3.0-SNAPSHOT
</version>
</parent>
<groupId>
com.gic
</groupId>
<modelVersion>
4.0.0
</modelVersion>
<name>
${project.artifactId}
</name>
...
...
@@ -109,7 +113,7 @@
</dependencies>
<build>
<finalName>
${project.artifactId}
</finalName>
<finalName>
data-hook-service
</finalName>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
...
...
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/HiveHelper.java
View file @
a8becf4e
package
com
.
gic
.
cloud
.
data
.
hook
.
service
;
import
cn.medubi.client.utils.LogPak
;
import
com.alibaba.fastjson.JSON
;
import
org.springframework.beans.BeansException
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
...
...
@@ -47,7 +48,6 @@ public class HiveHelper implements ApplicationContextAware {
// Class.forName("org.apache.hive.jdbc.HiveDriver");
// conn = DriverManager.getConnection(url, "hadoop", "");
conn
=
source
.
getConnection
();
return
conn
;
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
...
...
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/impl/FlatQueryResultServiceImpl.java
View file @
a8becf4e
...
...
@@ -48,6 +48,10 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
/** csv / xls 下载目录 */
public
static
final
String
SAVE_FOLDER
=
"/usr/local/data-hook-file"
;
public
static
final
List
<
String
>
PHONE
=
Arrays
.
asList
(
"mobile"
,
"phone"
,
"phone_number"
,
"receive_phone_number"
);
public
static
final
List
<
String
>
CARD
=
Arrays
.
asList
(
"card_num"
,
"receive_card_num"
);
@Autowired
FlatQueryTableDao
flatQueryTableDao
;
...
...
@@ -159,7 +163,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
@Override
public
FlatQueryResult
getFlatQueryResult
(
String
tableId
,
List
<
String
>
enterpriseIds
,
List
<
FlatQueryCondition
>
queryConditions
,
String
orderField
,
String
orderDir
,
Boolean
execDistinct
,
Integer
queryDataType
,
Integer
limitRange
)
{
Boolean
execDistinct
,
Integer
queryDataType
,
Integer
limitRange
,
int
dataPermission
)
{
log
.
debug
(
"getFlatQueryResult"
,
"自助指标查询来自 "
+
enterpriseIds
.
get
(
0
));
// 定义返回值
FlatQueryResult
result
=
new
FlatQueryResult
();
...
...
@@ -231,7 +235,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
// } else fieldResult = "";
// } else fieldResult = rs.getObject(fieldColumnIndex);
//fieldResult = rs.getObject(fieldColumnIndex);
if
(
condition
.
getEnableEncrypt
())
{
// 如果需要进行解密
/**
if (condition.getEnableEncrypt()) { // 如果需要进行解密
String preResult = rs.getString(fieldColumnIndex);
//fieldResult = DecryptUtils.getInstance().decrypt(preResult);
if (queryDataType == QueryDataType.FULL) {
...
...
@@ -239,6 +243,22 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
fieldResult = DecryptUtils.decrypt(preResult);
} else fieldResult = "";
} else fieldResult = "******";
} else fieldResult = rs.getObject(fieldColumnIndex);**/
if
(
FreeQueryServiceImpl
.
FILTERS_PHONE_ONLY
.
contains
(
fieldName
)
||
FreeQueryServiceImpl
.
FILTERS_PHONE_AND_CARD
.
contains
(
fieldName
))
{
if
(
queryDataType
==
QueryDataType
.
FULL
){
String
preResult
=
rs
.
getString
(
fieldColumnIndex
);
if
(
dataPermission
==
1
&&
FreeQueryServiceImpl
.
FILTERS_PHONE_ONLY
.
contains
(
fieldName
)){
fieldResult
=
DecryptUtils
.
decrypt
(
preResult
);
}
else
if
(
dataPermission
==
2
&&
FreeQueryServiceImpl
.
FILTERS_PHONE_AND_CARD
.
contains
(
fieldName
)){
fieldResult
=
DecryptUtils
.
decrypt
(
preResult
);
}
else
fieldResult
=
rs
.
getObject
(
fieldColumnIndex
);
}
else
{
if
(
dataPermission
==
1
&&
FreeQueryServiceImpl
.
FILTERS_PHONE_ONLY
.
contains
(
fieldName
)){
fieldResult
=
"******"
;
}
else
if
(
dataPermission
==
2
&&
FreeQueryServiceImpl
.
FILTERS_PHONE_AND_CARD
.
contains
(
fieldName
)){
fieldResult
=
"******"
;
}
else
fieldResult
=
rs
.
getObject
(
fieldColumnIndex
);
}
}
else
fieldResult
=
rs
.
getObject
(
fieldColumnIndex
);
}
// SWITCH OVER
result
.
add
(
fieldName
,
fieldResult
);
...
...
@@ -307,7 +327,9 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
* @param execDistinct
* @return
*/
public
Integer
estimateFlatQueryDownloadTask
(
String
tableId
,
List
<
String
>
enterpriseIds
,
List
<
FlatQueryCondition
>
queryConditions
,
String
orderField
,
String
orderDir
,
Boolean
execDistinct
)
{
public
Integer
estimateFlatQueryDownloadTask
(
String
tableId
,
List
<
String
>
enterpriseIds
,
List
<
FlatQueryCondition
>
queryConditions
,
String
orderField
,
String
orderDir
,
Boolean
execDistinct
)
{
Integer
result
=
-
1
;
// 生成正式查询
String
preQuery
=
this
.
buildFlatQuerySQL
(
...
...
@@ -480,7 +502,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
}
//CSVWriter csvWriter = new CSVWriter(new FileWriter(csvPath), '\t');
OutputStreamWriter
out
=
new
OutputStreamWriter
(
new
FileOutputStream
(
originalFilePath
),
Charset
.
forName
(
"GBK"
));
ResultSetHelper
helper
=
new
CsvResultSetHelper
(
task
.
getQueryDataType
()
==
QueryDataType
.
FULL
?
CsvDataFilterMode
.
DECRYPT
:
CsvDataFilterMode
.
NONE
,
condition
.
getDecryptFilters
());
ResultSetHelper
helper
=
new
CsvResultSetHelper
(
task
.
getQueryDataType
()
==
QueryDataType
.
FULL
?
CsvDataFilterMode
.
DECRYPT
:
CsvDataFilterMode
.
DESENSI
,
condition
.
getDecryptFilters
());
CSVWriter
writer
=
new
CSVWriter
(
out
,
','
);
writer
.
setResultService
(
helper
);
writer
.
writeAll
(
rs
,
true
);
...
...
@@ -526,7 +548,11 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
row
.
createCell
(
j
).
setCellValue
(
rs
.
getTimestamp
(
j
+
1
)
!=
null
?
timeFormatter
.
format
(
rs
.
getTimestamp
(
j
+
1
))
:
""
);
break
;
default
:
row
.
createCell
(
j
).
setCellValue
(
rs
.
getString
(
j
+
1
));
if
(
cFilters
.
contains
(
cName
)){
row
.
createCell
(
j
).
setCellValue
(
"******"
);
}
else
{
row
.
createCell
(
j
).
setCellValue
(
rs
.
getString
(
j
+
1
));
}
break
;
}
}
// IF ELSE OVER
...
...
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/impl/FreeQueryServiceImpl.java
View file @
a8becf4e
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"
,
"receive_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"
,
"receive_phone_number"
,
"receive_card_num"
);
/** 获取指定脱敏类型的过滤字段集合
* @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-service/src/main/resources/META-INF/app.properties
0 → 100644
View file @
a8becf4e
app.id
=
data-hook
\ No newline at end of file
gic-cloud-data-hook-service/src/main/resources/applicationContext-conf.xml
View file @
a8becf4e
...
...
@@ -23,10 +23,12 @@
<!--<import resource="classpath:data-hook-free-query-source.xml"/>-->
<import
resource=
"classpath*:data-hook-service-druid-prod.xml"
/>
<import
resource=
"classpath:data-hook-init.xml"
/>
<import
resource=
"
file:config/data-hook-dubbo-settings
.xml"
/>
<import
resource=
"
classpath*:dubbo-setting
.xml"
/>
<import
resource=
"classpath:data-hook-service-dubbo-config.xml"
/>
<import
resource=
"file:config/data-hook-flat-query-source.xml"
/>
<import
resource=
"file:config/data-hook-free-query-source.xml"
/>
<!--<import resource="file:config/data-hook-flat-query-source.xml"/>-->
<!--<import resource="file:config/data-hook-free-query-source.xml"/>-->
<import
resource=
"classpath:data-hook-flat-query-source.xml"
/>
<import
resource=
"classpath:data-hook-free-query-source.xml"
/>
<!--<import resource="classpath:cloud-web-service-task.xml" />-->
</beans>
\ No newline at end of file
gic-cloud-data-hook-service/src/main/resources/data-hook-flat-query-source.xml
View file @
a8becf4e
...
...
@@ -3,18 +3,20 @@
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:context=
"http://www.springframework.org/schema/context"
xmlns:tx=
"http://www.springframework.org/schema/tx"
xmlns:p=
"http://www.springframework.org/schema/p"
xmlns:apollo=
"http://www.ctrip.com/schema/apollo"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd"
>
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.ctrip.com/schema/apollo http://www.ctrip.com/schema/apollo.xsd
"
>
<apollo:config
namespaces=
"application"
/>
<bean
class=
"org.apache.commons.dbcp.BasicDataSource"
id=
"hiveSource"
destroy-method=
"close"
>
<property
name=
"driverClassName"
value=
"org.apache.hive.jdbc.HiveDriver"
/>
<!--<property name="url" value="jdbc:hive2://115.159.205.44:10015/data_test" />-->
<property
name=
"url"
value=
"
jdbc:hive2://10.105.14.41:10015/data_test
"
/>
<property
name=
"username"
value=
"
hadoop
"
/>
<property
name=
"url"
value=
"
${hive.url}
"
/>
<property
name=
"username"
value=
"
${hive.username}
"
/>
<property
name=
"password"
value=
""
/>
<property
name=
"maxActive"
>
<value>
20
</value>
...
...
gic-cloud-data-hook-service/src/main/resources/data-hook-free-query-source.xml
View file @
a8becf4e
...
...
@@ -8,7 +8,9 @@
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd"
>
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.ctrip.com/schema/apollo
http://www.ctrip.com/schema/apollo.xsd"
>
<bean
class=
"org.apache.commons.dbcp.BasicDataSource"
id=
"mysqlSource"
destroy-method=
"close"
>
<property
name=
"driverClassName"
value=
"com.mysql.jdbc.Driver"
/>
...
...
gic-cloud-data-hook-service/src/main/resources/data-hook-service-druid-prod.xml
View file @
a8becf4e
...
...
@@ -3,17 +3,20 @@
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:context=
"http://www.springframework.org/schema/context"
xmlns:tx=
"http://www.springframework.org/schema/tx"
xmlns:p=
"http://www.springframework.org/schema/p"
xmlns:apollo=
"http://www.ctrip.com/schema/apollo"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd"
>
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.ctrip.com/schema/apollo
http://www.ctrip.com/schema/apollo.xsd"
>
<context:annotation-config
/>
<!--<context:component-scan base-package="com.gic.cloud" />-->
<
context:property-placeholder
location=
"file:./config/data-hook-service-jdbc.properties"
ignore-unresolvable=
"true"
/
>
<
!-- <context:property-placeholder location="file:./config/data-hook-service-jdbc.properties" ignore-unresolvable="true" />--
>
<apollo:config
namespaces=
"application"
/>
<bean
class=
"com.alibaba.druid.pool.DruidDataSource"
id=
"dataSource"
>
<!-- 基本属性 url、user、password -->
<property
name=
"url"
value=
"${jdbc.url}"
/>
...
...
gic-cloud-data-hook-service/src/main/resources/data-hook-service-dubbo-config.xml
View file @
a8becf4e
...
...
@@ -13,7 +13,7 @@
<!-- 应用名称 -->
<dubbo:application
name=
"gic-cloud-data-hook"
/>
<!-- 外部服务端口 -->
<dubbo:protocol
name=
"dubbo"
port=
"
30001
"
/>
<dubbo:protocol
name=
"dubbo"
port=
"
20338
"
/>
<!-- 注册外部服务:FlatQueryTableService -->
<bean
class=
"com.gic.cloud.data.hook.service.impl.FreeQueryServiceImpl"
id=
"freeQueryService"
/>
...
...
gic-cloud-data-hook/pom.xml
View file @
a8becf4e
...
...
@@ -2,6 +2,11 @@
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<groupId>
com.gic
</groupId>
<artifactId>
gic-pom-base
</artifactId>
<version>
3.0-SNAPSHOT
</version>
</parent>
<groupId>
com.gic
</groupId>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
gic-cloud-data-hook
</artifactId>
...
...
@@ -38,6 +43,21 @@
<artifactId>
gic-cloud-commons
</artifactId>
<version>
${cloudCommonsVersion}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-enterprise-api
</artifactId>
<version>
${gic-enterprise-api}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-clerk-api
</artifactId>
<version>
${gic-clerk-api}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-webapp-common
</artifactId>
<version>
${gic-webapp-common}
</version>
</dependency>
<!--<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-cloud-web-service-api</artifactId>
...
...
@@ -72,7 +92,7 @@
<build>
<finalName>
${project.artifactId}
</finalName>
<finalName>
data-hook-web
</finalName>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
...
...
gic-cloud-data-hook/src/main/java/com/gic/cloud/data/hook/web/FlatQueryController.java
View file @
a8becf4e
...
...
@@ -9,6 +9,9 @@ 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.enterprise.api.dto.EnterpriseSettingDTO
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.web.common.utils.SessionContextUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -42,6 +45,8 @@ public class FlatQueryController {
@SuppressWarnings
(
"SpringJavaInjectionPointsAutowiringInspection"
)
@Autowired
private
IMyFlatQueryService
myFlatQueryService
;
@Autowired
private
EnterpriseService
enterpriseService
;
/** 查询表定义及下载量等信息
...
...
@@ -101,6 +106,12 @@ public class FlatQueryController {
public
FlatQueryResult
doFlatQuery
(
@RequestBody
FlatQueryExecuteRequest
executeRequest
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
System
.
out
.
println
(
"doFlatQuery:"
+
executeRequest
.
getTableId
());
System
.
out
.
println
(
"doFlatQuery:"
+
executeRequest
.
getQueryConditions
().
size
());
String
enterpriseId
=
SessionContextUtils
.
getLoginUserEnterpriseId
();
EnterpriseSettingDTO
setting
=
this
.
enterpriseService
.
getEnterpriseSettingByEnterpriseId
(
enterpriseId
);
int
dataPermission
=
0
;
if
(
setting
.
getDataPermission
()
!=
null
){
dataPermission
=
setting
.
getDataPermission
();
}
for
(
FlatQueryCondition
condition
:
executeRequest
.
getQueryConditions
())
{
System
.
out
.
println
(
condition
.
getFieldName
()
+
" "
+
condition
.
getFieldType
());
}
...
...
@@ -112,7 +123,8 @@ public class FlatQueryController {
executeRequest
.
getOrderDir
(),
executeRequest
.
getExecDistinct
(),
executeRequest
.
getQueryDataType
(),
1000
);
// 强制 1000 限制
1000
,
dataPermission
);
// 强制 1000 限制
}
/** 获取自助查询下载量评估
...
...
@@ -144,6 +156,20 @@ public class FlatQueryController {
*/
@RequestMapping
(
"/build-flat-query-download-task"
)
public
DownloadTask
buildDownloadTask
(
@RequestBody
FlatQueryExecuteRequest
executeRequest
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
List
<
FlatQueryCondition
>
queryConditions
=
executeRequest
.
getQueryConditions
();
Integer
dataPermission
=
this
.
enterpriseService
.
getEnterpriseSettingByEnterpriseId
(
SessionContextUtils
.
getLoginUserEnterpriseId
()).
getDataPermission
();
if
(
dataPermission
!=
null
){
for
(
FlatQueryCondition
condition
:
queryConditions
){
if
(
"phone_number"
.
equals
(
condition
.
getFieldName
())){
condition
.
setEnableEncrypt
(
true
);
}
if
(
dataPermission
==
2
){
if
(
"card_num"
.
equals
(
condition
.
getFieldName
())){
condition
.
setEnableEncrypt
(
true
);
}
}
}
}
return
this
.
flatQueryResultService
.
buildFlatQueryDownloadTask
(
executeRequest
.
getUserId
(),
executeRequest
.
getName
(),
...
...
@@ -152,7 +178,7 @@ public class FlatQueryController {
executeRequest
.
getFormat
(),
executeRequest
.
getTableId
(),
executeRequest
.
getEnterpriseIds
(),
executeRequest
.
getQueryConditions
()
,
queryConditions
,
executeRequest
.
getOrderField
(),
executeRequest
.
getOrderDir
(),
executeRequest
.
getExecDistinct
(),
...
...
gic-cloud-data-hook/src/main/java/com/gic/cloud/data/hook/web/FreeQueryController.java
View file @
a8becf4e
...
...
@@ -6,6 +6,8 @@ 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
com.gic.web.common.utils.SessionContextUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
@@ -26,6 +28,8 @@ public class FreeQueryController {
@SuppressWarnings
(
"SpringJavaInjectionPointsAutowiringInspection"
)
@Autowired
private
IFreeQueryService
freeQueryService
;
@Autowired
private
EnterpriseService
enterpriseService
;
/** 获取所有的自定义查询表信息
* @param request
...
...
@@ -127,7 +131,9 @@ 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
(
SessionContextUtils
.
getLoginUserEnterpriseId
()).
getDataPermission
();
System
.
out
.
println
(
"!!!!!!!!:"
+
dataPermission
);
return
this
.
freeQueryService
.
getFreeQueryResult
(
"SELECT tmpTable.* FROM ("
+
sql
+
") AS tmpTable LIMIT 1000"
,
enterpriseId
,
queryDataType
,
dataPermission
);
}
...
...
gic-cloud-data-hook/src/main/webapp/WEB-INF/applicationContext-conf.xml
View file @
a8becf4e
...
...
@@ -7,7 +7,8 @@
<!--<import resource="classpath:data-hook-init.xml"/>--><!-- data-hook 所有项目使用的 dubbo 环境配置(位于 data-hook-api/resource) -->
<!--<import resource="classpath*:applicationContext-sharding-db.xml"/>-->
<import
resource=
"classpath*:applicationContext-init.xml"
/>
<import
resource=
"data-hook-dubbo-settings.xml"
/>
<!-- data-hook 所有项目初始化参数加载(位于 data-hook-api/resource)-->
<import
resource=
"classpath*:dubbo-setting.xml"
/>
<!-- <import resource="data-hook-dubbo-settings.xml"/>--><!-- data-hook 所有项目初始化参数加载(位于 data-hook-api/resource)-->
<import
resource=
"data-hook-dubbo-config.xml"
/>
<!-- data-hook web 项目使用的 dubbo 引用服务配置 -->
</beans>
gic-cloud-data-hook/src/main/webapp/WEB-INF/data-hook-dubbo-config.xml
View file @
a8becf4e
...
...
@@ -21,7 +21,11 @@
<dubbo:reference
interface=
"com.gic.cloud.data.hook.api.service.IFreeQueryService"
id=
"freeQueryService"
timeout=
"120000"
retries=
"0"
/>
<dubbo:reference
interface=
"com.gic.cloud.data.hook.api.service.IDownloadTaskService"
id=
"downloadTaskService"
timeout=
"120000"
retries=
"0"
/>
<dubbo:reference
interface=
"com.gic.cloud.data.hook.api.service.IMyFlatQueryService"
id=
"myFlatQueryService"
timeout=
"120000"
retries=
"0"
/>
<dubbo:reference
interface=
"com.gic.enterprise.api.service.EnterpriseService"
id=
"enterpriseService"
timeout=
"6000"
retries=
"0"
/>
<dubbo:reference
interface=
"com.gic.clerk.api.service.ClerkService"
id=
"clerkService"
timeout=
"6000"
retries=
"0"
/>
<dubbo:reference
interface=
"com.gic.clerk.api.service.UserService"
id=
"userService"
timeout=
"6000"
retries=
"0"
/>
<dubbo:reference
interface=
"com.gic.clerk.api.service.PowerService"
id=
"powerService"
timeout=
"6000"
retries=
"0"
/>
<!--<dubbo:reference interface="com.gic.enterprise.api.service.EnterPerformanceService" id="enterPerformanceService" timeout="10000" retries="0" />
<dubbo:reference interface="com.gic.cloud.communicate.api.service.performance.CloudPerformanceService" id="cloudPerformanceService" timeout="10000" retries="0" />
<dubbo:reference interface="com.gic.cloud.communicate.api.service.store.AreaService" id="areaService" timeout="10000" retries="0" />-->
...
...
gic-cloud-data-hook/src/main/webapp/WEB-INF/spring-servlet.xml
View file @
a8becf4e
...
...
@@ -10,6 +10,7 @@
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"
>
<import
resource=
"classpath:web-common-spring.xml"
/>
<!-- 扫描注解包路径,多个包用逗号分隔,不填pacakge表示扫描当前ApplicationContext中所有的类 -->
<context:component-scan
base-package=
"com.gic.cloud.data.hook"
/>
...
...
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