Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
service-campaign
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyen Ha
service-campaign
Commits
257524ae
Commit
257524ae
authored
Sep 10, 2019
by
Đào Nhật Quang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quangdn - add download template and import template
parent
1c1806ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
pom.xml
pom.xml
+2
-2
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
...om/viettel/campaign/service/impl/CustomerServiceImpl.java
+9
-10
No files found.
pom.xml
View file @
257524ae
...
...
@@ -119,7 +119,7 @@
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi
</artifactId>
<version>
3.17
</version>
<version>
4.0.1
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
...
...
@@ -131,7 +131,7 @@
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
<version>
3.17
</version>
<version>
4.0.1
</version>
</dependency>
<dependency>
<groupId>
org.quartz-scheduler
</groupId>
...
...
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
View file @
257524ae
...
...
@@ -20,6 +20,7 @@ import cz.jirutka.rsql.parser.ast.RSQLVisitor;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.ss.util.CellRangeAddress
;
import
org.apache.poi.ss.util.CellRangeAddressList
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.hibernate.SQLQuery
;
import
org.hibernate.Session
;
...
...
@@ -980,7 +981,7 @@ public class CustomerServiceImpl implements CustomerService {
FileInputStream
fis
=
new
FileInputStream
(
file
);
workbook
=
new
XSSFWorkbook
(
fis
);
ByteArrayOutputStream
os
=
new
ByteArrayOutputStream
();
Sheet
sheet
=
workbook
.
getSheetAt
(
0
);
XSSF
Sheet
sheet
=
workbook
.
getSheetAt
(
0
);
Row
row
=
sheet
.
getRow
(
3
);
//<editor-fold desc="Tạo style cho cột kết quả" defaultstate="collapsed">
...
...
@@ -1001,7 +1002,9 @@ public class CustomerServiceImpl implements CustomerService {
if
(
row
.
getPhysicalNumberOfCells
()
>
header
.
size
())
{
for
(
int
i
=
0
;
i
<
row
.
getPhysicalNumberOfCells
();
i
++)
{
if
(
isColumnNullOrBlank
(
sheet
,
i
))
{
deleteNullColumn
(
sheet
,
i
);
sheet
.
shiftColumns
(
i
+
1
,
i
+
1
,
-
1
);
sheet
.
removeMergedRegion
(
0
);
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
0
,
1
,
0
,
13
));
}
}
for
(
int
i
=
0
;
i
<
header
.
size
();
i
++)
{
...
...
@@ -1036,7 +1039,10 @@ public class CustomerServiceImpl implements CustomerService {
result
.
put
(
"content"
,
Files
.
readAllBytes
(
file
.
toPath
()));
return
result
;
}
else
{
Cell
resultCell
=
sheet
.
getRow
(
3
).
createCell
(
sheet
.
getRow
(
3
).
getPhysicalNumberOfCells
());
Cell
resultCell
=
sheet
.
getRow
(
3
).
getCell
(
header
.
size
());
if
(
resultCell
==
null
)
{
resultCell
=
sheet
.
getRow
(
3
).
createCell
(
header
.
size
());
}
resultCell
.
setCellValue
(
BundleUtils
.
getLangString
(
"customer.result"
,
locale
));
resultCell
.
setCellStyle
(
resultStyle
);
}
...
...
@@ -1424,13 +1430,6 @@ public class CustomerServiceImpl implements CustomerService {
return
true
;
}
private
void
deleteNullColumn
(
Sheet
sheet
,
int
columnIndex
)
{
for
(
Row
row
:
sheet
)
{
if
(
row
.
getRowNum
()
<
3
)
continue
;
Cell
cell
=
row
.
getCell
(
columnIndex
,
Row
.
MissingCellPolicy
.
RETURN_BLANK_AS_NULL
);
row
.
removeCell
(
cell
);
}
}
//</editor-fold>
@Override
...
...
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