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
e5e6e51e
Commit
e5e6e51e
authored
Aug 07, 2019
by
=
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hungtt-commit service camp-exe-interactive
parent
d49770c8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
142 additions
and
19 deletions
+142
-19
src/main/java/com/viettel/campaign/repository/CampaignExecuteRepository.java
...iettel/campaign/repository/CampaignExecuteRepository.java
+2
-1
src/main/java/com/viettel/campaign/repository/impl/CampaignExecuteRepositoryImp.java
...ampaign/repository/impl/CampaignExecuteRepositoryImp.java
+106
-2
src/main/java/com/viettel/campaign/service/impl/CampaignExecuteServiceImp.java
...ttel/campaign/service/impl/CampaignExecuteServiceImp.java
+1
-4
src/main/java/com/viettel/campaign/web/dto/request_dto/CampaignRequestDTO.java
...ttel/campaign/web/dto/request_dto/CampaignRequestDTO.java
+16
-0
src/main/java/com/viettel/campaign/web/rest/controller/CampaignController.java
...ttel/campaign/web/rest/controller/CampaignController.java
+1
-6
src/main/resources/sql/campaign-execute/get-execute-interactive.sql
...esources/sql/campaign-execute/get-execute-interactive.sql
+16
-6
No files found.
src/main/java/com/viettel/campaign/repository/CampaignExecuteRepository.java
View file @
e5e6e51e
...
@@ -2,6 +2,7 @@ package com.viettel.campaign.repository;
...
@@ -2,6 +2,7 @@ package com.viettel.campaign.repository;
import
com.viettel.campaign.web.dto.ApParamDTO
;
import
com.viettel.campaign.web.dto.ApParamDTO
;
import
com.viettel.campaign.web.dto.ContactCustResultDTO
;
import
com.viettel.campaign.web.dto.ContactCustResultDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO
;
import
com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
...
@@ -16,6 +17,6 @@ public interface CampaignExecuteRepository {
...
@@ -16,6 +17,6 @@ public interface CampaignExecuteRepository {
List
<
ApParamDTO
>
getComboCampaignType
(
String
companySiteId
);
List
<
ApParamDTO
>
getComboCampaignType
(
String
companySiteId
);
List
<
ContactCustResultDTO
>
getInteractiveResult
(
CampaignRequestDTO
dto
);
ResultDTO
getInteractiveResult
(
CampaignRequestDTO
dto
);
//</editor-fold: hungtt>
//</editor-fold: hungtt>
}
}
src/main/java/com/viettel/campaign/repository/impl/CampaignExecuteRepositoryImp.java
View file @
e5e6e51e
...
@@ -2,17 +2,30 @@ package com.viettel.campaign.repository.impl;
...
@@ -2,17 +2,30 @@ package com.viettel.campaign.repository.impl;
import
com.viettel.campaign.repository.CampaignExecuteRepository
;
import
com.viettel.campaign.repository.CampaignExecuteRepository
;
import
com.viettel.campaign.utils.Constants
;
import
com.viettel.campaign.utils.Constants
;
import
com.viettel.campaign.utils.DataUtil
;
import
com.viettel.campaign.utils.HibernateUtil
;
import
com.viettel.campaign.utils.SQLBuilder
;
import
com.viettel.campaign.utils.SQLBuilder
;
import
com.viettel.campaign.web.dto.ApParamDTO
;
import
com.viettel.campaign.web.dto.ApParamDTO
;
import
com.viettel.campaign.web.dto.ContactCustResultDTO
;
import
com.viettel.campaign.web.dto.ContactCustResultDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO
;
import
com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO
;
import
org.hibernate.SQLQuery
;
import
org.hibernate.Session
;
import
org.hibernate.SessionFactory
;
import
org.hibernate.transform.Transformers
;
import
org.hibernate.type.*
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.jdbc.core.BeanPropertyRowMapper
;
import
org.springframework.jdbc.core.BeanPropertyRowMapper
;
import
org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
;
import
org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
javax.persistence.EntityManager
;
import
javax.persistence.Query
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -26,6 +39,9 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
...
@@ -26,6 +39,9 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
@Autowired
@Autowired
NamedParameterJdbcTemplate
namedParameterJdbcTemplate
;
NamedParameterJdbcTemplate
namedParameterJdbcTemplate
;
@Autowired
EntityManager
entityManager
;
@Override
@Override
public
List
<
ApParamDTO
>
getComboBoxStatus
(
String
companySiteId
,
String
completeType
)
{
public
List
<
ApParamDTO
>
getComboBoxStatus
(
String
companySiteId
,
String
completeType
)
{
List
<
ApParamDTO
>
list
=
new
ArrayList
<>();
List
<
ApParamDTO
>
list
=
new
ArrayList
<>();
...
@@ -57,7 +73,95 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
...
@@ -57,7 +73,95 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
}
}
@Override
@Override
public
List
<
ContactCustResultDTO
>
getInteractiveResult
(
CampaignRequestDTO
dto
)
{
public
ResultDTO
getInteractiveResult
(
CampaignRequestDTO
dto
)
{
return
null
;
ResultDTO
resultDTO
=
new
ResultDTO
();
List
<
ContactCustResultDTO
>
list
=
new
ArrayList
<>();
SessionFactory
sessionFactory
=
HibernateUtil
.
getSessionFactory
();
Session
session
=
sessionFactory
.
openSession
();
session
.
beginTransaction
();
StringBuilder
sqlBuilder
=
new
StringBuilder
();
try
{
String
sql
=
SQLBuilder
.
getSqlQueryById
(
Constants
.
SQL_MODULES
.
MODULE_EXECUTE
,
"get-execute-interactive"
);
sqlBuilder
.
append
(
sql
);
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignName
().
trim
()))
{
sqlBuilder
.
append
(
" and upper(campaignName) like upper(:p_campaign_name)"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getAgentId
().
trim
()))
{
sqlBuilder
.
append
(
" and upper(userName) like upper(:p_user_name)"
);
}
SQLQuery
query
=
session
.
createSQLQuery
(
sqlBuilder
.
toString
());
query
.
setParameterList
(
"p_list_campaign_id"
,
dto
.
getCampaignId
().
trim
().
split
(
","
));
query
.
setParameter
(
"p_customer_id"
,
dto
.
getCustomerId
().
trim
());
query
.
setParameter
(
"p_date_from"
,
dto
.
getFromDate
().
trim
());
query
.
setParameter
(
"p_date_to"
,
dto
.
getToDate
().
trim
());
query
.
setParameterList
(
"p_list_contact_status"
,
dto
.
getContactStatus
().
trim
().
split
(
","
));
query
.
setParameterList
(
"p_list_survey_status"
,
dto
.
getSurveyStatus
().
trim
().
split
(
","
));
query
.
setParameterList
(
"p_list_record_status"
,
dto
.
getRecordStatus
().
trim
().
split
(
","
));
query
.
setParameter
(
"p_phone_number"
,
dto
.
getPhoneNumber
().
trim
());
query
.
setParameter
(
"p_call_time_from"
,
dto
.
getCallTimeFrom
().
trim
());
query
.
setParameter
(
"p_call_time_to"
,
dto
.
getCallTimeTo
().
trim
());
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignName
().
trim
()))
{
query
.
setParameter
(
"p_campaign_name"
,
dto
.
getCampaignName
().
trim
());
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getAgentId
().
trim
()))
{
query
.
setParameter
(
"p_user_name"
,
dto
.
getAgentId
().
trim
());
}
query
.
addScalar
(
"campaignCode"
,
new
StringType
());
query
.
addScalar
(
"campaignName"
,
new
StringType
());
query
.
addScalar
(
"userName"
,
new
StringType
());
query
.
addScalar
(
"phoneNumber"
,
new
LongType
());
query
.
addScalar
(
"customerName"
,
new
StringType
());
query
.
addScalar
(
"createTime"
,
new
DateType
());
query
.
addScalar
(
"contactStatus"
,
new
StringType
());
query
.
addScalar
(
"surveyStatus"
,
new
StringType
());
query
.
addScalar
(
"status"
,
new
ShortType
());
query
.
addScalar
(
"recordStatus"
,
new
ShortType
());
query
.
setResultTransformer
(
Transformers
.
aliasToBean
(
ContactCustResultDTO
.
class
));
int
count
=
0
;
list
=
query
.
list
();
if
(
list
.
size
()
>
0
)
{
count
=
list
.
size
();
}
Pageable
pageable
=
SQLBuilder
.
buildPageable
(
dto
);
if
(
pageable
!=
null
)
{
query
.
setFirstResult
(
pageable
.
getPageNumber
()
*
pageable
.
getPageSize
());
query
.
setMaxResults
(
pageable
.
getPageSize
());
}
List
<
ContactCustResultDTO
>
data
=
query
.
list
();
for
(
ContactCustResultDTO
contactCustResultDTO:
data
)
{
if
(!
"AGENT"
.
equals
(
dto
.
getRoleUser
()))
{
contactCustResultDTO
.
setEnableEdit
(
true
);
}
else
{
if
(
contactCustResultDTO
.
getRecordStatus
()
==
2
)
{
contactCustResultDTO
.
setEnableEdit
(
true
);
}
else
if
(
contactCustResultDTO
.
getRecordStatus
()
==
1
){
/**
* Hoi chi linh xac dinh thoi gian 24h ke tu khi da luu kieu gi??????
*/
}
else
{
contactCustResultDTO
.
setEnableEdit
(
false
);
}
}
}
Page
<
ContactCustResultDTO
>
dataPage
=
new
PageImpl
<>(
data
,
pageable
,
count
);
resultDTO
.
setData
(
dataPage
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
}
catch
(
Exception
e
)
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
logger
.
error
(
e
.
getMessage
(),
e
);
}
finally
{
session
.
close
();
}
return
resultDTO
;
}
}
}
}
src/main/java/com/viettel/campaign/service/impl/CampaignExecuteServiceImp.java
View file @
e5e6e51e
...
@@ -55,10 +55,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
...
@@ -55,10 +55,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
public
ResultDTO
searchInteractiveResult
(
CampaignRequestDTO
dto
)
{
public
ResultDTO
searchInteractiveResult
(
CampaignRequestDTO
dto
)
{
ResultDTO
resultDTO
=
new
ResultDTO
();
ResultDTO
resultDTO
=
new
ResultDTO
();
try
{
try
{
List
<
ContactCustResultDTO
>
lst
=
campaignExecuteRepository
.
getInteractiveResult
(
dto
);
resultDTO
=
campaignExecuteRepository
.
getInteractiveResult
(
dto
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
resultDTO
.
setData
(
lst
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
...
...
src/main/java/com/viettel/campaign/web/dto/request_dto/CampaignRequestDTO.java
View file @
e5e6e51e
...
@@ -25,4 +25,20 @@ public class CampaignRequestDTO extends BaseDTO {
...
@@ -25,4 +25,20 @@ public class CampaignRequestDTO extends BaseDTO {
String
companySiteId
;
String
companySiteId
;
String
agentId
;
String
agentId
;
String
types
;
String
types
;
String
phoneNumber
;
String
contactStatus
;
String
campaignStatus
;
String
customerId
;
String
customerName
;
String
callTimeTo
;
String
callTimeFrom
;
String
recordStatus
;
String
connectStatus
;
String
toDate
;
String
fromDate
;
String
campaignType
;
String
agentName
;
String
campaignId
;
String
surveyStatus
;
String
roleUser
;
}
}
src/main/java/com/viettel/campaign/web/rest/controller/CampaignController.java
View file @
e5e6e51e
...
@@ -60,12 +60,7 @@ public class CampaignController {
...
@@ -60,12 +60,7 @@ public class CampaignController {
@PostMapping
(
"/searchInteractiveResult"
)
@PostMapping
(
"/searchInteractiveResult"
)
@ResponseBody
@ResponseBody
public
ResponseEntity
<
ResultDTO
>
searchInteractiveResult
(
@RequestBody
CampaignRequestDTO
dto
)
{
public
ResponseEntity
<
ResultDTO
>
searchInteractiveResult
(
@RequestBody
CampaignRequestDTO
dto
)
{
ResultDTO
result
=
new
ResultDTO
();
ResultDTO
result
=
campaignExecuteService
.
searchInteractiveResult
(
dto
);
try
{
result
=
campaignExecuteService
.
searchInteractiveResult
(
dto
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
}
}
}
src/main/resources/sql/campaign-execute/get-execute-interactive.sql
View file @
e5e6e51e
...
@@ -9,9 +9,19 @@ select b.campaign_code campaignCode,
...
@@ -9,9 +9,19 @@ select b.campaign_code campaignCode,
g
.
status
status
,
g
.
status
status
,
a
.
status
recordStatus
a
.
status
recordStatus
from
contact_cust_result
a
from
contact_cust_result
a
left
join
campaign
b
on
a
.
campaign_id
=
b
.
campaign_id
left
join
campaign
b
on
a
.
campaign_id
=
b
.
campaign_id
left
join
vsa_users
c
on
a
.
agent_id
=
c
.
user_id
left
join
vsa_users
c
on
a
.
agent_id
=
c
.
user_id
left
join
customer
d
on
a
.
customer_id
=
d
.
customer_id
left
join
customer
d
on
a
.
customer_id
=
d
.
customer_id
left
join
campaign_complete_code
e
on
a
.
contact_status
=
e
.
complete_value
left
join
campaign_complete_code
e
on
a
.
contact_status
=
e
.
complete_value
left
join
campaign_complete_code
f
on
a
.
call_status
=
e
.
complete_value
left
join
campaign_complete_code
f
on
a
.
call_status
=
e
.
complete_value
left
join
campaign
g
on
a
.
campaign_id
=
b
.
campaign_id
left
join
campaign
g
on
a
.
campaign_id
=
b
.
campaign_id
where
a
.
campaign_id
in
(:
p_list_campaign_id
)
and
a
.
customer_id
like
'%'
||
:
p_customer_id
||
'%'
and
a
.
create_time
>=
to_date
(:
p_date_from
,
'DD/MM/YYYY'
)
and
a
.
create_time
<=
to_date
(:
p_date_to
,
'DD/MM/YYYY'
)
and
a
.
contact_status
in
(:
p_list_contact_status
)
and
a
.
call_status
in
(:
p_list_survey_status
)
and
a
.
status
in
(:
p_list_record_status
)
and
a
.
phone_number
like
'%'
||
:
p_phone_number
||
'%'
and
a
.
duration_call
>=
:
p_call_time_from
and
a
.
duration_call
<=
:
p_call_time_to
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