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
3154ea4c
Commit
3154ea4c
authored
Sep 09, 2019
by
Vu Duy Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
anhvd commit fix bug
parent
21d7b924
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
8 deletions
+77
-8
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignRepositoryImpl.java
...ign/repository/ccms_full/impl/CampaignRepositoryImpl.java
+16
-3
src/main/java/com/viettel/campaign/service/impl/ScenarioQuestionServiceImpl.java
...el/campaign/service/impl/ScenarioQuestionServiceImpl.java
+2
-0
src/main/java/com/viettel/campaign/service/impl/ScenarioServiceImpl.java
...om/viettel/campaign/service/impl/ScenarioServiceImpl.java
+50
-5
src/main/resources/i18n/language_en.properties
src/main/resources/i18n/language_en.properties
+5
-0
src/main/resources/i18n/language_vi.properties
src/main/resources/i18n/language_vi.properties
+4
-0
No files found.
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignRepositoryImpl.java
View file @
3154ea4c
...
...
@@ -122,7 +122,11 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getCampaignCode
())
&&
!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getCampaignCode
().
trim
()))
{
sb
.
append
(
" AND a.CAMPAIGN_CODE IN (:p_code) "
);
if
(
requestDto
.
getCampaignCode
().
split
(
","
).
length
>
1
)
{
sb
.
append
(
" AND a.CAMPAIGN_CODE IN (:p_code) "
);
}
else
{
sb
.
append
(
" AND a.CAMPAIGN_CODE LIKE :p_code "
);
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getCampaignName
()))
{
sb
.
append
(
" AND UPPER(a.CAMPAIGN_NAME) LIKE :p_name"
);
...
...
@@ -165,8 +169,17 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
SQLQuery
query
=
session
.
createSQLQuery
(
sb
.
toString
());
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getCampaignCode
())
&&
!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getCampaignCode
().
trim
()))
{
String
[]
lstCode
=
requestDto
.
getCampaignCode
().
trim
().
split
(
","
);
query
.
setParameterList
(
"p_code"
,
lstCode
);
if
(
requestDto
.
getCampaignCode
().
split
(
","
).
length
>
1
)
{
String
[]
lstCode
=
requestDto
.
getCampaignCode
().
trim
().
split
(
","
);
query
.
setParameterList
(
"p_code"
,
lstCode
);
}
else
{
query
.
setParameter
(
"p_code"
,
"%"
+
requestDto
.
getCampaignCode
().
trim
().
toUpperCase
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getCampaignName
()))
{
...
...
src/main/java/com/viettel/campaign/service/impl/ScenarioQuestionServiceImpl.java
View file @
3154ea4c
...
...
@@ -70,6 +70,8 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
List
<
ScenarioAnswerDTO
>
lstAnswers
=
new
ArrayList
<>();
List
<
ScenarioAnswer
>
lstAnswersToInsert
=
new
ArrayList
<>();
try
{
if
(
scenarioQuestionDTO
.
getQuestion
()
!=
null
&&
scenarioQuestionDTO
.
getQuestion
()
!=
""
)
scenarioQuestionDTO
.
setQuestion
(
scenarioQuestionDTO
.
getQuestion
().
trim
());
ScenarioQuestion
scenarioQuestion
=
modelMapper
.
map
(
scenarioQuestionDTO
,
ScenarioQuestion
.
class
);
scenarioQuestion
.
setCreateTime
(
new
Date
());
...
...
src/main/java/com/viettel/campaign/service/impl/ScenarioServiceImpl.java
View file @
3154ea4c
...
...
@@ -247,14 +247,14 @@ public class ScenarioServiceImpl implements ScenarioService {
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
return
null
;
}
finally
{
}
finally
{
//if (workbook != null) workbook.close();
}
}
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
Map
<
String
,
Object
>
readAndValidateCustomer
(
String
path
,
Long
scenarioId
,
Long
campaignId
,
Long
companySiteId
)
throws
IOException
{
public
Map
<
String
,
Object
>
readAndValidateCustomer
(
String
path
,
Long
scenarioId
,
Long
campaignId
,
Long
companySiteId
)
throws
IOException
{
Locale
locale
=
new
Locale
(
"vi"
,
"VN"
);
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"dd/MM/yyyy HH:mm:ss"
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
...
...
@@ -371,18 +371,52 @@ public class ScenarioServiceImpl implements ScenarioService {
if
(
rawDataList
.
get
(
i
)[
0
]
==
null
||
!
DataUtil
.
isNumber
(
rawDataList
.
get
(
i
)[
0
].
toString
()))
{
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.questionCode.required"
));
}
//question type
if
(
rawDataList
.
get
(
i
)[
1
]
==
null
||
rawDataList
.
get
(
i
)[
1
].
toString
().
trim
().
equals
(
""
))
{
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.questionType.required"
));
}
if
(
rawDataList
.
get
(
i
)[
1
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
1
].
toString
().
trim
().
equals
(
""
))
{
if
(
rawDataList
.
get
(
i
)[
1
].
toString
().
trim
().
equals
(
BundleUtils
.
getLangString
(
"scenario.template.singleChoice"
))
||
rawDataList
.
get
(
i
)[
1
].
toString
().
trim
().
equals
(
BundleUtils
.
getLangString
(
"scenario.template.multiChoice"
))
||
rawDataList
.
get
(
i
)[
1
].
toString
().
trim
().
equals
(
BundleUtils
.
getLangString
(
"scenario.template.text"
))
)
{
sb
=
sb
;
}
else
{
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.questionType.invalid"
));
}
}
//
if
(
rawDataList
.
get
(
i
)[
2
]
==
null
||
rawDataList
.
get
(
i
)[
2
].
toString
().
trim
().
equals
(
""
))
{
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.question.required"
));
}
//required
if
(
rawDataList
.
get
(
i
)[
5
]
==
null
||
rawDataList
.
get
(
i
)[
5
].
toString
().
trim
().
equals
(
""
))
{
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.required.required"
));
}
if
(
rawDataList
.
get
(
i
)[
5
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
5
].
toString
().
trim
().
equals
(
""
))
{
if
(
rawDataList
.
get
(
i
)[
5
].
toString
().
trim
().
equals
(
BundleUtils
.
getLangString
(
"scenario.template.yes"
))
||
rawDataList
.
get
(
i
)[
5
].
toString
().
trim
().
equals
(
BundleUtils
.
getLangString
(
"scenario.template.no"
))
)
{
sb
=
sb
;
}
else
{
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.required.invalid"
));
}
}
//
//default
if
(
rawDataList
.
get
(
i
)[
6
]
==
null
||
rawDataList
.
get
(
i
)[
6
].
toString
().
trim
().
equals
(
""
))
{
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.default.required"
));
}
if
(
rawDataList
.
get
(
i
)[
6
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
6
].
toString
().
trim
().
equals
(
""
))
{
if
(
rawDataList
.
get
(
i
)[
6
].
toString
().
trim
().
equals
(
BundleUtils
.
getLangString
(
"scenario.template.yes"
))
||
rawDataList
.
get
(
i
)[
6
].
toString
().
trim
().
equals
(
BundleUtils
.
getLangString
(
"scenario.template.no"
))
)
{
sb
=
sb
;
}
else
{
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.default.invalid"
));
}
}
//
}
//validate answer
...
...
@@ -392,9 +426,20 @@ public class ScenarioServiceImpl implements ScenarioService {
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"
));
}
//hash input
if
(
rawDataList
.
get
(
i
)[
4
]
==
null
&&
rawDataList
.
get
(
i
)[
4
].
toString
().
trim
().
equals
(
""
))
{
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.hashInput.required"
));
}
if
(
rawDataList
.
get
(
i
)[
4
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
4
].
toString
().
trim
().
equals
(
""
))
{
if
(
rawDataList
.
get
(
i
)[
4
].
toString
().
trim
().
equals
(
BundleUtils
.
getLangString
(
"scenario.template.yes"
))
||
rawDataList
.
get
(
i
)[
4
].
toString
().
trim
().
equals
(
BundleUtils
.
getLangString
(
"scenario.template.no"
))
)
{
sb
=
sb
;
}
else
{
sb
.
append
(
BundleUtils
.
getLangString
(
"scenario.hashInput.invalid"
));
}
}
//
if
((
rawDataList
.
get
(
i
)[
7
]
!=
null
&&
!
rawDataList
.
get
(
i
)[
7
].
toString
().
trim
().
equals
(
""
)))
{
if
((
rawDataList
.
get
(
i
)[
7
].
toString
().
trim
().
equals
(
tmpCurrentQuestionCode
))
||
!
validateMappingQuestion
(
rawDataList
.
get
(
i
)[
7
].
toString
().
trim
(),
tmpCurrentQuestionCode
,
lstImportQuestionCodes
))
...
...
@@ -429,7 +474,7 @@ public class ScenarioServiceImpl implements ScenarioService {
ScenarioQuestion
question
=
questionRepository
.
findScenarioQuestionByCodeAndCompanySiteId
(
item
.
getMappingQuestionCode
(),
item
.
getCompanySiteId
());
if
(
question
!=
null
)
{
ScenarioAnswer
answerForUpdate
=
answerRepository
.
findScenarioAnswerByCode
(
item
.
getCode
());
if
(
answerForUpdate
!=
null
)
{
if
(
answerForUpdate
!=
null
)
{
answerForUpdate
.
setMappingQuestionId
(
question
.
getScenarioQuestionId
());
answerRepository
.
save
(
answerForUpdate
);
}
...
...
@@ -454,9 +499,9 @@ public class ScenarioServiceImpl implements ScenarioService {
}
catch
(
Exception
ex
)
{
logger
.
info
(
ex
.
getMessage
(),
ex
);
result
.
put
(
"message"
,
BundleUtils
.
getLangString
(
"customer.errorValidate"
,
locale
));
}
finally
{
}
finally
{
if
(
workbook
!=
null
)
workbook
.
close
();
if
(
fis
!=
null
)
fis
.
close
();
if
(
fis
!=
null
)
fis
.
close
();
}
return
result
;
}
...
...
src/main/resources/i18n/language_en.properties
View file @
3154ea4c
...
...
@@ -138,3 +138,8 @@ scenario.mappingQuestion.invalid="Mapping question invalid"
ok
=
"Imported"
error
=
"Error"
scenario.questionType.invalid
=
"Question type invalid"
scenario.required.invalid
=
"Required field invalid"
scenario.default.invalid
=
"Default field invalid"
scenario.hashInput.invalid
=
"Has input field invalid"
src/main/resources/i18n/language_vi.properties
View file @
3154ea4c
...
...
@@ -141,6 +141,10 @@ scenario.mappingQuestion.invalid="Câu hỏi liên kết không hợp lệ"
ok
=
"Thành công"
error
=
"Thất bại"
scenario.questionType.invalid
=
"Loại câu hỏi không hợp lệ"
scenario.required.invalid
=
"Giá trị rường bắt buộc không hợp lệ"
scenario.default.invalid
=
"Giá trị trường mặc định không hợp lệ"
scenario.hashInput.invalid
=
"Giá trị nhập text không hợp lệ"
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