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
d9859bbd
Commit
d9859bbd
authored
Aug 13, 2019
by
Phạm Duy Phi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://git.myitsol.com/hanv/service-campaign
parents
4185a1d8
6681858b
Changes
30
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
660 additions
and
90 deletions
+660
-90
src/main/java/com/viettel/campaign/job/CampaignJob.java
src/main/java/com/viettel/campaign/job/CampaignJob.java
+45
-8
src/main/java/com/viettel/campaign/model/acd_full/Agents.java
...main/java/com/viettel/campaign/model/acd_full/Agents.java
+175
-0
src/main/java/com/viettel/campaign/model/ccms_full/CustomerTime.java
...va/com/viettel/campaign/model/ccms_full/CustomerTime.java
+55
-0
src/main/java/com/viettel/campaign/repository/acd_full/AgentsRepository.java
...iettel/campaign/repository/acd_full/AgentsRepository.java
+10
-0
src/main/java/com/viettel/campaign/repository/ccms_full/CampaignExecuteRepository.java
...paign/repository/ccms_full/CampaignExecuteRepository.java
+2
-0
src/main/java/com/viettel/campaign/repository/ccms_full/CustomerRepository.java
...tel/campaign/repository/ccms_full/CustomerRepository.java
+5
-0
src/main/java/com/viettel/campaign/repository/ccms_full/CustomerTimeRepository.java
...campaign/repository/ccms_full/CustomerTimeRepository.java
+18
-0
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignExecuteRepositoryImp.java
...pository/ccms_full/impl/CampaignExecuteRepositoryImp.java
+95
-21
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignRepositoryImpl.java
...ign/repository/ccms_full/impl/CampaignRepositoryImpl.java
+6
-5
src/main/java/com/viettel/campaign/service/AgentsService.java
...main/java/com/viettel/campaign/service/AgentsService.java
+7
-0
src/main/java/com/viettel/campaign/service/CampaignExecuteService.java
.../com/viettel/campaign/service/CampaignExecuteService.java
+5
-0
src/main/java/com/viettel/campaign/service/CustomerService.java
...in/java/com/viettel/campaign/service/CustomerService.java
+14
-5
src/main/java/com/viettel/campaign/service/CustomerTimeService.java
...ava/com/viettel/campaign/service/CustomerTimeService.java
+33
-0
src/main/java/com/viettel/campaign/service/impl/AgentsServiceImpl.java
.../com/viettel/campaign/service/impl/AgentsServiceImpl.java
+35
-0
src/main/java/com/viettel/campaign/service/impl/CampaignExecuteServiceImp.java
...ttel/campaign/service/impl/CampaignExecuteServiceImp.java
+6
-0
src/main/java/com/viettel/campaign/service/impl/CampaignServiceImpl.java
...om/viettel/campaign/service/impl/CampaignServiceImpl.java
+1
-0
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
...om/viettel/campaign/service/impl/CustomerServiceImpl.java
+49
-13
src/main/java/com/viettel/campaign/web/dto/CampaignCustomerDTO.java
...ava/com/viettel/campaign/web/dto/CampaignCustomerDTO.java
+1
-1
src/main/java/com/viettel/campaign/web/dto/ContactCustResultDTO.java
...va/com/viettel/campaign/web/dto/ContactCustResultDTO.java
+1
-1
src/main/java/com/viettel/campaign/web/dto/CustomerListDTO.java
...in/java/com/viettel/campaign/web/dto/CustomerListDTO.java
+3
-0
src/main/java/com/viettel/campaign/web/dto/request_dto/CampaignRequestDTO.java
...ttel/campaign/web/dto/request_dto/CampaignRequestDTO.java
+1
-0
src/main/java/com/viettel/campaign/web/rest/AgentsController.java
.../java/com/viettel/campaign/web/rest/AgentsController.java
+28
-0
src/main/java/com/viettel/campaign/web/rest/CampaignCompleteCodeController.java
...tel/campaign/web/rest/CampaignCompleteCodeController.java
+2
-0
src/main/java/com/viettel/campaign/web/rest/CampaignController.java
...ava/com/viettel/campaign/web/rest/CampaignController.java
+1
-22
src/main/java/com/viettel/campaign/web/rest/CustomerController.java
...ava/com/viettel/campaign/web/rest/CustomerController.java
+2
-2
src/main/resources/sql/campaign-execute/get-combo-campaign-type.sql
...esources/sql/campaign-execute/get-combo-campaign-type.sql
+3
-1
src/main/resources/sql/campaign-execute/get-combo-status.sql
src/main/resources/sql/campaign-execute/get-combo-status.sql
+1
-1
src/main/resources/sql/campaign-execute/get-execute-interactive.sql
...esources/sql/campaign-execute/get-execute-interactive.sql
+3
-2
src/main/resources/sql/campaign-mng/search-customer-list-info-from-customer-list.sql
...aign-mng/search-customer-list-info-from-customer-list.sql
+18
-8
src/main/resources/sql/campaign-mng/search-individual-customer.sql
...resources/sql/campaign-mng/search-individual-customer.sql
+35
-0
No files found.
src/main/java/com/viettel/campaign/job/CampaignJob.java
View file @
d9859bbd
package
com.viettel.campaign.job
;
import
com.viettel.campaign.model.ccms_full.Campaign
;
import
com.viettel.campaign.model.ccms_full.Customer
;
import
com.viettel.campaign.model.ccms_full.CustomerTime
;
import
com.viettel.campaign.model.ccms_full.ProcessConfig
;
import
com.viettel.campaign.service.CampaignService
;
import
com.viettel.campaign.service.CustomerService
;
import
com.viettel.campaign.service.CustomerTimeService
;
import
com.viettel.campaign.service.ProcessConfigService
;
import
com.viettel.campaign.utils.DateTimeUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
...
...
@@ -34,6 +36,12 @@ public class CampaignJob {
@Autowired
private
CampaignService
campaignService
;
@Autowired
private
CustomerTimeService
customerTimeService
;
@Autowired
private
CustomerService
customerService
;
// @Scheduled(fixedRate = 5000)
// @Transactional( propagation = Propagation.REQUIRED)
public
void
process
()
{
...
...
@@ -45,26 +53,30 @@ public class CampaignJob {
switch
(
p
.
getConfigCode
()){
case
CUSTOMER_INACTIVE_DUARATION:
if
(
isExecute
){
List
<
Customer
>
customers
=
customerService
.
findAllByCondition
(
p
.
getSiteId
(),
new
Date
());
updateCustomer
(
customers
);
updateCustomerTime
(
customers
);
log
.
info
(
"Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}"
,
p
.
getSiteId
());
p
.
setLastProcess
(
new
Date
());
processConfigService
.
update
(
p
);
}
break
;
case
CRON_EXPRESSION_CHECK_START:
// process
if
(
isExecute
){
// chuyen trang thai Du thao sang Trien khai
log
.
info
(
"thay doi trang thai"
);
List
<
Long
>
status
=
new
ArrayList
<>();
status
.
add
(
1L
);
status
.
add
(
1L
);
List
<
Campaign
>
campaigns
=
campaignService
.
findCampaignByCompanySiteIdAndStartTimeIsLessThanEqualAndStatusIn
(
p
.
getSiteId
(),
new
Date
(),
status
);
campaigns
.
parallelStream
().
forEach
(
campaign
->
{
log
.
info
(
"Chuyen trang thai chien dich ... #{} ... tu Du thao sang Trien khai"
,
campaign
.
getCampaignId
());
campaign
.
setProcessStatus
(
1
);
campaign
.
setStatus
(
2L
);
campaign
.
setCampaignStart
(
new
Date
());
campaignService
.
updateProcess
(
campaign
);
});
// update last check
log
.
info
(
"Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}"
,
p
.
getSiteId
());
p
.
setLastProcess
(
new
Date
());
processConfigService
.
update
(
p
);
}
...
...
@@ -72,25 +84,50 @@ public class CampaignJob {
case
CRON_EXPRESSION_CHECK_END:
// process
if
(
isExecute
){
// chuyen trang thai sang ket thuc
List
<
Long
>
status
=
new
ArrayList
<>();
status
.
add
(
2L
);
status
.
add
(
3L
);
List
<
Campaign
>
campaigns
=
campaignService
.
findCampaignByCompanySiteIdAndEndTimeIsLessThanEqualAndStatusIn
(
p
.
getSiteId
(),
new
Date
(),
status
);
campaigns
.
parallelStream
().
forEach
(
campaign
->
{
log
.
info
(
"Chuyen trang thai chien dich ... #{} ... sang Ket thuc"
,
campaign
.
getCampaignId
());
campaign
.
setStatus
(
4L
);
campaign
.
setCampaignEnd
(
new
Date
());
campaignService
.
updateProcess
(
campaign
);
});
log
.
info
(
"Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}"
,
p
.
getSiteId
());
p
.
setLastProcess
(
new
Date
());
processConfigService
.
update
(
p
);
}
break
;
default
:
// update last check time
}
});
}
private
void
updateCustomer
(
List
<
Customer
>
customers
){
customers
.
parallelStream
().
forEach
(
c
->
{
log
.
info
(
"Cap nhat trang thai khoa cua KH ... #{}"
,
c
.
getCustomerId
());
c
.
setIpccStatus
(
"active"
);
customerService
.
update
(
c
);
});
}
private
void
updateCustomerTime
(
List
<
Customer
>
customers
){
customers
.
parallelStream
().
forEach
(
customer
->
{
// find all customer_time by customerId
List
<
CustomerTime
>
customerTimes
=
customerTimeService
.
findByCustomerId
(
customer
.
getCustomerId
());
customerTimes
.
parallelStream
().
forEach
(
customerTime
->
{
log
.
info
(
"Cap nhat Customer time cua KH ... #{}"
,
customerTime
.
getCustomerId
());
customerTime
.
setStatus
(
2
);
customerTime
.
setUpdateTime
(
new
Date
());
customerTimeService
.
update
(
customerTime
);
});
});
}
}
src/main/java/com/viettel/campaign/model/acd_full/Agents.java
0 → 100644
View file @
d9859bbd
package
com.viettel.campaign.model.acd_full
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.persistence.*
;
import
java.util.Date
;
@Entity
@Table
(
name
=
"Agents"
)
@Getter
@Setter
public
class
Agents
{
@Id
@Basic
(
optional
=
false
)
@Column
(
name
=
"AGENT_ID"
)
private
String
agentId
;
@Column
(
name
=
"DESCRIPTION"
)
private
String
description
;
@Column
(
name
=
"SYSTEM_STATUS"
)
private
String
systemStatus
;
@Column
(
name
=
"USER_STATUS"
)
private
String
userStatus
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_START_WORK"
)
private
Date
lastStartWork
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_FINISH_WORK"
)
private
Date
lastFinishWork
;
@Column
(
name
=
"LOGIN_TYPE"
)
private
String
loginType
;
@Column
(
name
=
"VSA_USER_LOGIN"
)
private
String
vsaUserLogin
;
@Column
(
name
=
"CALL_STATUS"
)
private
String
callStatus
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_CHANGE_STATUS"
)
private
Date
lastChangeStatus
;
@Column
(
name
=
"IP_LOGIN"
)
private
String
ipLogin
;
@Column
(
name
=
"NUM_REJECTCALL"
)
private
String
numRejectcall
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LOGIN_TIME"
)
private
Date
loginTime
;
@Column
(
name
=
"GROUP_NAME"
)
private
String
groupName
;
@Column
(
name
=
"TOTAL_ANSWER_CALL"
)
private
String
totalAnswerCall
;
@Column
(
name
=
"TOTAL_ANSWER_TIME"
)
private
String
totalAnswerTime
;
@Column
(
name
=
"CALLOUT_ID"
)
private
Integer
calloutId
;
@Column
(
name
=
"LAST_QUEUE_ANSWER"
)
private
String
lastQueueAnswer
;
@Column
(
name
=
"EMAIL_USER_STATUS"
)
private
String
emailUserAnswer
;
@Column
(
name
=
"CHAT_USER_STATUS"
)
private
String
chatUserStatus
;
@Column
(
name
=
"SMS_USER_STATUS"
)
private
String
smsUserStatus
;
@Column
(
name
=
"MULTI_CHANNEL_USER_STATUS"
)
private
String
multiChannelUserStatus
;
@Column
(
name
=
"MAX_TRANSACTION_EMAIL"
)
private
Integer
maxTransactionEmail
=
1
;
@Column
(
name
=
"MAX_TRANSACTION_CHAT"
)
private
Integer
maxTransactionChat
=
1
;
@Column
(
name
=
"MAX_CURRENT_TRANSACTION"
)
private
Integer
maxCurrentTransaction
=
6
;
@Column
(
name
=
"TOTAL_TRANSACTION"
)
private
Integer
totalTransaction
=
0
;
@Column
(
name
=
"EMAIL_SYSTEM_STATUS"
)
private
Integer
emailSystemStatus
=
0
;
@Column
(
name
=
"CHAT_SYSTEM_STATUS"
)
private
Integer
chatSystemStatus
=
0
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_CHANGE_CHAT_STATUS"
)
private
Date
lastChangeChatStatus
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_CHANGE_EMAIL_STATUS"
)
private
Date
lastChangeEmailStatus
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_CHANGE_MULTI_STATUS"
)
private
Date
lastChangeMultiStatus
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_START_WORK_CHAT"
)
private
Date
lastStartWorkChat
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_START_WORK_EMAIL"
)
private
Date
lastStartWorkEmail
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_FINISH_WORK_CHAT"
)
private
Date
lastFinishWorkChat
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_FINISH_WORK_EMAIL"
)
private
Date
lastFinishWorkEmail
;
@Column
(
name
=
"TOTAL_ANSWER_CHAT"
)
private
Long
totalAnswerChat
;
@Column
(
name
=
"TOTAL_ANSWER_EMAIL"
)
private
Long
totalAnswerEmail
;
@Column
(
name
=
"TOTAL_ANSWER_TIME_EMAIL"
)
private
Long
totalAnswerTimeEmail
;
@Column
(
name
=
"TOTAL_ANSWER_TIME_CHAT"
)
private
Long
totalAnswerTimeChat
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_ASSIGN_TIME_SMS"
)
private
Date
lastAssignTimeSms
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_CHANGE_SMS_STATUS"
)
private
Date
lastChangeSmsStatus
;
@Column
(
name
=
"MAX_TRANSACTION_SMS"
)
private
Integer
maxTransactionSms
=
1
;
@Column
(
name
=
"SMS_SYSTEM_STATUS"
)
private
Integer
smsSystemStatus
=
0
;
@Column
(
name
=
"FACEBOOK_SYSTEM_STATUS"
)
private
Integer
facebookSystemStatus
=
0
;
@Column
(
name
=
"FACEBOOK_USER_STATUS"
)
private
String
facebookUserStatus
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_START_WORK_SMS"
)
private
Date
lastStartWorkSms
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_START_WORK_FACEBOOK"
)
private
Date
lastStartWorkFacebook
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_FINISH_WORK_SMS"
)
private
Date
lastFinishWorkSms
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_FINISH_WORK_FACEBOOK"
)
private
Date
lastFinishWorkFacebook
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_CHANGE_FACEBOOK_STATUS"
)
private
Date
lastChangeFacebookStatus
;
@Column
(
name
=
"MAX_TRANSACTION_FACEBOOK"
)
private
Integer
maxTransactionFacebook
=
1
;
@Column
(
name
=
"TICKET_USER_STATUS"
)
private
String
ticketUserStatus
;
@Column
(
name
=
"TICKET_SYSTEM_STATUS"
)
private
Integer
ticketSystemStatus
;
@Column
(
name
=
"MAX_TRANSACTION_TICKET"
)
private
Integer
maxTransactionTicket
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_START_WORK_TICKET"
)
private
Date
lastStartWorkTicket
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_FINISH_WORK_TICKET"
)
private
Date
lastFinishWorkTicket
;
@Column
(
name
=
"COMPANY_SITE_ID"
)
private
Long
companySiteId
;
@Column
(
name
=
"SITE_ID"
)
private
Long
siteId
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"LAST_CHANGE_TICKET_STATUS"
)
private
Date
lastChangeTicketStatus
;
@Column
(
name
=
"AGENT_TYPE"
)
private
Short
agentType
;
@Column
(
name
=
"STATUS"
)
private
Long
status
=
1L
;
@Column
(
name
=
"CREATE_BY"
)
private
String
createBy
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"CREATE_DATE"
)
private
Date
createDate
;
@Column
(
name
=
"UPDATE_BY"
)
private
String
updateBy
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"UPDATE_DATE"
)
private
Date
updateDate
;
@Column
(
name
=
"USER_KAZOO_ID"
)
private
String
userKazooId
;
@Column
(
name
=
"CAMPAIGN_SYSTEM_STATUS"
)
private
String
campaignSystemStatus
;
@Column
(
name
=
"CURRENT_CAMPAIGN_ID"
)
private
Long
currentCampaignId
;
}
src/main/java/com/viettel/campaign/model/ccms_full/CustomerTime.java
0 → 100644
View file @
d9859bbd
package
com.viettel.campaign.model.ccms_full
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotNull
;
import
java.util.Date
;
/**
* @author hanv_itsol
* @project campaign
*/
@Entity
@Table
(
name
=
"CUSTOMER_TIME"
)
@Getter
@Setter
public
class
CustomerTime
{
@Id
@NotNull
@Column
(
name
=
"CUSTOMER_TIME_ID"
)
private
Long
customerTimeId
;
@Column
(
name
=
"COMPANY_SITE_ID"
)
private
String
companySiteId
;
@Column
(
name
=
"CUSTOMER_ID"
)
private
String
customerId
;
@Column
(
name
=
"START_TIME"
)
private
Date
startTime
;
@Column
(
name
=
"END_TIME"
)
private
Date
endTime
;
@Column
(
name
=
"STATUS"
)
private
Integer
status
;
@Column
(
name
=
"CREATE_TIME"
)
private
Date
createTime
;
@Column
(
name
=
"UPDATE_TIME"
)
private
Date
updateTime
;
@Column
(
name
=
"CREATE_BY"
)
private
String
createBy
;
@Column
(
name
=
"UPDATE_BY"
)
private
String
updateBy
;
@Column
(
name
=
"CONTACT_CUST_RESULT_ID"
)
private
Long
contactCustResultId
;
}
src/main/java/com/viettel/campaign/repository/acd_full/AgentsRepository.java
0 → 100644
View file @
d9859bbd
package
com.viettel.campaign.repository.acd_full
;
import
com.viettel.campaign.model.acd_full.Agents
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.stereotype.Repository
;
@Repository
public
interface
AgentsRepository
extends
JpaRepository
<
Agents
,
String
>
{
Agents
getByAgentId
(
String
agentId
);
}
src/main/java/com/viettel/campaign/repository/ccms_full/CampaignExecuteRepository.java
View file @
d9859bbd
...
...
@@ -20,5 +20,7 @@ public interface CampaignExecuteRepository {
ResultDTO
getInteractiveResult
(
CampaignRequestDTO
dto
);
List
<
ContactCustResultDTO
>
getExcelInteractiveResult
(
CampaignRequestDTO
dto
);
List
<
ContactCustResultDTO
>
getContactCustById
(
CampaignRequestDTO
dto
);
//</editor-fold: hungtt>
}
src/main/java/com/viettel/campaign/repository/ccms_full/CustomerRepository.java
View file @
d9859bbd
...
...
@@ -9,6 +9,7 @@ import org.springframework.data.jpa.repository.Query;
import
org.springframework.data.repository.query.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.Date
;
import
java.util.List
;
@Repository
...
...
@@ -27,4 +28,8 @@ public interface CustomerRepository extends JpaRepository<Customer, Long> {
@Modifying
@Query
(
"delete from Customer c where c.customerId in (:ids)"
)
int
deleteIds
(
@Param
(
"ids"
)
List
<
Long
>
ids
);
@Query
(
"select c from Customer c left join com.viettel.campaign.model.ccms_full.CustomerTime ct on c.customerId = ct.customerId "
+
"where c.ipccStatus = 'locked' and c.siteId =?1 and ct.endTime <= ?2"
)
List
<
Customer
>
findAllByCondition
(
Long
siteId
,
Date
endTime
);
}
src/main/java/com/viettel/campaign/repository/ccms_full/CustomerTimeRepository.java
0 → 100644
View file @
d9859bbd
package
com.viettel.campaign.repository.ccms_full
;
import
com.viettel.campaign.model.ccms_full.CustomerTime
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* @author hanv_itsol
* @project campaign
*/
@Repository
public
interface
CustomerTimeRepository
extends
JpaRepository
<
CustomerTime
,
Long
>
{
List
<
CustomerTime
>
findByCustomerId
(
Long
customerId
);
}
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignExecuteRepositoryImp.java
View file @
d9859bbd
...
...
@@ -34,26 +34,25 @@ import java.util.concurrent.TimeUnit;
@Repository
public
class
CampaignExecuteRepositoryImp
implements
CampaignExecuteRepository
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Campaign
RepositoryImpl
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Campaign
ExecuteRepositoryImp
.
class
);
@Autowired
@Qualifier
(
DataSourceQualify
.
NAMED_JDBC_PARAMETER_TEMPLATE_CCMS_FULL
)
NamedParameterJdbcTemplate
namedParameterJdbcTemplate
;
@Autowired
@PersistenceContext
(
unitName
=
DataSourceQualify
.
JPA_UNIT_NAME_CCMS_FULL
)
@PersistenceContext
(
unitName
=
DataSourceQualify
.
JPA_UNIT_NAME_CCMS_FULL
)
EntityManager
entityManager
;
@Override
public
List
<
ApParamDTO
>
getComboBoxStatus
(
String
companySiteId
,
String
completeType
)
{
List
<
ApParamDTO
>
list
=
new
ArrayList
<>();
Map
<
String
,
String
>
params
=
new
HashMap
<>();
String
sql
=
SQLBuilder
.
getSqlQueryById
(
Constants
.
SQL_MODULES
.
MODULE_EXECUTE
,
"get-combo-
connect-
status"
);
String
sql
=
SQLBuilder
.
getSqlQueryById
(
Constants
.
SQL_MODULES
.
MODULE_EXECUTE
,
"get-combo-status"
);
try
{
params
.
put
(
"p_company_site_id"
,
companySiteId
);
params
.
put
(
"p_complete_type"
,
completeType
);
list
=
namedParameterJdbcTemplate
.
query
(
sql
,
params
,
BeanPropertyRowMapper
.
newInstance
(
ApParamDTO
.
class
));
// list = namedParameterJdbcTemplate.getJdbcTemplate().query(sql, (PreparedStatementSetter) params, BeanPropertyRowMapper.newInstance(ComboBoxDTO.class));
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
...
...
@@ -87,43 +86,78 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
String
sql
=
SQLBuilder
.
getSqlQueryById
(
Constants
.
SQL_MODULES
.
MODULE_EXECUTE
,
"get-execute-interactive"
);
sqlBuilder
.
append
(
sql
);
sqlBuilder
.
append
(
" and b.campaign_type in (:p_list_compaign_type)"
);
sqlBuilder
.
append
(
" and to_char(a.customer_id) like :p_customer_id"
);
sqlBuilder
.
append
(
" and to_char(a.contact_status) in (:p_list_contact_status)"
);
sqlBuilder
.
append
(
" and to_char(a.call_status) in (:p_list_survey_status)"
);
sqlBuilder
.
append
(
" and to_char(a.status) in (:p_list_record_status)"
);
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getPhoneNumber
()))
{
sqlBuilder
.
append
(
" and a.phone_number like :p_phone_number"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignId
()))
{
sqlBuilder
.
append
(
" and b.campaign_code in (:p_list_campaign_id) "
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignName
()))
{
sqlBuilder
.
append
(
" and upper(
campaignName) like upper(:p_campaign_name)
"
);
sqlBuilder
.
append
(
" and upper(
b.campaign_name) like :p_campaign_name
"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getAgentId
()))
{
sqlBuilder
.
append
(
" and upper(
userName) like upper(:p_user_name)
"
);
sqlBuilder
.
append
(
" and upper(
c.user_name) like :p_user_name
"
);
}
SQLQuery
query
=
session
.
createSQLQuery
(
sqlBuilder
.
toString
());
query
.
setParameterList
(
"p_list_campaign_id"
,
dto
.
getCampaignId
().
split
(
","
));
query
.
setParameter
(
"p_customer_id"
,
dto
.
getCustomerId
());
query
.
setParameter
(
"p_company_site_id"
,
dto
.
getCompanySiteId
());
query
.
setParameter
(
"p_customer_id"
,
"%"
+
dto
.
getCustomerId
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
query
.
setParameter
(
"p_date_from"
,
dto
.
getFromDate
());
query
.
setParameter
(
"p_date_to"
,
dto
.
getToDate
());
query
.
setParameterList
(
"p_list_compaign_type"
,
dto
.
getCampaignType
().
split
(
","
));
query
.
setParameterList
(
"p_list_contact_status"
,
dto
.
getContactStatus
().
split
(
","
));
query
.
setParameterList
(
"p_list_survey_status"
,
dto
.
getSurveyStatus
().
split
(
","
));
query
.
setParameterList
(
"p_list_record_status"
,
dto
.
getRecordStatus
().
split
(
","
));
query
.
setParameter
(
"p_phone_number"
,
dto
.
getPhoneNumber
());
query
.
setParameter
(
"p_call_time_from"
,
dto
.
getCallTimeFrom
());
query
.
setParameter
(
"p_call_time_to"
,
dto
.
getCallTimeTo
());
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignId
()))
{
query
.
setParameterList
(
"p_list_campaign_id"
,
dto
.
getCampaignId
().
split
(
","
));
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getPhoneNumber
()))
{
query
.
setParameter
(
"p_phone_number"
,
"%"
+
dto
.
getPhoneNumber
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignName
()))
{
query
.
setParameter
(
"p_campaign_name"
,
dto
.
getCampaignName
().
trim
());
query
.
setParameter
(
"p_campaign_name"
,
"%"
+
dto
.
getCampaignName
().
toUpperCase
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getAgentId
()))
{
query
.
setParameter
(
"p_user_name"
,
dto
.
getAgentId
().
trim
());
query
.
setParameter
(
"p_user_name"
,
"%"
+
dto
.
getAgentId
().
toUpperCase
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
}
query
.
addScalar
(
"campaignCode"
,
new
StringType
());
query
.
addScalar
(
"campaignName"
,
new
StringType
());
query
.
addScalar
(
"userName"
,
new
StringType
());
query
.
addScalar
(
"phoneNumber"
,
new
Lo
ngType
());
query
.
addScalar
(
"phoneNumber"
,
new
Stri
ngType
());
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
.
addScalar
(
"callTime"
,
new
LongType
());
query
.
setResultTransformer
(
Transformers
.
aliasToBean
(
ContactCustResultDTO
.
class
));
...
...
@@ -161,9 +195,9 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
logger
.
error
(
e
.
getMessage
(),
e
);
}
finally
{
session
.
close
();
}
return
resultDTO
;
}
}
@Override
public
List
<
ContactCustResultDTO
>
getExcelInteractiveResult
(
CampaignRequestDTO
dto
)
{
...
...
@@ -177,43 +211,78 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
String
sql
=
SQLBuilder
.
getSqlQueryById
(
Constants
.
SQL_MODULES
.
MODULE_EXECUTE
,
"get-execute-interactive"
);
sqlBuilder
.
append
(
sql
);
sqlBuilder
.
append
(
" and b.campaign_type in (:p_list_compaign_type)"
);
sqlBuilder
.
append
(
" and to_char(a.customer_id) like :p_customer_id"
);
sqlBuilder
.
append
(
" and to_char(a.contact_status) in (:p_list_contact_status)"
);
sqlBuilder
.
append
(
" and to_char(a.call_status) in (:p_list_survey_status)"
);
sqlBuilder
.
append
(
" and to_char(a.status) in (:p_list_record_status)"
);
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getPhoneNumber
()))
{
sqlBuilder
.
append
(
" and a.phone_number like :p_phone_number"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignId
()))
{
sqlBuilder
.
append
(
" and b.campaign_code in (:p_list_campaign_id) "
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignName
()))
{
sqlBuilder
.
append
(
" and upper(
campaignName) like upper(:p_campaign_name)
"
);
sqlBuilder
.
append
(
" and upper(
b.campaign_name) like :p_campaign_name
"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getAgentId
()))
{
sqlBuilder
.
append
(
" and upper(
userName) like upper(:p_user_name)
"
);
sqlBuilder
.
append
(
" and upper(
c.user_name) like :p_user_name
"
);
}
SQLQuery
query
=
session
.
createSQLQuery
(
sqlBuilder
.
toString
());
query
.
setParameterList
(
"p_list_campaign_id"
,
dto
.
getCampaignId
().
split
(
","
));
query
.
setParameter
(
"p_customer_id"
,
dto
.
getCustomerId
());
query
.
setParameter
(
"p_company_site_id"
,
dto
.
getCompanySiteId
());
query
.
setParameter
(
"p_customer_id"
,
"%"
+
dto
.
getCustomerId
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
query
.
setParameter
(
"p_date_from"
,
dto
.
getFromDate
());
query
.
setParameter
(
"p_date_to"
,
dto
.
getToDate
());
query
.
setParameterList
(
"p_list_compaign_type"
,
dto
.
getCampaignType
().
split
(
","
));
query
.
setParameterList
(
"p_list_contact_status"
,
dto
.
getContactStatus
().
split
(
","
));
query
.
setParameterList
(
"p_list_survey_status"
,
dto
.
getSurveyStatus
().
split
(
","
));
query
.
setParameterList
(
"p_list_record_status"
,
dto
.
getRecordStatus
().
split
(
","
));
query
.
setParameter
(
"p_phone_number"
,
dto
.
getPhoneNumber
());
query
.
setParameter
(
"p_call_time_from"
,
dto
.
getCallTimeFrom
());
query
.
setParameter
(
"p_call_time_to"
,
dto
.
getCallTimeTo
());
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignId
()))
{
query
.
setParameterList
(
"p_list_campaign_id"
,
dto
.
getCampaignId
().
split
(
","
));
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getPhoneNumber
()))
{
query
.
setParameter
(
"p_phone_number"
,
"%"
+
dto
.
getPhoneNumber
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignName
()))
{
query
.
setParameter
(
"p_campaign_name"
,
dto
.
getCampaignName
().
trim
());
query
.
setParameter
(
"p_campaign_name"
,
"%"
+
dto
.
getCampaignName
().
toUpperCase
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getAgentId
()))
{
query
.
setParameter
(
"p_user_name"
,
dto
.
getAgentId
().
trim
());
query
.
setParameter
(
"p_user_name"
,
"%"
+
dto
.
getAgentId
().
toUpperCase
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
}
query
.
addScalar
(
"campaignCode"
,
new
StringType
());
query
.
addScalar
(
"campaignName"
,
new
StringType
());
query
.
addScalar
(
"userName"
,
new
StringType
());
query
.
addScalar
(
"phoneNumber"
,
new
Lo
ngType
());
query
.
addScalar
(
"phoneNumber"
,
new
Stri
ngType
());
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
.
addScalar
(
"callTime"
,
new
LongType
());
query
.
setResultTransformer
(
Transformers
.
aliasToBean
(
ContactCustResultDTO
.
class
));
...
...
@@ -226,6 +295,11 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
}
}
@Override
public
List
<
ContactCustResultDTO
>
getContactCustById
(
CampaignRequestDTO
dto
)
{
return
null
;
}
private
boolean
isLower24Hour
(
Date
createTime
)
{
Date
currTime
=
new
Date
();
long
diffMilSec
=
currTime
.
getTime
()
-
createTime
.
getTime
();
...
...
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignRepositoryImpl.java
View file @
d9859bbd
...
...
@@ -42,10 +42,10 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
ResultDTO
result
=
new
ResultDTO
();
List
<
CampaignDTO
>
lst
=
new
ArrayList
<>();
StringBuilder
expression
=
new
StringBuilder
()
.
append
(
" SELECT C.CAMPAIGN_CODE, C.CAMPAIGN_NAME, C.CONTENT, C.START_TIME, C.END_TIME, C.STATUS, CA.STATUS AS AGENT_STATUS "
)
.
append
(
" SELECT C.CAMPAIGN_CODE, C.CAMPAIGN_NAME, C.CONTENT, C.START_TIME, C.END_TIME, C.STATUS, CA.STATUS AS AGENT_STATUS
, C.CAMPAIGN_ID
"
)
.
append
(
" FROM CAMPAIGN C INNER JOIN CAMPAIGN_AGENT CA ON C.CAMPAIGN_ID = CA.CAMPAIGN_ID "
)
.
append
(
" WHERE 1 = 1 "
)
;
//.append(" AND CA.AGENT_ID = :pAgentId ")
.
append
(
" WHERE 1 = 1 "
)
.
append
(
" AND CA.AGENT_ID = :pAgentId "
);
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getCampaignCode
()))
{
expression
.
append
(
" AND C.CAMPAIGN_CODE IN (:pCampaignCode) "
);
...
...
@@ -59,7 +59,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
if
(
campaignRequestDto
.
getStatus
()
!=
0
)
expression
.
append
(
" AND C.STATUS = :pStatus "
);
else
expression
.
append
(
" AND C.STATUS IN (
1,
2, 3) "
);
expression
.
append
(
" AND C.STATUS IN (2, 3) "
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getFromDateFr
()))
{
...
...
@@ -88,7 +88,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
try
{
Query
query
=
entityManager
.
createNativeQuery
(
expression
.
toString
());
//
query.setParameter("pAgentId", campaignRequestDto.getAgentId());
query
.
setParameter
(
"pAgentId"
,
campaignRequestDto
.
getAgentId
());
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getCampaignCode
()))
{
String
[]
lstCode
=
campaignRequestDto
.
getCampaignCode
().
split
(
","
);
...
...
@@ -155,6 +155,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
item
.
setEndTime
((
Date
)
obj
[
4
]);
item
.
setStatus
(((
BigDecimal
)
obj
[
5
]).
shortValueExact
());
item
.
setAgentStatus
(((
BigDecimal
)
obj
[
6
]).
shortValueExact
());
item
.
setCampaignId
(((
BigDecimal
)
obj
[
7
]).
longValueExact
());
lst
.
add
(
item
);
}
...
...
src/main/java/com/viettel/campaign/service/AgentsService.java
0 → 100644
View file @
d9859bbd
package
com.viettel.campaign.service
;
import
com.viettel.campaign.web.dto.ResultDTO
;
public
interface
AgentsService
{
ResultDTO
getAgentsByAgentId
(
String
agentId
);
}
src/main/java/com/viettel/campaign/service/CampaignExecuteService.java
View file @
d9859bbd
package
com.viettel.campaign.service
;
import
com.viettel.campaign.web.dto.ContactCustResultDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Service
public
interface
CampaignExecuteService
{
//<editor-fold: hungtt>
...
...
@@ -15,5 +18,7 @@ public interface CampaignExecuteService {
ResultDTO
searchInteractiveResult
(
CampaignRequestDTO
dto
);
XSSFWorkbook
exportInteractiveResult
(
CampaignRequestDTO
dto
);
List
<
ContactCustResultDTO
>
getContactCustById
(
CampaignRequestDTO
dto
);
//</editor-fold>
}
src/main/java/com/viettel/campaign/service/CustomerService.java
View file @
d9859bbd
package
com.viettel.campaign.service
;
import
com.viettel.campaign.model.ccms_full.Customer
;
import
com.viettel.campaign.model.ccms_full.CustomerList
;
import
com.viettel.campaign.web.dto.CustomerContactDTO
;
import
com.viettel.campaign.web.dto.CustomerDTO
;
import
com.viettel.campaign.web.dto.CustomerListDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.web.dto.*
;
import
com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO
;
import
com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
public
interface
CustomerService
{
ResultDTO
getAllCustomer
(
int
page
,
int
pageSize
,
String
sort
,
long
customerListId
,
long
companySiteId
);
...
...
@@ -44,12 +47,18 @@ public interface CustomerService {
// danh sach khach hang cua chien dich //
ResultDTO
searchCustomerListInfoFromCustomerList
(
int
page
,
int
pageSize
,
String
sort
,
Long
campaignId
,
Long
companySiteId
);
List
<
CustomerListDTO
>
getCustomerListInfo
(
CampaignCustomerDTO
campaignCustomerDTO
);
List
<
CustomerDTO
>
getIndividualCustomerInfo
(
CampaignCustomerDTO
campaignCustomerDTO
);
// ------------ customer ------------ //
ResultDTO
getCustomerRecall
(
Long
campaignId
,
Long
customerId
);
List
<
Customer
>
findAllByCondition
(
Long
siteId
,
Date
endTime
);
Customer
update
(
Customer
c
);
}
src/main/java/com/viettel/campaign/service/CustomerTimeService.java
0 → 100644
View file @
d9859bbd
package
com.viettel.campaign.service
;
import
com.viettel.campaign.config.DataSourceQualify
;
import
com.viettel.campaign.model.ccms_full.CustomerTime
;
import
com.viettel.campaign.repository.ccms_full.CustomerTimeRepository
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
/**
* @author hanv_itsol
* @project campaign
*/
@Service
@Transactional
public
class
CustomerTimeService
{
@Autowired
private
CustomerTimeRepository
customerTimeRepository
;
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
CustomerTime
update
(
CustomerTime
customerTime
){
return
customerTimeRepository
.
save
(
customerTime
);
}
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
List
<
CustomerTime
>
findByCustomerId
(
Long
customerId
){
return
customerTimeRepository
.
findByCustomerId
(
customerId
);
}
}
src/main/java/com/viettel/campaign/service/impl/AgentsServiceImpl.java
0 → 100644
View file @
d9859bbd
package
com.viettel.campaign.service.impl
;
import
com.viettel.campaign.model.acd_full.Agents
;
import
com.viettel.campaign.repository.acd_full.AgentsRepository
;
import
com.viettel.campaign.service.AgentsService
;
import
com.viettel.campaign.utils.Constants
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
@Service
public
class
AgentsServiceImpl
implements
AgentsService
{
@Autowired
AgentsRepository
agentsRepository
;
@Override
public
ResultDTO
getAgentsByAgentId
(
String
agentId
)
{
ResultDTO
result
=
new
ResultDTO
();
Agents
data
=
agentsRepository
.
getByAgentId
(
agentId
);
if
(
data
!=
null
)
{
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
result
.
setDescription
(
"agents data"
);
result
.
setData
(
data
);
}
else
{
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
result
.
setDescription
(
"agents data null"
);
}
return
result
;
}
}
src/main/java/com/viettel/campaign/service/impl/CampaignExecuteServiceImp.java
View file @
d9859bbd
...
...
@@ -178,6 +178,12 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
return
workbook
;
}
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
List
<
ContactCustResultDTO
>
getContactCustById
(
CampaignRequestDTO
dto
)
{
return
campaignExecuteRepository
.
getContactCustById
(
dto
);
}
private
void
writeCellContent
(
Row
row
,
CellStyle
rowStyle
,
int
colNo
,
Object
content
)
{
Cell
cell
=
row
.
createCell
(
colNo
);
if
(
content
==
null
)
{
...
...
src/main/java/com/viettel/campaign/service/impl/CampaignServiceImpl.java
View file @
d9859bbd
...
...
@@ -167,6 +167,7 @@ public class CampaignServiceImpl implements CampaignService {
return
resultDTO
;
}
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
Map
countRecallCustomer
(
Long
companySiteId
,
Long
agentId
)
{
Map
result
=
new
HashMap
();
Long
count
=
campaignRepository
.
countRecallCustomer
(
companySiteId
,
agentId
);
...
...
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
View file @
d9859bbd
package
com.viettel.campaign.service.impl
;
import
com.viettel.campaign.config.CCMSFullDatasourceConfig
;
import
com.viettel.campaign.config.DataSourceQualify
;
import
com.viettel.campaign.mapper.CustomerListMapper
;
import
com.viettel.campaign.mapper.CustomerMapper
;
...
...
@@ -24,15 +25,20 @@ import org.hibernate.type.LongType;
import
org.hibernate.type.ShortType
;
import
org.hibernate.type.StringType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.data.domain.*
;
import
org.springframework.jdbc.core.BeanPropertyRowMapper
;
import
org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.persistence.EntityManager
;
import
javax.persistence.PersistenceContext
;
import
javax.persistence.Query
;
import
java
.util.Dat
e
;
import
java.util.
List
;
import
java
x.sql.DataSourc
e
;
import
java.util.
*
;
@Service
public
class
CustomerServiceImpl
implements
CustomerService
{
...
...
@@ -59,6 +65,10 @@ public class CustomerServiceImpl implements CustomerService {
@Autowired
CustomerListMappingRepository
customerListMappingRepository
;
@Autowired
@Qualifier
(
DataSourceQualify
.
NAMED_JDBC_PARAMETER_TEMPLATE_CCMS_FULL
)
NamedParameterJdbcTemplate
namedParameterJdbcTemplate
;
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
getAllCustomer
(
int
page
,
int
pageSize
,
String
sort
,
long
customerListId
,
long
companySiteId
)
{
...
...
@@ -677,20 +687,46 @@ public class CustomerServiceImpl implements CustomerService {
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
searchCustomerListInfoFromCustomerList
(
int
page
,
int
pageSize
,
String
sort
,
Long
campaignId
,
Long
companySiteId
)
{
ResultDTO
resultDTO
=
new
ResultDTO
()
;
public
List
<
CustomerListDTO
>
getCustomerListInfo
(
CampaignCustomerDTO
campaignCustomerDTO
)
{
List
<
CustomerListDTO
>
customerList
;
try
{
String
sql
=
SQLBuilder
.
getSqlQueryById
(
SQLBuilder
.
SQL_MODULE_CAMPAIGN_MNG
,
"search-customer-list-info-from-customer-list"
);
Query
query
=
entityManager
.
createNativeQuery
(
sql
);
query
.
setParameter
(
"p_campaign_id"
,
campaignId
);
query
.
setParameter
(
"p_company_site_id"
,
companySiteId
);
resultDTO
.
setListData
(
query
.
getResultList
());
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
Map
<
String
,
Object
>
param
=
new
HashMap
<>(
);
param
.
put
(
"p_campaign_id"
,
campaignCustomerDTO
.
getCampaignId
()
);
param
.
put
(
"p_company_site_id"
,
campaignCustomerDTO
.
getCompanySiteId
()
);
param
.
put
(
"p_page_number"
,
campaignCustomerDTO
.
getPage
());
param
.
put
(
"p_page_size"
,
campaignCustomerDTO
.
getPageSize
()
);
customerList
=
namedParameterJdbcTemplate
.
query
(
sql
,
param
,
new
BeanPropertyRowMapper
<>(
CustomerListDTO
.
class
)
);
}
catch
(
Exception
e
)
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
e
.
getMessage
());
return
null
;
}
return
resultDTO
;
return
customerList
;
}
@Override
public
List
<
CustomerDTO
>
getIndividualCustomerInfo
(
CampaignCustomerDTO
campaignCustomerDTO
)
{
List
<
CustomerDTO
>
customerList
;
try
{
String
sql
=
SQLBuilder
.
getSqlQueryById
(
SQLBuilder
.
SQL_MODULE_CAMPAIGN_MNG
,
"search-individual-customer"
);
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"p_page_number"
,
campaignCustomerDTO
.
getPage
());
param
.
put
(
"p_page_size"
,
campaignCustomerDTO
.
getPageSize
());
customerList
=
namedParameterJdbcTemplate
.
query
(
sql
,
param
,
new
BeanPropertyRowMapper
<>(
CustomerDTO
.
class
));
}
catch
(
Exception
e
)
{
return
null
;
}
return
customerList
;
}
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
List
<
Customer
>
findAllByCondition
(
Long
siteId
,
Date
endTime
)
{
return
customerRepository
.
findAllByCondition
(
siteId
,
endTime
);
}
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
Customer
update
(
Customer
c
)
{
return
customerRepository
.
save
(
c
);
}
}
src/main/java/com/viettel/campaign/web/dto/CampaignCustomerDTO.java
View file @
d9859bbd
...
...
@@ -7,7 +7,7 @@ import java.util.Date;
@Getter
@Setter
public
class
CampaignCustomerDTO
{
public
class
CampaignCustomerDTO
extends
BaseDTO
{
private
Long
campaignCustomerListId
;
private
Long
campaignId
;
private
Long
customerId
;
...
...
src/main/java/com/viettel/campaign/web/dto/ContactCustResultDTO.java
View file @
d9859bbd
...
...
@@ -19,7 +19,7 @@ public class ContactCustResultDTO extends BaseDTO{
private
Short
recordStatus
;
private
String
description
;
private
Date
createTime
;
private
Stri
ng
callTime
;
private
Lo
ng
callTime
;
private
Long
agentId
;
private
Long
campaignId
;
private
String
campaignName
;
...
...
src/main/java/com/viettel/campaign/web/dto/CustomerListDTO.java
View file @
d9859bbd
...
...
@@ -21,4 +21,7 @@ public class CustomerListDTO extends BaseDTO {
private
Date
updateAt
;
private
String
source
;
private
String
deptCreate
;
private
Long
totalCusInList
;
private
Long
totalCusInteract
;
private
Long
totalCusNotInteract
;
}
src/main/java/com/viettel/campaign/web/dto/request_dto/CampaignRequestDTO.java
View file @
d9859bbd
...
...
@@ -41,4 +41,5 @@ public class CampaignRequestDTO extends BaseDTO {
String
campaignId
;
String
surveyStatus
;
String
roleUser
;
String
contactCustId
;
}
src/main/java/com/viettel/campaign/web/rest/AgentsController.java
0 → 100644
View file @
d9859bbd
package
com.viettel.campaign.web.rest
;
import
com.viettel.campaign.service.AgentsService
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
@RestController
@RequestMapping
(
"/ipcc/agents"
)
@CrossOrigin
public
class
AgentsController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
CampaignController
.
class
);
@Autowired
AgentsService
agentsService
;
@GetMapping
(
"/getAgentsById"
)
@ResponseBody
public
ResponseEntity
<
ResultDTO
>
getAgentsById
(
@RequestParam
(
"agentId"
)
String
agentId
)
{
ResultDTO
result
=
agentsService
.
getAgentsByAgentId
(
agentId
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
}
src/main/java/com/viettel/campaign/web/rest/CampaignCompleteCodeController.java
View file @
d9859bbd
...
...
@@ -77,12 +77,14 @@ public class CampaignCompleteCodeController {
result
=
completeCodeService
.
deleteCompleteCode
(
completeCodeDTO
);
return
result
;
}
@PostMapping
(
"/listDelete"
)
@ResponseBody
public
ResponseEntity
<
ResultDTO
>
deleteList
(
@RequestBody
@Valid
List
<
Long
>
completeCodeDtos
){
ResultDTO
resultDTO
=
completeCodeService
.
deleteList
(
completeCodeDtos
);
return
new
ResponseEntity
<>(
resultDTO
,
HttpStatus
.
OK
);
}
@PostMapping
(
"/deleteById"
)
@ResponseBody
public
ResultDTO
deleteById
(
@RequestParam
(
"id"
)
Long
id
){
...
...
src/main/java/com/viettel/campaign/web/rest/CampaignController.java
View file @
d9859bbd
package
com.viettel.campaign.web.rest
;
import
com.viettel.campaign.model.ccms_full.TimeRangeDialMode
;
import
com.viettel.campaign.model.ccms_full.TimeZoneDialMode
;
import
com.viettel.campaign.repository.ccms_full.TimeRangeDialModeRepository
;
import
com.viettel.campaign.repository.ccms_full.TimeZoneDialModeRepository
;
import
com.viettel.campaign.service.CampaignExecuteService
;
import
com.viettel.campaign.service.CampaignService
;
import
com.viettel.campaign.web.dto.CampaignDTO
;
...
...
@@ -13,6 +9,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cloud.sleuth.instrument.reactor.ReactorSleuth
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
...
...
@@ -24,7 +21,6 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.util.List
;
import
java.util.Map
;
@RestController
...
...
@@ -40,12 +36,6 @@ public class CampaignController {
@Autowired
CampaignExecuteService
campaignExecuteService
;
@Autowired
TimeRangeDialModeRepository
timeRangeDialModeRepository
;
@Autowired
TimeZoneDialModeRepository
timeZoneDialModeRepository
;
@PostMapping
(
"/searchCampaignExecute"
)
@ResponseBody
public
ResponseEntity
<
ResultDTO
>
searchCampaignExecute
(
@RequestBody
CampaignRequestDTO
requestDto
)
{
...
...
@@ -164,15 +154,4 @@ public class CampaignController {
headers
.
setContentType
(
MediaType
.
parseMediaType
(
"application/vnd.ms-excel"
));
return
new
ResponseEntity
<
byte
[]>(
contentReturn
,
headers
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/findCampaignTimeRangeMode"
,
method
=
RequestMethod
.
GET
)
public
List
<
TimeRangeDialMode
>
findCampaignTimeRangeMode
(
@RequestParam
Long
campaignId
,
@RequestParam
Long
companySiteId
)
{
return
timeRangeDialModeRepository
.
findTimeRangeDialModeByCampaignIdAndCompanySiteId
(
campaignId
,
companySiteId
);
}
@RequestMapping
(
value
=
"/findCampaignTimeZoneMode"
,
method
=
RequestMethod
.
GET
)
public
List
<
TimeZoneDialMode
>
findCampaignTimeZoneMode
(
@RequestParam
Long
campaignId
,
@RequestParam
Long
companySiteId
)
{
return
timeZoneDialModeRepository
.
findTimeZoneDialModeByCampaignIdAndCompanySiteId
(
campaignId
,
companySiteId
);
}
}
src/main/java/com/viettel/campaign/web/rest/CustomerController.java
View file @
d9859bbd
...
...
@@ -179,7 +179,7 @@ public class CustomerController {
return
new
ResponseEntity
(
result
,
HttpStatus
.
OK
);
}
@
Ge
tMapping
(
"/getCustomerRecall"
)
@
Pos
tMapping
(
"/getCustomerRecall"
)
@ResponseBody
public
ResponseEntity
<
ResultDTO
>
getCustomerRecall
(
@RequestParam
(
"campaignId"
)
Long
campaignId
,
@RequestParam
(
"customerId"
)
Long
customerId
)
{
ResultDTO
result
=
customerService
.
getCustomerRecall
(
campaignId
,
customerId
);
...
...
@@ -248,6 +248,6 @@ public class CustomerController {
@RequestParam
(
"sort"
)
String
sort
,
@RequestParam
(
"campaignId"
)
Long
campaignId
,
@RequestParam
(
"companySiteId"
)
Long
companySiteId
)
{
return
customerService
.
searchCustomerListInfoFromCustomerList
(
page
,
pageSize
,
sort
,
campaignId
,
companySiteId
);
return
null
;
//
customerService.searchCustomerListInfoFromCustomerList(page, pageSize, sort, campaignId, companySiteId);
}
}
src/main/resources/sql/campaign-execute/get-combo-campaign-type.sql
View file @
d9859bbd
select
PAR_VALUE
apParamId
,
PAR_NAME
parName
from
AP_PARAM
where
PAR_TYPE
=
'CAMPAIGN_TYPE'
and
COMPANY_SITE_ID
=
:
p_company_site_id
where
PAR_TYPE
=
'CAMPAIGN_TYPE'
and
COMPANY_SITE_ID
=
:
p_company_site_id
and
IS_DELETE
=
0
src/main/resources/sql/campaign-execute/get-combo-status.sql
View file @
d9859bbd
select
COMPLETE_VALUE
apParamId
,
select
distinct
COMPLETE_VALUE
apParamId
,
COMPLETE_NAME
parName
from
CAMPAIGN_COMPLETE_CODE
where
to_char
(
COMPLETE_TYPE
)
=
:
p_complete_type
and
STATUS
=
1
and
COMPANY_SITE_ID
=
:
p_company_site_id
src/main/resources/sql/campaign-execute/get-execute-interactive.sql
View file @
d9859bbd
...
...
@@ -3,11 +3,12 @@ select b.campaign_code campaignCode,
c
.
user_name
userName
,
a
.
phone_number
phoneNumber
,
d
.
name
customerName
,
a
.
create_time
createTime
,
to_date
(
a
.
start_call
,
'DD/MM/YYYY'
)
startCall
,
e
.
complete_name
contactStatus
,
f
.
complete_name
surveyStatus
,
g
.
status
status
,
a
.
status
recordStatus
a
.
status
recordStatus
,
(
a
.
end_time
-
a
.
start_call
)
*
24
*
60
callTime
from
contact_cust_result
a
left
join
campaign
b
on
a
.
campaign_id
=
b
.
campaign_id
left
join
vsa_users
c
on
a
.
agent_id
=
c
.
user_id
...
...
src/main/resources/sql/campaign-mng/search-customer-list-info-from-customer-list.sql
View file @
d9859bbd
...
...
@@ -19,16 +19,26 @@ count(customer_id) ktt
from
campaign_customer
where
campaign_id
=
:
p_campaign_id
and
status
=
0
and
in_campaign_status
=
1
group
by
customer_list_id
,
company_site_id
)
select
customer_list_code
ma
,
customer_list_name
ten
,
cl
.
company_site_id
,
nvl
(
total
,
0
)
tong
,
nvl
(
tt
,
0
)
tongtt
,
nvl
(
ktt
,
0
)
tongktt
),
datas
as
(
select
customer_list_code
customerListCode
,
customer_list_name
customerListName
,
nvl
(
total
,
0
)
totalCusInList
,
nvl
(
tt
,
0
)
totalCusInteract
,
nvl
(
ktt
,
0
)
totalCusNotInteract
from
customer_list
cl
left
join
totalCustomer
tc
on
(
cl
.
customer_list_id
=
tc
.
customer_list_id
and
cl
.
company_site_id
=
tc
.
company_site_id
)
left
join
customerInteractive
ci
on
(
cl
.
customer_list_id
=
ci
.
customer_list_id
and
cl
.
company_site_id
=
ci
.
company_site_id
)
left
join
customerNotInteractive
cni
on
(
cl
.
customer_list_id
=
cni
.
customer_list_id
and
cl
.
company_site_id
=
cni
.
company_site_id
)
where
cl
.
company_site_id
=
:
p_company_site_id
order
by
customer_list_code
\ No newline at end of file
)
select
*
from
(
select
a
.
*
,
rownum
r__
from
(
select
*
from
datas
order
by
customerListCode
)
a
where
rownum
<
((:
p_page_number
*
:
p_page_size
)
+
1
)
)
where
r__
>=
(((:
p_page_number
-
1
)
*
:
p_page_size
)
+
1
)
\ No newline at end of file
src/main/resources/sql/campaign-mng/search-individual-customer.sql
0 → 100644
View file @
d9859bbd
with
cusPhone
as
(
select
customer_id
cusId
,
contact
phone
from
customer_contact
cc
where
cc
.
contact_type
=
5
and
status
=
1
),
cusEmail
as
(
select
customer_id
cusId
,
contact
email
from
customer_contact
cc
where
cc
.
contact_type
=
2
and
status
=
1
),
datas
as
(
select
c
.
name
,
cP
.
phone
,
cE
.
email
,
c
.
customer_type
cusType
,
c
.
company_name
compName
,
c
.
current_address
currentAddress
,
c
.
description
from
customer
c
left
join
cusPhone
cP
on
c
.
customer_id
=
cP
.
cusId
left
join
cusEmail
cE
on
c
.
customer_id
=
cE
.
cusId
)
select
*
from
(
select
a
.
*
,
rownum
r__
from
(
select
*
from
datas
order
by
datas
.
name
)
a
where
rownum
<
((:
p_page_number
*
:
p_page_size
)
+
1
)
)
where
r__
>=
(((:
p_page_number
-
1
)
*
:
p_page_size
)
+
1
)
\ No newline at end of file
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