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
8b5ff8ff
Commit
8b5ff8ff
authored
Aug 26, 2019
by
Vu Duy Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
anhvd commit scenario import
parent
5a1269c3
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
236 deletions
+29
-236
log/campaign.log
log/campaign.log
+8
-217
pom.xml
pom.xml
+2
-2
src/main/java/com/viettel/campaign/service/impl/ScenarioServiceImpl.java
...om/viettel/campaign/service/impl/ScenarioServiceImpl.java
+18
-16
src/main/java/com/viettel/campaign/web/rest/ScenarioController.java
...ava/com/viettel/campaign/web/rest/ScenarioController.java
+1
-1
No files found.
log/campaign.log
View file @
8b5ff8ff
This diff is collapsed.
Click to expand it.
pom.xml
View file @
8b5ff8ff
...
@@ -49,8 +49,8 @@
...
@@ -49,8 +49,8 @@
<dependency>
<dependency>
<groupId>
com.oracle
</groupId>
<groupId>
com.oracle
</groupId>
<artifactId>
ojdbc7
</artifactId>
<artifactId>
ojdbc7
</artifactId>
<scope>
system
</scope
>
<!-- <scope>system</scope>--
>
<systemPath>
${project.basedir}/lib/ojdbc7.jar
</systemPath
>
<!-- <systemPath>${project.basedir}/lib/ojdbc7.jar</systemPath>--
>
<version>
1.0
</version>
<version>
1.0
</version>
</dependency>
</dependency>
<dependency>
<dependency>
...
...
src/main/java/com/viettel/campaign/service/impl/ScenarioServiceImpl.java
View file @
8b5ff8ff
...
@@ -309,18 +309,6 @@ public class ScenarioServiceImpl implements ScenarioService {
...
@@ -309,18 +309,6 @@ public class ScenarioServiceImpl implements ScenarioService {
obj
[
j
]
=
dataCell
.
getStringCellValue
();
obj
[
j
]
=
dataCell
.
getStringCellValue
();
break
;
break
;
}
}
}
else
{
Cell
headerCell
=
row
.
getCell
(
j
);
// if (headerCell.getStringCellValue().equals(BundleUtils.getLangString("scenario.template.questionType", locale))) {
// obj[j] = BundleUtils.getLangString("customer.cusType.normal", locale);
// } else if (headerCell.getStringCellValue().equals(BundleUtils.getLangString("customer.callAllowed", locale)) ||
// headerCell.getStringCellValue().equals(BundleUtils.getLangString("customer.emailAllowed", locale)) ||
// headerCell.getStringCellValue().equals(BundleUtils.getLangString("customer.smsAllowed", locale))) {
// obj[j] = BundleUtils.getLangString("customer.yes", locale);
// break;
// } else {
// obj[j] = null;
// }
}
}
}
}
rawDataList
.
add
(
obj
);
rawDataList
.
add
(
obj
);
...
@@ -331,14 +319,14 @@ public class ScenarioServiceImpl implements ScenarioService {
...
@@ -331,14 +319,14 @@ public class ScenarioServiceImpl implements ScenarioService {
String
selectedType
=
""
;
String
selectedType
=
""
;
for
(
int
i
=
0
;
i
<
rawDataList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
rawDataList
.
size
();
i
++)
{
if
(
rawDataList
.
get
(
i
)[
0
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
0
].
toString
().
trim
().
equals
(
""
))
if
(
rawDataList
.
get
(
i
)[
0
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
0
].
toString
().
trim
().
equals
(
""
))
selectedType
=
rawDataList
.
get
(
i
)[
0
].
toString
().
trim
();
selectedType
=
rawDataList
.
get
(
i
)[
1
].
toString
().
trim
();
//validate question
//validate question
if
((
rawDataList
.
get
(
i
)[
0
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
0
].
toString
().
trim
().
equals
(
""
))
||
if
((
rawDataList
.
get
(
i
)[
0
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
0
].
toString
().
trim
().
equals
(
""
))
||
(
rawDataList
.
get
(
i
)[
1
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
1
].
toString
().
trim
().
equals
(
""
))
||
(
rawDataList
.
get
(
i
)[
1
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
1
].
toString
().
trim
().
equals
(
""
))
||
(
rawDataList
.
get
(
i
)[
2
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
2
].
toString
().
trim
().
equals
(
""
))
||
(
rawDataList
.
get
(
i
)[
2
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
2
].
toString
().
trim
().
equals
(
""
))
||
(
rawDataList
.
get
(
i
)[
5
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
5
].
toString
().
trim
().
equals
(
""
))
||
(
rawDataList
.
get
(
i
)[
5
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
5
].
toString
().
trim
().
equals
(
""
))
||
(
rawDataList
.
get
(
i
)[
6
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
6
].
toString
().
trim
().
equals
(
""
)))
{
(
rawDataList
.
get
(
i
)[
6
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
6
].
toString
().
trim
().
equals
(
""
)))
{
if
(
rawDataList
.
get
(
i
)[
0
]
==
null
||
!
DataUtil
.
is
Long
(
rawDataList
.
get
(
i
)[
0
].
toString
()))
{
if
(
rawDataList
.
get
(
i
)[
0
]
==
null
||
!
DataUtil
.
is
Number
(
rawDataList
.
get
(
i
)[
0
].
toString
()))
{
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.questionCode.required"
));
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.questionCode.required"
));
}
}
if
(
rawDataList
.
get
(
i
)[
1
]
==
null
||
rawDataList
.
get
(
i
)[
1
].
toString
().
trim
().
equals
(
""
))
{
if
(
rawDataList
.
get
(
i
)[
1
]
==
null
||
rawDataList
.
get
(
i
)[
1
].
toString
().
trim
().
equals
(
""
))
{
...
@@ -359,7 +347,7 @@ public class ScenarioServiceImpl implements ScenarioService {
...
@@ -359,7 +347,7 @@ public class ScenarioServiceImpl implements ScenarioService {
if
((
rawDataList
.
get
(
i
)[
3
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
3
].
toString
().
trim
().
equals
(
""
))
||
if
((
rawDataList
.
get
(
i
)[
3
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
3
].
toString
().
trim
().
equals
(
""
))
||
(
rawDataList
.
get
(
i
)[
4
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
4
].
toString
().
trim
().
equals
(
""
))
||
(
rawDataList
.
get
(
i
)[
4
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
4
].
toString
().
trim
().
equals
(
""
))
||
(
rawDataList
.
get
(
i
)[
7
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
7
].
toString
().
trim
().
equals
(
""
)))
{
(
rawDataList
.
get
(
i
)[
7
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
7
].
toString
().
trim
().
equals
(
""
)))
{
if
((
rawDataList
.
get
(
i
)[
3
]
==
null
||
!
DataUtil
.
isLong
(
rawDataList
.
get
(
i
)[
3
].
toString
()
))
&&
(!
selectedType
.
equals
(
BundleUtils
.
getLangString
(
"scenario.template.text"
))))
{
if
((
rawDataList
.
get
(
i
)[
3
]
==
null
||
rawDataList
.
get
(
i
)[
3
].
toString
().
trim
().
equals
(
""
))
&&
(!
selectedType
.
equals
(
BundleUtils
.
getLangString
(
"scenario.template.text"
))))
{
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.answer.required"
));
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.answer.required"
));
}
}
if
(
rawDataList
.
get
(
i
)[
4
]
==
null
&&
rawDataList
.
get
(
i
)[
4
].
toString
().
trim
().
equals
(
""
))
{
if
(
rawDataList
.
get
(
i
)[
4
]
==
null
&&
rawDataList
.
get
(
i
)[
4
].
toString
().
trim
().
equals
(
""
))
{
...
@@ -382,8 +370,9 @@ public class ScenarioServiceImpl implements ScenarioService {
...
@@ -382,8 +370,9 @@ public class ScenarioServiceImpl implements ScenarioService {
//insert data
//insert data
if
(
isValid
)
{
if
(
isValid
)
{
logger
.
info
(
"----- Data valid, start import scenario question -----"
);
for
(
int
i
=
0
;
i
<
rawDataList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
rawDataList
.
size
();
i
++)
{
buildQuestionsLst
(
rawDataList
);
}
}
}
else
{
}
else
{
FileOutputStream
fos
=
new
FileOutputStream
(
file
);
FileOutputStream
fos
=
new
FileOutputStream
(
file
);
...
@@ -395,6 +384,7 @@ public class ScenarioServiceImpl implements ScenarioService {
...
@@ -395,6 +384,7 @@ public class ScenarioServiceImpl implements ScenarioService {
logger
.
info
(
ex
.
getMessage
(),
ex
);
logger
.
info
(
ex
.
getMessage
(),
ex
);
result
.
put
(
"message"
,
BundleUtils
.
getLangString
(
"customer.errorValidate"
,
locale
));
result
.
put
(
"message"
,
BundleUtils
.
getLangString
(
"customer.errorValidate"
,
locale
));
}
}
logger
.
info
(
"Import Questions result:"
,
result
);
return
result
;
return
result
;
}
}
...
@@ -402,4 +392,16 @@ public class ScenarioServiceImpl implements ScenarioService {
...
@@ -402,4 +392,16 @@ public class ScenarioServiceImpl implements ScenarioService {
if
(
index
!=
null
&&
DataUtil
.
isLong
(
index
.
toString
()))
return
true
;
if
(
index
!=
null
&&
DataUtil
.
isLong
(
index
.
toString
()))
return
true
;
return
false
;
return
false
;
}
}
private
List
<
ScenarioQuestionDTO
>
buildQuestionsLst
(
List
<
Object
[]>
rawDatas
)
{
List
<
ScenarioQuestionDTO
>
lstQuestions
=
new
ArrayList
<>();
ScenarioQuestionDTO
questionDTO
=
null
;
for
(
int
i
=
0
;
i
<
rawDatas
.
size
();
i
++)
{
if
(
rawDatas
.
get
(
i
)[
0
]
!=
null
&&
!
rawDatas
.
get
(
i
)[
0
].
toString
().
trim
().
equals
(
""
))
{
questionDTO
=
new
ScenarioQuestionDTO
();
// questionDTO.setCampaignId();
}
}
return
lstQuestions
;
}
}
}
src/main/java/com/viettel/campaign/web/rest/ScenarioController.java
View file @
8b5ff8ff
...
@@ -122,7 +122,7 @@ public class ScenarioController {
...
@@ -122,7 +122,7 @@ public class ScenarioController {
String
message
=
(
String
)
map
.
get
(
"message"
);
String
message
=
(
String
)
map
.
get
(
"message"
);
return
ResponseEntity
.
ok
()
return
ResponseEntity
.
ok
()
.
header
(
"Content-Type"
,
Constants
.
MIME_TYPE
.
EXCEL_XLSX
)
.
header
(
"Content-Type"
,
Constants
.
MIME_TYPE
.
EXCEL_XLSX
)
.
header
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment; filename=
template_import_customer
.xlsx"
)
.
header
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment; filename=
import_scenario_result
.xlsx"
)
.
header
(
"Message"
,
message
)
.
header
(
"Message"
,
message
)
.
body
(
Files
.
readAllBytes
(
fileExport
.
toPath
()));
.
body
(
Files
.
readAllBytes
(
fileExport
.
toPath
()));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
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