Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-enterprise-base
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-enterprise-base
Commits
c5a43cf8
Commit
c5a43cf8
authored
Dec 04, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导出修改:添加加密功能
parent
3b5622e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
DownloadUtils.java
...d/src/main/java/com/gic/download/utils/DownloadUtils.java
+10
-5
No files found.
gic-enterprise-download/src/main/java/com/gic/download/utils/DownloadUtils.java
View file @
c5a43cf8
...
...
@@ -96,12 +96,13 @@ public class DownloadUtils {
* @param headerList 表头名称
* @param propertyNameList 字段名
* @param loader 数据加载类
* @param needEncryptField 需要加密的字段,每一个元素存的是字段,如phone(电话)
* @param columnWidth 列宽
* @throws Exception
* @author Silver
* @date 2017年3月16日 上午11:47:31
*/
protected
<
T
>
void
download
(
String
tempPath
,
Integer
reportId
,
String
fileName
,
Integer
excelExtensionCode
,
List
<
String
>
headerList
,
List
<
String
>
propertyNameList
,
DownloadDataLoader
<
T
>
loader
,
List
<
Integer
>
columnWidth
)
throws
Exception
{
protected
<
T
>
void
download
(
String
tempPath
,
Integer
reportId
,
String
fileName
,
Integer
excelExtensionCode
,
List
<
String
>
headerList
,
List
<
String
>
propertyNameList
,
DownloadDataLoader
<
T
>
loader
,
List
<
String
>
needEncryptField
,
List
<
Integer
>
columnWidth
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
fileName
)
||
loader
==
null
||
CollectionUtils
.
isEmpty
(
propertyNameList
))
{
throw
new
RuntimeException
(
"参数错误。FileName:"
+
fileName
+
",DataLoader:"
+
loader
+
",PropertyName:"
+
propertyNameList
);
...
...
@@ -131,7 +132,7 @@ public class DownloadUtils {
}
};
writeOutputStream
(
loader
,
propertyNameList
,
writer
);
writeOutputStream
(
loader
,
propertyNameList
,
writer
,
needEncryptField
);
// 写入excel
if
(!
ExcelUtils
.
setExcelInfo
(
sheet
,
columnWidth
,
headerList
,
rows
))
{
throw
new
IOException
(
"设置导出文件内容失败。"
);
...
...
@@ -152,7 +153,7 @@ public class DownloadUtils {
// 写文件头
writer
.
write
(
headerList
);
// 写文件
writeOutputStream
(
loader
,
propertyNameList
,
writer
);
writeOutputStream
(
loader
,
propertyNameList
,
writer
,
needEncryptField
);
}
else
{
writer
=
new
Writer
()
{
@Override
...
...
@@ -165,7 +166,7 @@ public class DownloadUtils {
// 写文件头
writer
.
write
(
headerList
);
// 写文件
writeOutputStream
(
loader
,
propertyNameList
,
writer
);
writeOutputStream
(
loader
,
propertyNameList
,
writer
,
needEncryptField
);
}
out
.
flush
();
tempFile
.
deleteOnExit
();
...
...
@@ -214,7 +215,7 @@ public class DownloadUtils {
}
protected
<
T
>
void
writeOutputStream
(
DownloadDataLoader
<
T
>
loader
,
List
<
String
>
propertyNames
,
Writer
writer
)
throws
Exception
{
Writer
writer
,
List
<
String
>
needEncryptField
)
throws
Exception
{
int
pageNum
=
1
;
int
maxLength
=
102400
;
...
...
@@ -240,6 +241,10 @@ public class DownloadUtils {
Object
property
=
loader
.
getProperty
(
bean
,
name
);
// 将属性值转换成字符串
String
convertValue
=
loader
.
convertProperty
(
bean
,
name
,
property
);
//加密处理
if
(
needEncryptField
==
null
&&
needEncryptField
.
contains
(
name
))
{
convertValue
=
"****"
;
}
// 组装成row
result
.
add
(
convertValue
);
}
...
...
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