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
82ef92d2
Commit
82ef92d2
authored
Oct 28, 2021
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
取数平台调整
parent
182e1c5f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
42 deletions
+19
-42
pom.xml
gic-cloud-data-hook-service/pom.xml
+5
-0
FlatQueryResultServiceImpl.java
...ud/data/hook/service/impl/FlatQueryResultServiceImpl.java
+7
-40
FreeQueryServiceImpl.java
...ic/cloud/data/hook/service/impl/FreeQueryServiceImpl.java
+7
-2
No files found.
gic-cloud-data-hook-service/pom.xml
View file @
82ef92d2
...
...
@@ -114,6 +114,11 @@
<artifactId>
hutool-all
</artifactId>
<version>
5.5.8
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-thirdparty-sdk
</artifactId>
<version>
${gic-thirdparty-sdk}
</version>
</dependency>
</dependencies>
...
...
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/impl/FlatQueryResultServiceImpl.java
View file @
82ef92d2
...
...
@@ -15,6 +15,8 @@ import com.gic.cloud.data.hook.service.dao.FlatQueryTableDao;
import
com.gic.cloud.data.hook.service.entity.CsvDataFilterMode
;
import
com.gic.cloud.data.hook.service.entity.CsvResultSetHelper
;
import
com.gic.qcloud.BucketNameEnum
;
import
com.gic.qcloud.FileUploadUtil
;
import
com.google.common.collect.Lists
;
import
com.opencsv.CSVWriter
;
import
com.opencsv.ResultSetHelper
;
...
...
@@ -603,11 +605,6 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
cell
=
row
.
createCell
(
j
);
cell
.
setCellValue
(
columnNames
[
j
]);
}
/*for (int j = 0; j < rs.getMetaData().getColumnCount(); ++j) { // 遍历创建表头
String colName = rs.getMetaData().getColumnLabel(j + 1);
cell = row.createCell(j);
cell.setCellValue(colName);
}*/
// 遍历输出行
int
rowCount
=
0
;
while
(
rs
.
next
())
{
...
...
@@ -617,39 +614,6 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
for
(
int
j
=
0
;
j
<
columnValues
.
length
;
j
++){
row
.
createCell
(
j
).
setCellValue
(
columnValues
[
j
]);
}
/*for (int j = 0; j < rs.getMetaData().getColumnCount(); ++j) {
//String c = rs.getString(j + 1);
//row.createCell(j).setCellValue(c);
String cName = rs.getMetaData().getColumnName(j+1);
List<String> cFilters = condition.getDecryptFilters();
if (task.getQueryDataType() == QueryDataType.FULL && (cFilters.contains(cName) || DecryptUtils.isName(cName, condition.getConditions()))) {
String tmpResult = rs.getString(j + 1);
if (StringUtils.isNotBlank(tmpResult)) tmpResult = DecryptUtils.getInstance().decrypt(tmpResult);
row.createCell(j).setCellValue(tmpResult);
} else {
int cType = rs.getMetaData().getColumnType(j + 1);
switch (cType) {
case Types.TIMESTAMP:
row.createCell(j).setCellValue(rs.getTimestamp(j + 1) != null ? datetimeFormatter.format(rs.getTimestamp(j + 1)) : "");
break;
case Types.DATE:
row.createCell(j).setCellValue(rs.getDate(j + 1) != null ? dateFormatter.format(rs.getDate(j + 1)) : "");
break;
case Types.TIME:
row.createCell(j).setCellValue(rs.getTimestamp(j + 1) != null ? timeFormatter.format(rs.getTimestamp(j + 1)) : "");
break;
default:
if(cFilters.contains(cName)){
row.createCell(j).setCellValue("******");
} else if(DecryptUtils.isName(cName, condition.getConditions())){
row.createCell(j).setCellValue(DecryptUtils.dataSecurityProcessUserName(DecryptUtils.decrypt(rs.getString(j + 1))));
} else {
row.createCell(j).setCellValue(rs.getString(j + 1));
}
break;
}
} // IF ELSE OVER
} // FOR OVER*/
}
// WHILE OVER
FileOutputStream
fileOut
=
new
FileOutputStream
(
originalFilePath
);
wb
.
write
(
fileOut
);
...
...
@@ -659,7 +623,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
wb
.
dispose
();
// SXSSFWorkbook 没有 close 方法
log
.
debug
(
"runDownloadTask.run"
,
"已生成自助指标下载文件 "
+
condition
.
getTaskId
()
+
".xlsx"
);
}
// IF ELSE OVER
String
cloudFileUrl
=
""
;
// 如果指定压缩,则使用之
//if (task.getFormat().equals("zip")) {
if
(
task
.
getUseCompress
().
equals
(
Global
.
YES
))
{
...
...
@@ -691,13 +655,16 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
zos
.
closeEntry
();
zos
.
close
();
}
cloudFileUrl
=
FileUploadUtil
.
simpleUploadFileFromLocal
(
zipFile
,
task
.
getId
(),
BucketNameEnum
.
COMPRESS_60000
.
getName
());
}
else
{
cloudFileUrl
=
FileUploadUtil
.
simpleUploadFileFromLocal
(
new
File
(
originalFilePath
),
task
.
getId
(),
BucketNameEnum
.
COMPRESS_60000
.
getName
());
}
task
.
setStatus
(
DownloadTaskStatus
.
COMPLISHED
);
task
.
setOverTime
(
new
Date
());
String
taskFileExt
=
task
.
getUseCompress
().
equals
(
Global
.
YES
)
?
".zip"
:
task
.
getFormat
().
equals
(
DownloadFileFormat
.
CSV
)
?
".csv"
:
".xlsx"
;
task
.
setFilePath
(
task
.
getId
()
+
taskFileExt
);
task
.
setFilePath
(
cloudFileUrl
);
DownloadTaskServiceImpl
.
getInstance
().
updateDownloadTask
(
task
);
}
catch
(
Exception
ex
)
{
...
...
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/impl/FreeQueryServiceImpl.java
View file @
82ef92d2
...
...
@@ -14,6 +14,8 @@ import com.gic.cloud.data.hook.service.dao.FreeQueryRecordDao;
import
com.gic.cloud.data.hook.service.dao.FreeQuerySourceDao
;
import
com.gic.cloud.data.hook.service.entity.CsvDataFilterMode
;
import
com.gic.cloud.data.hook.service.entity.CsvResultSetHelper
;
import
com.gic.qcloud.BucketNameEnum
;
import
com.gic.qcloud.FileUploadUtil
;
import
com.google.common.collect.Lists
;
import
com.opencsv.CSVWriter
;
import
com.opencsv.ResultSetHelper
;
...
...
@@ -467,7 +469,7 @@ public class FreeQueryServiceImpl implements IFreeQueryService {
wb
.
dispose
();
// SXSSFWorkbook 没有 close 方法
log
.
debug
(
"runDownloadTask.run"
,
"已生成自定义查询下载文件 "
+
condition
.
getTaskId
()
+
".xlsx"
);
}
String
cloudFileUrl
=
""
;
if
(
task
.
getUseCompress
().
equals
(
Global
.
YES
))
{
log
.
debug
(
"runDownloadTask.run"
,
"准备生成自定义查询压缩文件 "
+
condition
.
getTaskId
()
+
".zip"
);
String
zipFilePath
=
SAVE_FOLDER
+
"/"
+
condition
.
getTaskId
()
+
".zip"
;
...
...
@@ -497,13 +499,16 @@ public class FreeQueryServiceImpl implements IFreeQueryService {
zos
.
closeEntry
();
zos
.
close
();
}
cloudFileUrl
=
FileUploadUtil
.
simpleUploadFileFromLocal
(
zipFile
,
task
.
getId
(),
BucketNameEnum
.
COMPRESS_60000
.
getName
());
}
else
{
cloudFileUrl
=
FileUploadUtil
.
simpleUploadFileFromLocal
(
new
File
(
originalFilePath
),
task
.
getId
(),
BucketNameEnum
.
REPORT_50000
.
getName
());
}
task
.
setStatus
(
DownloadTaskStatus
.
COMPLISHED
);
task
.
setOverTime
(
new
java
.
util
.
Date
());
String
taskFileExt
=
task
.
getUseCompress
().
equals
(
Global
.
YES
)
?
".zip"
:
task
.
getFormat
().
equals
(
DownloadFileFormat
.
CSV
)
?
".csv"
:
".xlsx"
;
task
.
setFilePath
(
task
.
getId
()
+
taskFileExt
);
task
.
setFilePath
(
cloudFileUrl
);
DownloadTaskServiceImpl
.
getInstance
().
updateDownloadTask
(
task
);
}
catch
(
Exception
ex
)
{
...
...
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