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
21077399
Commit
21077399
authored
Aug 28, 2019
by
Vu Duy Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
anhvd commit secenario import
parent
90ccd9ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
src/main/java/com/viettel/campaign/service/impl/ScenarioQuestionServiceImpl.java
...el/campaign/service/impl/ScenarioQuestionServiceImpl.java
+5
-0
src/main/java/com/viettel/campaign/service/impl/ScenarioServiceImpl.java
...om/viettel/campaign/service/impl/ScenarioServiceImpl.java
+8
-5
No files found.
src/main/java/com/viettel/campaign/service/impl/ScenarioQuestionServiceImpl.java
View file @
21077399
...
@@ -239,6 +239,8 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
...
@@ -239,6 +239,8 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
return
resultDTO
;
return
resultDTO
;
}
}
try
{
try
{
scenarioQuestionDTO
.
setCode
(
scenarioQuestionDTO
.
getCode
().
trim
());
scenarioQuestionDTO
.
setQuestion
(
scenarioQuestionDTO
.
getQuestion
().
trim
());
ScenarioQuestion
scenarioQuestion
=
modelMapper
.
map
(
scenarioQuestionDTO
,
ScenarioQuestion
.
class
);
ScenarioQuestion
scenarioQuestion
=
modelMapper
.
map
(
scenarioQuestionDTO
,
ScenarioQuestion
.
class
);
if
(
scenarioQuestion
.
getScenarioQuestionId
()
!=
null
)
{
if
(
scenarioQuestion
.
getScenarioQuestionId
()
!=
null
)
{
...
@@ -271,6 +273,8 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
...
@@ -271,6 +273,8 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
campaignLogAnswer
.
setCampaignId
(
scenarioQuestion
.
getCampaignId
());
campaignLogAnswer
.
setCampaignId
(
scenarioQuestion
.
getCampaignId
());
if
(
item
.
getScenarioAnswerId
()
!=
null
)
{
if
(
item
.
getScenarioAnswerId
()
!=
null
)
{
item
.
setCode
(
item
.
getCode
().
trim
());
item
.
setAnswer
(
item
.
getAnswer
().
trim
());
ScenarioAnswer
answer
=
modelMapper
.
map
(
item
,
ScenarioAnswer
.
class
);
ScenarioAnswer
answer
=
modelMapper
.
map
(
item
,
ScenarioAnswer
.
class
);
scenarioAnswerRepository
.
save
(
answer
);
scenarioAnswerRepository
.
save
(
answer
);
campaignLogAnswer
.
setCustomerId
(
answer
.
getScenarioAnswerId
());
campaignLogAnswer
.
setCustomerId
(
answer
.
getScenarioAnswerId
());
...
@@ -281,6 +285,7 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
...
@@ -281,6 +285,7 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
item
.
setScenarioQuestionId
(
scenarioQuestion
.
getScenarioQuestionId
());
item
.
setScenarioQuestionId
(
scenarioQuestion
.
getScenarioQuestionId
());
item
.
setCreateTime
(
new
Date
());
item
.
setCreateTime
(
new
Date
());
item
.
setStatus
((
short
)
1
);
item
.
setStatus
((
short
)
1
);
item
.
setAnswer
(
item
.
getAnswer
().
trim
());
ScenarioAnswer
answer
=
modelMapper
.
map
(
item
,
ScenarioAnswer
.
class
);
ScenarioAnswer
answer
=
modelMapper
.
map
(
item
,
ScenarioAnswer
.
class
);
scenarioAnswerRepository
.
save
(
answer
);
scenarioAnswerRepository
.
save
(
answer
);
campaignLogAnswer
.
setCustomerId
(
answer
.
getScenarioAnswerId
());
campaignLogAnswer
.
setCustomerId
(
answer
.
getScenarioAnswerId
());
...
...
src/main/java/com/viettel/campaign/service/impl/ScenarioServiceImpl.java
View file @
21077399
...
@@ -72,6 +72,9 @@ public class ScenarioServiceImpl implements ScenarioService {
...
@@ -72,6 +72,9 @@ public class ScenarioServiceImpl implements ScenarioService {
public
ResultDTO
update
(
ScenarioDTO
scenarioDTO
)
{
public
ResultDTO
update
(
ScenarioDTO
scenarioDTO
)
{
ResultDTO
resultDTO
=
new
ResultDTO
();
ResultDTO
resultDTO
=
new
ResultDTO
();
try
{
try
{
scenarioDTO
.
setCode
(
scenarioDTO
.
getCode
().
trim
());
if
(
scenarioDTO
.
getDescription
()
!=
null
)
scenarioDTO
.
setDescription
(
scenarioDTO
.
getDescription
().
trim
());
else
scenarioDTO
.
setDescription
(
""
);
scenarioDTO
.
setUpdateBy
(
null
);
scenarioDTO
.
setUpdateBy
(
null
);
scenarioDTO
.
setUpdateTime
(
new
Date
());
scenarioDTO
.
setUpdateTime
(
new
Date
());
...
@@ -368,10 +371,10 @@ public class ScenarioServiceImpl implements ScenarioService {
...
@@ -368,10 +371,10 @@ public class ScenarioServiceImpl implements ScenarioService {
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
(
""
))
{
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.hashInput.required"
));
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.hashInput.required"
));
}
}
if
((
rawDataList
.
get
(
i
)[
7
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
7
].
toString
().
trim
().
equals
(
""
)))
{
if
((
rawDataList
.
get
(
i
)[
7
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
7
].
toString
().
trim
().
equals
(
""
)))
{
if
((
rawDataList
.
get
(
i
)[
7
].
toString
().
trim
().
equals
(
tmpCurrentQuestionCode
))
||
if
((
rawDataList
.
get
(
i
)[
7
].
toString
().
trim
().
equals
(
tmpCurrentQuestionCode
))
||
validateMappingQuestion
(
rawDataList
.
get
(
i
)[
7
].
toString
().
trim
(),
tmpCurrentQuestionCode
,
lstImportQuestionCodes
))
validateMappingQuestion
(
rawDataList
.
get
(
i
)[
7
].
toString
().
trim
(),
tmpCurrentQuestionCode
,
lstImportQuestionCodes
))
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.mappingQuestion.invalid"
));
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.mappingQuestion.invalid"
));
}
}
}
}
...
@@ -415,12 +418,12 @@ public class ScenarioServiceImpl implements ScenarioService {
...
@@ -415,12 +418,12 @@ public class ScenarioServiceImpl implements ScenarioService {
}
}
private
boolean
validateMappingQuestion
(
String
mappingQuestion
,
String
currentQuestionCode
,
List
<
String
>
lstQuestionCode
)
{
private
boolean
validateMappingQuestion
(
String
mappingQuestion
,
String
currentQuestionCode
,
List
<
String
>
lstQuestionCode
)
{
if
(
mappingQuestion
==
currentQuestionCode
)
return
false
;
if
(
mappingQuestion
==
currentQuestionCode
)
return
false
;
String
duplicateCode
=
lstQuestionCode
.
stream
().
String
duplicateCode
=
lstQuestionCode
.
stream
().
filter
(
p
->
(
p
.
equals
(
mappingQuestion
)
&&
p
.
equals
(
currentQuestionCode
))).
filter
(
p
->
(
p
.
equals
(
mappingQuestion
)
&&
p
.
equals
(
currentQuestionCode
))).
findAny
().
orElse
(
null
);
findAny
().
orElse
(
null
);
if
(
duplicateCode
==
null
)
return
false
;
if
(
duplicateCode
==
null
)
return
false
;
// String notMappedCode = lstQuestionCode.stream().filter(p -> (!p.equals(mappingQuestion))).findAny().orElse(null);
// String notMappedCode = lstQuestionCode.stream().filter(p -> (!p.equals(mappingQuestion))).findAny().orElse(null);
// if(notMappedCode != null) return false;
// if(notMappedCode != null) return false;
...
...
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