Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-enterprise
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
base_platform_enterprise
gic-platform-enterprise
Commits
9ac64cbb
Commit
9ac64cbb
authored
Jun 08, 2021
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
报表中心
parent
fea20abf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletions
+30
-1
HiveDataDownloadApiServiceImpl.java
...se/service/outer/impl/HiveDataDownloadApiServiceImpl.java
+29
-0
DownloadReportController.java
...c/enterprise/web/controller/DownloadReportController.java
+1
-1
No files found.
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/impl/HiveDataDownloadApiServiceImpl.java
View file @
9ac64cbb
package
com
.
gic
.
enterprise
.
service
.
outer
.
impl
;
import
com.alibaba.druid.sql.SQLUtils
;
import
com.alibaba.druid.sql.ast.SQLExpr
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.enterprise.constant.DownloadReportDataTypeEnum
;
...
...
@@ -90,9 +92,36 @@ public class HiveDataDownloadApiServiceImpl implements HiveDataDownloadApiServic
downloadTaskPOJO
.
setDesenField
(
hiveDataDownloadDTO
.
getDesenField
());
downloadTaskPOJO
.
setExcelExtension
(
hiveDataDownloadDTO
.
getExcelExtension
());
downloadTaskPOJO
.
setTableName
(
getTableName
(
hiveDataDownloadDTO
.
getSql
()));
downloadTaskPOJO
.
setFileName
(
hiveDataDownloadDTO
.
getFileName
());
downloadTaskPOJO
.
setExcelExtension
(
hiveDataDownloadDTO
.
getExcelExtension
());
taskList
.
add
(
downloadTaskPOJO
);
}
public
static
void
main
(
String
[]
args
){
Connection
conn
=
HiveConnUtils
.
getConnection
();
Statement
stat
=
null
;
try
{
stat
=
conn
.
createStatement
();
//stat.execute("REFRESH TABLE extract_order_information"); // 强制刷新表结构 防止数据出错
String
s
=
SQLUtils
.
formatHive
(
"SELECT order_id as '订单号' FROM extract_order_information"
);
stat
.
execute
(
s
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"下载数据出现异常"
,
e
);
// 任务状态修改
}
finally
{
try
{
if
(
stat
!=
null
)
{
stat
.
close
();
}
if
(
conn
!=
null
)
{
conn
.
close
();
}
}
catch
(
SQLException
e
)
{
log
.
warn
(
"stat 关闭异常"
,
e
);
}
}
}
private
void
runDownloadTask
(
Integer
interval
)
{
downloadService
.
scheduleAtFixedRate
(
new
Runnable
()
{
...
...
gic-platform-enterprise-web/src/main/java/com/gic/enterprise/web/controller/DownloadReportController.java
View file @
9ac64cbb
...
...
@@ -94,7 +94,7 @@ public class DownloadReportController {
dataDownloadDTO
.
setDataUrl
(
"https://four.gicdev.com/member-tag/member-tag/tag-val-edit?id=264137629747888139&name=111111"
);
//dataDownloadDTO.setDesenField();
dataDownloadDTO
.
setExcelExtension
(
ExcelExtensionEnum
.
CSV
.
getCode
());
dataDownloadDTO
.
setFileName
(
"boom
hive
test"
);
dataDownloadDTO
.
setFileName
(
"boom
hive
test"
);
dataDownloadDTO
.
setSql
(
"SELECT order_id AS `订单号` FROM extract_order_information;"
);
ServiceResponse
<
Integer
>
downloadTask
=
hiveDataDownloadApiService
.
createDownloadTask
(
dataDownloadDTO
);
if
(
downloadTask
.
isSuccess
()){
...
...
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