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
4a23dd66
Commit
4a23dd66
authored
Jun 11, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量导入兼容2007+版本Excel
parent
2b23a9f5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
WmStoreSyncController.java
...c/enterprise/web/controller/wm/WmStoreSyncController.java
+13
-6
No files found.
gic-platform-enterprise-web/src/main/java/com/gic/enterprise/web/controller/wm/WmStoreSyncController.java
View file @
4a23dd66
...
...
@@ -25,7 +25,8 @@ import org.apache.poi.hssf.usermodel.HSSFCell;
import
org.apache.poi.hssf.usermodel.HSSFRow
;
import
org.apache.poi.hssf.usermodel.HSSFSheet
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.openxml4j.exceptions.InvalidFormatException
;
import
org.apache.poi.ss.usermodel.*
;
import
org.redisson.api.RMap
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -994,13 +995,16 @@ public class WmStoreSyncController {
public
static
List
<
Map
<
Integer
,
String
>>
readXlsOfBranch
(
InputStream
in
,
int
row
)
{
List
<
Map
<
Integer
,
String
>>
result
=
new
ArrayList
<
Map
<
Integer
,
String
>>();
try
{
HSSFWorkbook
hssfWorkbook
=
new
HSSFWorkbook
(
in
);
Workbook
workbook
=
WorkbookFactory
.
create
(
in
);
// HSSFWorkbook hssfWorkbook = new HSSFWorkbook(in);
for
(
int
numSheet
=
0
;
numSheet
<
1
;
numSheet
++)
{
HSSFSheet
hssfSheet
=
hssfWorkbook
.
getSheetAt
(
numSheet
);
Sheet
sheet
=
workbook
.
getSheetAt
(
numSheet
);
// HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(numSheet);
//getPhysicalNumberOfRows:实际有数据的行数,去掉空行
for
(
int
rowNum
=
row
-
1
,
rowLength
=
hssfSheet
.
getPhysicalNumberOfRows
();
rowNum
<=
rowLength
;
rowNum
++)
{
HSSFRow
hssfRow
=
hssfSheet
.
getRow
(
rowNum
);
for
(
int
rowNum
=
row
-
1
,
rowLength
=
sheet
.
getPhysicalNumberOfRows
();
rowNum
<=
rowLength
;
rowNum
++)
{
Row
hssfRow
=
sheet
.
getRow
(
rowNum
);
// HSSFRow hssfRow = hssfSheet.getRow(rowNum);
if
(
hssfRow
==
null
)
{
continue
;
}
...
...
@@ -1010,7 +1014,8 @@ public class WmStoreSyncController {
Map
<
Integer
,
String
>
map
=
new
HashMap
<
Integer
,
String
>();
for
(
int
colix
=
minColix
;
colix
<
maxColix
;
colix
++)
{
HSSFCell
hssfCell
=
hssfRow
.
getCell
(
colix
);
Cell
hssfCell
=
hssfRow
.
getCell
(
colix
);
// HSSFCell hssfCell = hssfRow.getCell(colix);
if
(
hssfCell
==
null
)
{
map
.
put
(
colix
,
""
);
}
else
{
...
...
@@ -1025,6 +1030,8 @@ public class WmStoreSyncController {
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
catch
(
InvalidFormatException
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
...
...
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