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
e475d341
Commit
e475d341
authored
Apr 06, 2023
by
fudahua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新版本的下载
parent
4c3e5a68
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
9 deletions
+22
-9
dubbo.cache
...loud-data-hook-service/dubbo/local/gic-member/dubbo.cache
+0
-0
HDFSUtil.java
...c/main/java/com/gic/cloud/data/hook/service/HDFSUtil.java
+1
-1
FlatQueryResultServiceImpl.java
...ud/data/hook/service/impl/FlatQueryResultServiceImpl.java
+7
-6
DownloadTaskDao.xml
...ook-service/src/main/resources/mapper/DownloadTaskDao.xml
+2
-1
Test.java
gic-cloud-data-hook-service/src/test/java/Test.java
+12
-1
No files found.
gic-cloud-data-hook-service/dubbo/local/gic-member/dubbo.cache
View file @
e475d341
This diff is collapsed.
Click to expand it.
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/HDFSUtil.java
View file @
e475d341
...
@@ -47,7 +47,7 @@ public class HDFSUtil {
...
@@ -47,7 +47,7 @@ public class HDFSUtil {
*/
*/
public
boolean
downloadFile
(
String
srcPath
,
String
toPath
)
{
public
boolean
downloadFile
(
String
srcPath
,
String
toPath
)
{
try
{
try
{
fileSystem
.
copyToLocalFile
(
tru
e
,
new
Path
(
srcPath
),
new
Path
(
toPath
));
fileSystem
.
copyToLocalFile
(
fals
e
,
new
Path
(
srcPath
),
new
Path
(
toPath
));
return
true
;
return
true
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
logger
.
info
(
"下载失败:{}"
,
e
);
logger
.
info
(
"下载失败:{}"
,
e
);
...
...
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/impl/FlatQueryResultServiceImpl.java
View file @
e475d341
...
@@ -68,7 +68,8 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
...
@@ -68,7 +68,8 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
private
static
LogPak
log
=
new
LogPak
(
FlatQueryResultServiceImpl
.
class
);
private
static
LogPak
log
=
new
LogPak
(
FlatQueryResultServiceImpl
.
class
);
/** csv / xls 下载目录 */
/** csv / xls 下载目录 */
public
static
final
String
SAVE_FOLDER
=
"/usr/local/data-hook-file"
;
// public static final String SAVE_FOLDER = "/usr/local/data-hook-file";
public
static
final
String
SAVE_FOLDER
=
"D:\\testorder"
;
public
static
final
String
HDFS_URL
=
"/data/hook"
;
public
static
final
String
HDFS_URL
=
"/data/hook"
;
...
@@ -106,7 +107,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
...
@@ -106,7 +107,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
private
FlatQueryResultServiceImpl
()
{
private
FlatQueryResultServiceImpl
()
{
log
.
debug
(
"construct"
,
"准备初始化 FlatQuery 查询服务"
);
log
.
debug
(
"construct"
,
"准备初始化 FlatQuery 查询服务"
);
runDealHiveFile
(
3
);
//
runDealHiveFile(3);
// runDistTask(3);
// runDistTask(3);
runDownloadTask
(
3
);
runDownloadTask
(
3
);
runBalaDownloadTask
(
3
);
runBalaDownloadTask
(
3
);
...
@@ -879,7 +880,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
...
@@ -879,7 +880,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
currentFile
.
set
(
xlsxFileInfo
);
currentFile
.
set
(
xlsxFileInfo
);
xlsxFiles
.
add
(
currentFile
.
get
().
filepath
);
xlsxFiles
.
add
(
currentFile
.
get
().
filepath
);
}
}
count
.
incrementAndGet
();
saveXlsSplitNew
(
currentFile
.
get
().
filepath
,
cells
,
titles
,
currentFile
.
get
(),
count
,
false
);
saveXlsSplitNew
(
currentFile
.
get
().
filepath
,
cells
,
titles
,
currentFile
.
get
(),
count
,
false
);
});
});
//结束
//结束
...
@@ -951,10 +952,10 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
...
@@ -951,10 +952,10 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
}
}
}
}
if
(
first
)
{
if
(
first
)
{
first
=
false
;
continue
;
continue
;
}
}
func
.
deal
(
cells
,
titles
,
first
);
func
.
deal
(
cells
,
titles
,
first
);
first
=
false
;
}
while
((
cells
=
csvReader
.
readNext
())!=
null
);
}
while
((
cells
=
csvReader
.
readNext
())!=
null
);
...
@@ -1215,8 +1216,8 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
...
@@ -1215,8 +1216,8 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
}
}
}
}
Integer
limitSize
=
FileUtil
.
getLimitSize
();
Integer
limitSize
=
FileUtil
.
getLimitSize
();
int
c
=
count
.
incrementAndG
et
();
int
c
=
count
.
g
et
();
if
(
c
>
=
limitSize
||
endFlag
)
{
if
(
c
>
limitSize
||
endFlag
)
{
FileOutputStream
fileOut
=
new
FileOutputStream
(
originalFilePath
);
FileOutputStream
fileOut
=
new
FileOutputStream
(
originalFilePath
);
wb
.
write
(
fileOut
);
wb
.
write
(
fileOut
);
//fileOut.flush(); // SXSSFWorkbook 使用 auto-flush 模式
//fileOut.flush(); // SXSSFWorkbook 使用 auto-flush 模式
...
...
gic-cloud-data-hook-service/src/main/resources/mapper/DownloadTaskDao.xml
View file @
e475d341
...
@@ -30,7 +30,8 @@
...
@@ -30,7 +30,8 @@
q.apply_status,
q.apply_status,
q.real_sql,
q.real_sql,
q.enterprise_id,
q.enterprise_id,
q.report_id
q.report_id,
q.download_condition
</sql>
</sql>
...
...
gic-cloud-data-hook-service/src/test/java/Test.java
View file @
e475d341
import
com.gic.cloud.data.hook.api.dto.DownloadTask
;
import
com.gic.cloud.data.hook.service.impl.DownloadTaskServiceImpl
;
import
com.gic.cloud.data.hook.service.impl.FlatQueryResultServiceImpl
;
import
com.gic.cloud.data.hook.service.impl.FlatQueryResultServiceImpl
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -11,8 +13,17 @@ public class Test {
...
@@ -11,8 +13,17 @@ public class Test {
@Autowired
@Autowired
private
FlatQueryResultServiceImpl
flatQueryResultService
;
private
FlatQueryResultServiceImpl
flatQueryResultService
;
@Autowired
private
DownloadTaskServiceImpl
downloadTaskService
;
@org
.
junit
.
Test
@org
.
junit
.
Test
public
void
test
(){
public
void
test
(){
flatQueryResultService
.
runDealHiveFile
(
3
);
DownloadTask
downloadTask
=
downloadTaskService
.
getDownloadTaskById
(
"1680778799753"
);
flatQueryResultService
.
takeFileNew
(
downloadTask
);
try
{
Thread
.
sleep
(
10000000000L
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
}
}
}
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