Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
64e9354d
提交
64e9354d
authored
4月 21, 2022
作者:
taojinlong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 精简模式添加 Excel数据集
上级
ccffc4f2
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
25 行增加
和
4 行删除
+25
-4
ExcelXlsReader.java
...c/main/java/io/dataease/commons/utils/ExcelXlsReader.java
+11
-1
ExcelXlsxReader.java
.../main/java/io/dataease/commons/utils/ExcelXlsxReader.java
+12
-3
DataSetTableService.java
...java/io/dataease/service/dataset/DataSetTableService.java
+2
-0
没有找到文件。
backend/src/main/java/io/dataease/commons/utils/ExcelXlsReader.java
浏览文件 @
64e9354d
...
@@ -25,6 +25,16 @@ public class ExcelXlsReader implements HSSFListener {
...
@@ -25,6 +25,16 @@ public class ExcelXlsReader implements HSSFListener {
private
int
minColums
=
-
1
;
private
int
minColums
=
-
1
;
public
Integer
getObtainedNum
()
{
return
obtainedNum
;
}
public
void
setObtainedNum
(
Integer
obtainedNum
)
{
this
.
obtainedNum
=
obtainedNum
;
}
private
Integer
obtainedNum
=
null
;
private
POIFSFileSystem
fs
;
private
POIFSFileSystem
fs
;
/**
/**
...
@@ -331,7 +341,7 @@ public class ExcelXlsReader implements HSSFListener {
...
@@ -331,7 +341,7 @@ public class ExcelXlsReader implements HSSFListener {
totalSheets
.
add
(
excelSheetData
);
totalSheets
.
add
(
excelSheetData
);
}
else
{
}
else
{
List
<
String
>
tmp
=
new
ArrayList
<>(
cellList
);
List
<
String
>
tmp
=
new
ArrayList
<>(
cellList
);
if
(
totalSheets
.
stream
().
filter
(
s
->
s
.
getExcelLable
().
equalsIgnoreCase
(
sheetName
)).
collect
(
Collectors
.
toList
()).
get
(
0
).
getData
().
size
()
<
100
){
if
(
obtainedNum
!=
null
&&
totalSheets
.
stream
().
filter
(
s
->
s
.
getExcelLable
().
equalsIgnoreCase
(
sheetName
)).
collect
(
Collectors
.
toList
()).
get
(
0
).
getData
().
size
()
<
obtainedNum
){
totalSheets
.
stream
().
filter
(
s
->
s
.
getExcelLable
().
equalsIgnoreCase
(
sheetName
)).
collect
(
Collectors
.
toList
()).
get
(
0
).
getData
().
add
(
tmp
);
totalSheets
.
stream
().
filter
(
s
->
s
.
getExcelLable
().
equalsIgnoreCase
(
sheetName
)).
collect
(
Collectors
.
toList
()).
get
(
0
).
getData
().
add
(
tmp
);
}
}
...
...
backend/src/main/java/io/dataease/commons/utils/ExcelXlsxReader.java
浏览文件 @
64e9354d
...
@@ -121,6 +121,15 @@ public class ExcelXlsxReader extends DefaultHandler {
...
@@ -121,6 +121,15 @@ public class ExcelXlsxReader extends DefaultHandler {
*/
*/
private
boolean
isDateFormat
=
false
;
private
boolean
isDateFormat
=
false
;
public
Integer
getObtainedNum
()
{
return
obtainedNum
;
}
public
void
setObtainedNum
(
Integer
obtainedNum
)
{
this
.
obtainedNum
=
obtainedNum
;
}
private
Integer
obtainedNum
=
null
;
public
List
<
TableField
>
getFields
()
{
public
List
<
TableField
>
getFields
()
{
return
fields
;
return
fields
;
...
@@ -181,7 +190,7 @@ public class ExcelXlsxReader extends DefaultHandler {
...
@@ -181,7 +190,7 @@ public class ExcelXlsxReader extends DefaultHandler {
*/
*/
@Override
@Override
public
void
startElement
(
String
uri
,
String
localName
,
String
name
,
Attributes
attributes
)
throws
SAXException
{
public
void
startElement
(
String
uri
,
String
localName
,
String
name
,
Attributes
attributes
)
throws
SAXException
{
if
(
curRow
>
101
){
if
(
this
.
obtainedNum
!=
null
&&
curRow
>
this
.
obtainedNum
){
return
;
return
;
}
}
...
@@ -219,7 +228,7 @@ public class ExcelXlsxReader extends DefaultHandler {
...
@@ -219,7 +228,7 @@ public class ExcelXlsxReader extends DefaultHandler {
*/
*/
@Override
@Override
public
void
characters
(
char
[]
ch
,
int
start
,
int
length
)
throws
SAXException
{
public
void
characters
(
char
[]
ch
,
int
start
,
int
length
)
throws
SAXException
{
if
(
curRow
>
101
){
if
(
this
.
obtainedNum
!=
null
&&
curRow
>
this
.
obtainedNum
){
return
;
return
;
}
}
lastIndex
+=
new
String
(
ch
,
start
,
length
);
lastIndex
+=
new
String
(
ch
,
start
,
length
);
...
@@ -235,7 +244,7 @@ public class ExcelXlsxReader extends DefaultHandler {
...
@@ -235,7 +244,7 @@ public class ExcelXlsxReader extends DefaultHandler {
*/
*/
@Override
@Override
public
void
endElement
(
String
uri
,
String
localName
,
String
name
)
throws
SAXException
{
public
void
endElement
(
String
uri
,
String
localName
,
String
name
)
throws
SAXException
{
if
(
curRow
>
101
){
if
(
this
.
obtainedNum
!=
null
&&
curRow
>
this
.
obtainedNum
){
return
;
return
;
}
}
//t元素也包含字符串
//t元素也包含字符串
...
...
backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java
浏览文件 @
64e9354d
...
@@ -1917,11 +1917,13 @@ public class DataSetTableService {
...
@@ -1917,11 +1917,13 @@ public class DataSetTableService {
String
suffix
=
filename
.
substring
(
filename
.
lastIndexOf
(
"."
)
+
1
);
String
suffix
=
filename
.
substring
(
filename
.
lastIndexOf
(
"."
)
+
1
);
if
(
StringUtils
.
equalsIgnoreCase
(
suffix
,
"xls"
))
{
if
(
StringUtils
.
equalsIgnoreCase
(
suffix
,
"xls"
))
{
ExcelXlsReader
excelXlsReader
=
new
ExcelXlsReader
();
ExcelXlsReader
excelXlsReader
=
new
ExcelXlsReader
();
excelXlsReader
.
setObtainedNum
(
100
);
excelXlsReader
.
process
(
inputStream
);
excelXlsReader
.
process
(
inputStream
);
excelSheetDataList
=
excelXlsReader
.
totalSheets
;
excelSheetDataList
=
excelXlsReader
.
totalSheets
;
}
}
if
(
StringUtils
.
equalsIgnoreCase
(
suffix
,
"xlsx"
))
{
if
(
StringUtils
.
equalsIgnoreCase
(
suffix
,
"xlsx"
))
{
ExcelXlsxReader
excelXlsxReader
=
new
ExcelXlsxReader
();
ExcelXlsxReader
excelXlsxReader
=
new
ExcelXlsxReader
();
excelXlsxReader
.
setObtainedNum
(
100
);
excelXlsxReader
.
process
(
inputStream
);
excelXlsxReader
.
process
(
inputStream
);
excelSheetDataList
=
excelXlsxReader
.
totalSheets
;
excelSheetDataList
=
excelXlsxReader
.
totalSheets
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论