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
52b2752a
Commit
52b2752a
authored
Sep 09, 2019
by
Đào Nhật Quang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quangdn
parent
6f785531
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
1 deletion
+37
-1
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
...om/viettel/campaign/service/impl/CustomerServiceImpl.java
+37
-1
No files found.
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
View file @
52b2752a
...
...
@@ -998,7 +998,24 @@ public class CustomerServiceImpl implements CustomerService {
//</editor-fold>
//<editor-fold desc="Kiểm tra header của template" defaultstate="collapsed">
if
(
row
.
getPhysicalNumberOfCells
()
!=
header
.
size
())
{
if
(
row
.
getPhysicalNumberOfCells
()
>
header
.
size
())
{
for
(
int
i
=
0
;
i
<
row
.
getPhysicalNumberOfCells
();
i
++)
{
if
(
isColumnNullOrBlank
(
sheet
,
i
))
{
deleteNullColumn
(
sheet
,
i
);
}
}
for
(
int
i
=
0
;
i
<
header
.
size
();
i
++)
{
Cell
cell
=
row
.
getCell
(
i
);
if
(!
cell
.
getStringCellValue
().
equals
(
header
.
get
(
i
).
getTitle
().
split
(
"#"
)[
0
]))
{
result
.
put
(
"content"
,
Files
.
readAllBytes
(
file
.
toPath
()));
result
.
put
(
"message"
,
"template-invalid"
);
return
result
;
}
}
result
.
put
(
"content"
,
Files
.
readAllBytes
(
file
.
toPath
()));
result
.
put
(
"message"
,
"template-invalid"
);
return
result
;
}
else
if
(
row
.
getPhysicalNumberOfCells
()
<
header
.
size
())
{
result
.
put
(
"content"
,
Files
.
readAllBytes
(
file
.
toPath
()));
result
.
put
(
"message"
,
"template-invalid"
);
return
result
;
...
...
@@ -1398,6 +1415,25 @@ public class CustomerServiceImpl implements CustomerService {
String
regexp
=
"@\"^\\p{L}+$\""
;
return
str
.
matches
(
regexp
);
}
private
boolean
isColumnNullOrBlank
(
Sheet
sheet
,
int
columnIndex
)
{
for
(
Row
row
:
sheet
)
{
if
(
row
.
getRowNum
()
<
3
)
continue
;
Cell
cell
=
row
.
getCell
(
columnIndex
,
Row
.
MissingCellPolicy
.
RETURN_BLANK_AS_NULL
);
if
(
cell
!=
null
)
{
return
false
;
}
}
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