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
bebc9042
Commit
bebc9042
authored
Aug 13, 2019
by
Tu Bach
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://git.myitsol.com/hanv/service-campaign
parents
21d5ef14
09b75382
Changes
26
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
424 additions
and
100 deletions
+424
-100
src/main/java/com/viettel/campaign/config/JobConfig.java
src/main/java/com/viettel/campaign/config/JobConfig.java
+12
-13
src/main/java/com/viettel/campaign/job/CampaignJob.java
src/main/java/com/viettel/campaign/job/CampaignJob.java
+46
-9
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/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/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/ProcessConfigService.java
...va/com/viettel/campaign/service/ProcessConfigService.java
+4
-2
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/CustomerServiceImpl.java
...om/viettel/campaign/service/impl/CustomerServiceImpl.java
+53
-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/CustomerCustomDTO.java
.../java/com/viettel/campaign/web/dto/CustomerCustomDTO.java
+4
-0
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/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
+1
-1
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/campaign-customer-detail-by-params.sql
...s/sql/campaign-mng/campaign-customer-detail-by-params.sql
+4
-0
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/config/JobConfig.java
View file @
bebc9042
...
@@ -71,9 +71,8 @@ public class JobConfig implements SchedulingConfigurer {
...
@@ -71,9 +71,8 @@ public class JobConfig implements SchedulingConfigurer {
private
void
job2
(
TaskScheduler
scheduler
)
{
private
void
job2
(
TaskScheduler
scheduler
)
{
job2
=
scheduler
.
schedule
(()
->
{
job2
=
scheduler
.
schedule
(()
->
{
// log.info("processing job2 ...");
log
.
info
(
Thread
.
currentThread
().
getName
()
+
" The Job executed at "
+
new
Date
());
// log.info(Thread.currentThread().getName() + " The Task2 executed at " + new Date());
campaignJob
().
process
();
// campaignJob().process();
},
triggerContext
->
{
},
triggerContext
->
{
String
cronExp
=
"0/1 * * * * ?"
;
// Can be pulled from a db . This will run every minute
String
cronExp
=
"0/1 * * * * ?"
;
// Can be pulled from a db . This will run every minute
...
@@ -85,15 +84,15 @@ public class JobConfig implements SchedulingConfigurer {
...
@@ -85,15 +84,15 @@ public class JobConfig implements SchedulingConfigurer {
@Override
@Override
public
void
configureTasks
(
ScheduledTaskRegistrar
scheduledTaskRegistrar
)
{
public
void
configureTasks
(
ScheduledTaskRegistrar
scheduledTaskRegistrar
)
{
//
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
ThreadPoolTaskScheduler
threadPoolTaskScheduler
=
new
ThreadPoolTaskScheduler
();
//
threadPoolTaskScheduler.setPoolSize(10);
threadPoolTaskScheduler
.
setPoolSize
(
10
);
//
threadPoolTaskScheduler.setThreadNamePrefix("scheduler-thread");
threadPoolTaskScheduler
.
setThreadNamePrefix
(
"scheduler-thread"
);
//
threadPoolTaskScheduler.initialize();
threadPoolTaskScheduler
.
initialize
();
//
scheduledTaskRegistrar.setTaskScheduler(threadPoolTaskScheduler);
scheduledTaskRegistrar
.
setTaskScheduler
(
threadPoolTaskScheduler
);
//
//
scheduledTaskRegistrar.addTriggerTask(() -> campaignJob().process(), (TriggerContext triggerContext) -> yourService.getCron());
// scheduledTaskRegistrar.addTriggerTask(() -> campaignJob().process(), (TriggerContext triggerContext) -> yourService.getCron());
//
scheduledTaskRegistrar.addTriggerTask(() -> campaignJob().process(), triggerContext -> {
scheduledTaskRegistrar
.
addTriggerTask
(()
->
campaignJob
().
process
(),
triggerContext
->
{
//
CronTrigger trigger = new CronTrigger("0/5 * * * * ?");
CronTrigger
trigger
=
new
CronTrigger
(
"0/5 * * * * ?"
);
//
return trigger.nextExecutionTime(triggerContext);
return
trigger
.
nextExecutionTime
(
triggerContext
);
//
});
});
}
}
}
}
src/main/java/com/viettel/campaign/job/CampaignJob.java
View file @
bebc9042
package
com.viettel.campaign.job
;
package
com.viettel.campaign.job
;
import
com.viettel.campaign.model.ccms_full.Campaign
;
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.model.ccms_full.ProcessConfig
;
import
com.viettel.campaign.service.CampaignService
;
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.service.ProcessConfigService
;
import
com.viettel.campaign.utils.DateTimeUtil
;
import
com.viettel.campaign.utils.DateTimeUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
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.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -34,8 +36,14 @@ public class CampaignJob {
...
@@ -34,8 +36,14 @@ public class CampaignJob {
@Autowired
@Autowired
private
CampaignService
campaignService
;
private
CampaignService
campaignService
;
@Autowired
private
CustomerTimeService
customerTimeService
;
@Autowired
private
CustomerService
customerService
;
// @Scheduled(fixedRate = 5000)
// @Scheduled(fixedRate = 5000)
@Transactional
(
propagation
=
Propagation
.
REQUIRED
)
//
@Transactional( propagation = Propagation.REQUIRED)
public
void
process
()
{
public
void
process
()
{
log
.
info
(
Thread
.
currentThread
().
getName
()
+
" The Task executed at "
+
dateFormat
.
format
(
new
Date
()));
log
.
info
(
Thread
.
currentThread
().
getName
()
+
" The Task executed at "
+
dateFormat
.
format
(
new
Date
()));
List
<
ProcessConfig
>
list
=
processConfigService
.
findAll
();
List
<
ProcessConfig
>
list
=
processConfigService
.
findAll
();
...
@@ -45,26 +53,30 @@ public class CampaignJob {
...
@@ -45,26 +53,30 @@ public class CampaignJob {
switch
(
p
.
getConfigCode
()){
switch
(
p
.
getConfigCode
()){
case
CUSTOMER_INACTIVE_DUARATION:
case
CUSTOMER_INACTIVE_DUARATION:
if
(
isExecute
){
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
;
break
;
case
CRON_EXPRESSION_CHECK_START:
case
CRON_EXPRESSION_CHECK_START:
// process
// process
if
(
isExecute
){
if
(
isExecute
){
// chuyen trang thai Du thao sang Trien khai
log
.
info
(
"thay doi trang thai"
);
List
<
Long
>
status
=
new
ArrayList
<>();
List
<
Long
>
status
=
new
ArrayList
<>();
status
.
add
(
1L
);
status
.
add
(
1L
);
status
.
add
(
1L
);
status
.
add
(
1L
);
List
<
Campaign
>
campaigns
=
campaignService
.
findCampaignByCompanySiteIdAndStartTimeIsLessThanEqualAndStatusIn
(
p
.
getSiteId
(),
new
Date
(),
status
);
List
<
Campaign
>
campaigns
=
campaignService
.
findCampaignByCompanySiteIdAndStartTimeIsLessThanEqualAndStatusIn
(
p
.
getSiteId
(),
new
Date
(),
status
);
campaigns
.
parallelStream
().
forEach
(
campaign
->
{
campaigns
.
parallelStream
().
forEach
(
campaign
->
{
log
.
info
(
"Chuyen trang thai chien dich ... #{} ... tu Du thao sang Trien khai"
,
campaign
.
getCampaignId
());
campaign
.
setProcessStatus
(
1
);
campaign
.
setProcessStatus
(
1
);
campaign
.
setStatus
(
2L
);
campaign
.
setStatus
(
2L
);
campaign
.
setCampaignStart
(
new
Date
());
campaign
.
setCampaignStart
(
new
Date
());
campaignService
.
updateProcess
(
campaign
);
campaignService
.
updateProcess
(
campaign
);
});
});
// update last check
log
.
info
(
"Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}"
,
p
.
getSiteId
());
p
.
setLastProcess
(
new
Date
());
p
.
setLastProcess
(
new
Date
());
processConfigService
.
update
(
p
);
processConfigService
.
update
(
p
);
}
}
...
@@ -72,25 +84,50 @@ public class CampaignJob {
...
@@ -72,25 +84,50 @@ public class CampaignJob {
case
CRON_EXPRESSION_CHECK_END:
case
CRON_EXPRESSION_CHECK_END:
// process
// process
if
(
isExecute
){
if
(
isExecute
){
// chuyen trang thai sang ket thuc
List
<
Long
>
status
=
new
ArrayList
<>();
List
<
Long
>
status
=
new
ArrayList
<>();
status
.
add
(
2L
);
status
.
add
(
2L
);
status
.
add
(
3L
);
status
.
add
(
3L
);
List
<
Campaign
>
campaigns
=
campaignService
.
findCampaignByCompanySiteIdAndEndTimeIsLessThanEqualAndStatusIn
(
p
.
getSiteId
(),
new
Date
(),
status
);
List
<
Campaign
>
campaigns
=
campaignService
.
findCampaignByCompanySiteIdAndEndTimeIsLessThanEqualAndStatusIn
(
p
.
getSiteId
(),
new
Date
(),
status
);
campaigns
.
parallelStream
().
forEach
(
campaign
->
{
campaigns
.
parallelStream
().
forEach
(
campaign
->
{
log
.
info
(
"Chuyen trang thai chien dich ... #{} ... sang Ket thuc"
,
campaign
.
getCampaignId
());
campaign
.
setStatus
(
4L
);
campaign
.
setStatus
(
4L
);
campaign
.
setCampaignEnd
(
new
Date
());
campaign
.
setCampaignEnd
(
new
Date
());
campaignService
.
updateProcess
(
campaign
);
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
;
break
;
default
:
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/ccms_full/CustomerTime.java
0 → 100644
View file @
bebc9042
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/ccms_full/CampaignExecuteRepository.java
View file @
bebc9042
...
@@ -20,5 +20,7 @@ public interface CampaignExecuteRepository {
...
@@ -20,5 +20,7 @@ public interface CampaignExecuteRepository {
ResultDTO
getInteractiveResult
(
CampaignRequestDTO
dto
);
ResultDTO
getInteractiveResult
(
CampaignRequestDTO
dto
);
List
<
ContactCustResultDTO
>
getExcelInteractiveResult
(
CampaignRequestDTO
dto
);
List
<
ContactCustResultDTO
>
getExcelInteractiveResult
(
CampaignRequestDTO
dto
);
List
<
ContactCustResultDTO
>
getContactCustById
(
CampaignRequestDTO
dto
);
//</editor-fold: hungtt>
//</editor-fold: hungtt>
}
}
src/main/java/com/viettel/campaign/repository/ccms_full/CustomerRepository.java
View file @
bebc9042
...
@@ -9,6 +9,7 @@ import org.springframework.data.jpa.repository.Query;
...
@@ -9,6 +9,7 @@ import org.springframework.data.jpa.repository.Query;
import
org.springframework.data.repository.query.Param
;
import
org.springframework.data.repository.query.Param
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
@Repository
@Repository
...
@@ -27,4 +28,8 @@ public interface CustomerRepository extends JpaRepository<Customer, Long> {
...
@@ -27,4 +28,8 @@ public interface CustomerRepository extends JpaRepository<Customer, Long> {
@Modifying
@Modifying
@Query
(
"delete from Customer c where c.customerId in (:ids)"
)
@Query
(
"delete from Customer c where c.customerId in (:ids)"
)
int
deleteIds
(
@Param
(
"ids"
)
List
<
Long
>
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 @
bebc9042
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 @
bebc9042
This diff is collapsed.
Click to expand it.
src/main/java/com/viettel/campaign/service/CampaignExecuteService.java
View file @
bebc9042
package
com.viettel.campaign.service
;
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.ResultDTO
;
import
com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO
;
import
com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Service
@Service
public
interface
CampaignExecuteService
{
public
interface
CampaignExecuteService
{
//<editor-fold: hungtt>
//<editor-fold: hungtt>
...
@@ -15,5 +18,7 @@ public interface CampaignExecuteService {
...
@@ -15,5 +18,7 @@ public interface CampaignExecuteService {
ResultDTO
searchInteractiveResult
(
CampaignRequestDTO
dto
);
ResultDTO
searchInteractiveResult
(
CampaignRequestDTO
dto
);
XSSFWorkbook
exportInteractiveResult
(
CampaignRequestDTO
dto
);
XSSFWorkbook
exportInteractiveResult
(
CampaignRequestDTO
dto
);
List
<
ContactCustResultDTO
>
getContactCustById
(
CampaignRequestDTO
dto
);
//</editor-fold>
//</editor-fold>
}
}
src/main/java/com/viettel/campaign/service/CustomerService.java
View file @
bebc9042
package
com.viettel.campaign.service
;
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.model.ccms_full.CustomerList
;
import
com.viettel.campaign.web.dto.CustomerContactDTO
;
import
com.viettel.campaign.web.dto.*
;
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.request_dto.CustomerRequestDTO
;
import
com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO
;
import
com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO
;
import
com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
public
interface
CustomerService
{
public
interface
CustomerService
{
ResultDTO
getAllCustomer
(
int
page
,
int
pageSize
,
String
sort
,
long
customerListId
,
long
companySiteId
);
ResultDTO
getAllCustomer
(
int
page
,
int
pageSize
,
String
sort
,
long
customerListId
,
long
companySiteId
);
...
@@ -44,12 +47,18 @@ public interface CustomerService {
...
@@ -44,12 +47,18 @@ public interface CustomerService {
// danh sach khach hang cua chien dich //
// 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 ------------ //
// ------------ customer ------------ //
ResultDTO
getCustomerRecall
(
Long
campaignId
,
Long
customerId
);
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 @
bebc9042
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/ProcessConfigService.java
View file @
bebc9042
package
com.viettel.campaign.service
;
package
com.viettel.campaign.service
;
import
com.viettel.campaign.config.DataSourceQualify
;
import
com.viettel.campaign.model.ccms_full.ProcessConfig
;
import
com.viettel.campaign.model.ccms_full.ProcessConfig
;
import
com.viettel.campaign.repository.ccms_full.ProcessConfigRepository
;
import
com.viettel.campaign.repository.ccms_full.ProcessConfigRepository
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -20,17 +21,18 @@ public class ProcessConfigService {
...
@@ -20,17 +21,18 @@ public class ProcessConfigService {
@Autowired
@Autowired
private
ProcessConfigRepository
processConfigRepository
;
private
ProcessConfigRepository
processConfigRepository
;
@Transactional
(
readOnly
=
true
)
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
List
<
ProcessConfig
>
findAll
(){
public
List
<
ProcessConfig
>
findAll
(){
return
processConfigRepository
.
findAll
();
return
processConfigRepository
.
findAll
();
}
}
@Transactional
(
readOnly
=
true
)
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
List
<
ProcessConfig
>
findAllByCode
(
String
configCode
){
public
List
<
ProcessConfig
>
findAllByCode
(
String
configCode
){
return
processConfigRepository
.
findAllByConfigCode
(
configCode
);
return
processConfigRepository
.
findAllByConfigCode
(
configCode
);
}
}
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
void
update
(
ProcessConfig
pc
){
public
void
update
(
ProcessConfig
pc
){
processConfigRepository
.
save
(
pc
);
processConfigRepository
.
save
(
pc
);
}
}
...
...
src/main/java/com/viettel/campaign/service/impl/CampaignExecuteServiceImp.java
View file @
bebc9042
...
@@ -178,6 +178,12 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
...
@@ -178,6 +178,12 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
return
workbook
;
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
)
{
private
void
writeCellContent
(
Row
row
,
CellStyle
rowStyle
,
int
colNo
,
Object
content
)
{
Cell
cell
=
row
.
createCell
(
colNo
);
Cell
cell
=
row
.
createCell
(
colNo
);
if
(
content
==
null
)
{
if
(
content
==
null
)
{
...
...
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
View file @
bebc9042
package
com.viettel.campaign.service.impl
;
package
com.viettel.campaign.service.impl
;
import
com.viettel.campaign.config.CCMSFullDatasourceConfig
;
import
com.viettel.campaign.config.DataSourceQualify
;
import
com.viettel.campaign.config.DataSourceQualify
;
import
com.viettel.campaign.mapper.CustomerListMapper
;
import
com.viettel.campaign.mapper.CustomerListMapper
;
import
com.viettel.campaign.mapper.CustomerMapper
;
import
com.viettel.campaign.mapper.CustomerMapper
;
...
@@ -24,15 +25,20 @@ import org.hibernate.type.LongType;
...
@@ -24,15 +25,20 @@ import org.hibernate.type.LongType;
import
org.hibernate.type.ShortType
;
import
org.hibernate.type.ShortType
;
import
org.hibernate.type.StringType
;
import
org.hibernate.type.StringType
;
import
org.springframework.beans.factory.annotation.Autowired
;
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.data.domain.*
;
import
org.springframework.jdbc.core.BeanPropertyRowMapper
;
import
org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.persistence.EntityManager
;
import
javax.persistence.EntityManager
;
import
javax.persistence.PersistenceContext
;
import
javax.persistence.PersistenceContext
;
import
javax.persistence.Query
;
import
javax.persistence.Query
;
import
java
.util.Dat
e
;
import
java
x.sql.DataSourc
e
;
import
java.util.
List
;
import
java.util.
*
;
@Service
@Service
public
class
CustomerServiceImpl
implements
CustomerService
{
public
class
CustomerServiceImpl
implements
CustomerService
{
...
@@ -59,6 +65,10 @@ public class CustomerServiceImpl implements CustomerService {
...
@@ -59,6 +65,10 @@ public class CustomerServiceImpl implements CustomerService {
@Autowired
@Autowired
CustomerListMappingRepository
customerListMappingRepository
;
CustomerListMappingRepository
customerListMappingRepository
;
@Autowired
@Qualifier
(
DataSourceQualify
.
NAMED_JDBC_PARAMETER_TEMPLATE_CCMS_FULL
)
NamedParameterJdbcTemplate
namedParameterJdbcTemplate
;
@Override
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
getAllCustomer
(
int
page
,
int
pageSize
,
String
sort
,
long
customerListId
,
long
companySiteId
)
{
public
ResultDTO
getAllCustomer
(
int
page
,
int
pageSize
,
String
sort
,
long
customerListId
,
long
companySiteId
)
{
...
@@ -94,6 +104,10 @@ public class CustomerServiceImpl implements CustomerService {
...
@@ -94,6 +104,10 @@ public class CustomerServiceImpl implements CustomerService {
query
.
addScalar
(
"companyName"
,
new
StringType
());
query
.
addScalar
(
"companyName"
,
new
StringType
());
query
.
addScalar
(
"customerType"
,
new
StringType
());
query
.
addScalar
(
"customerType"
,
new
StringType
());
query
.
addScalar
(
"currentAddress"
,
new
StringType
());
query
.
addScalar
(
"currentAddress"
,
new
StringType
());
query
.
addScalar
(
"callAllowed"
,
new
ShortType
());
query
.
addScalar
(
"emailAllowed"
,
new
ShortType
());
query
.
addScalar
(
"smsAllowed"
,
new
ShortType
());
query
.
addScalar
(
"ipccStatus"
,
new
StringType
());
query
.
addScalar
(
"mobileNumber"
,
new
StringType
());
query
.
addScalar
(
"mobileNumber"
,
new
StringType
());
query
.
addScalar
(
"email"
,
new
StringType
());
query
.
addScalar
(
"email"
,
new
StringType
());
...
@@ -666,20 +680,46 @@ public class CustomerServiceImpl implements CustomerService {
...
@@ -666,20 +680,46 @@ public class CustomerServiceImpl implements CustomerService {
@Override
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
searchCustomerListInfoFromCustomerList
(
int
page
,
int
pageSize
,
String
sort
,
Long
campaignId
,
Long
companySiteId
)
{
public
List
<
CustomerListDTO
>
getCustomerListInfo
(
CampaignCustomerDTO
campaignCustomerDTO
)
{
ResultDTO
resultDTO
=
new
ResultDTO
()
;
List
<
CustomerListDTO
>
customerList
;
try
{
try
{
String
sql
=
SQLBuilder
.
getSqlQueryById
(
SQLBuilder
.
SQL_MODULE_CAMPAIGN_MNG
,
"search-customer-list-info-from-customer-list"
);
String
sql
=
SQLBuilder
.
getSqlQueryById
(
SQLBuilder
.
SQL_MODULE_CAMPAIGN_MNG
,
"search-customer-list-info-from-customer-list"
);
Query
query
=
entityManager
.
createNativeQuery
(
sql
);
Map
<
String
,
Object
>
param
=
new
HashMap
<>(
);
query
.
setParameter
(
"p_campaign_id"
,
campaignId
);
param
.
put
(
"p_campaign_id"
,
campaignCustomerDTO
.
getCampaignId
()
);
query
.
setParameter
(
"p_company_site_id"
,
companySiteId
);
param
.
put
(
"p_company_site_id"
,
campaignCustomerDTO
.
getCompanySiteId
()
);
resultDTO
.
setListData
(
query
.
getResultList
());
param
.
put
(
"p_page_number"
,
campaignCustomerDTO
.
getPage
());
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
param
.
put
(
"p_page_size"
,
campaignCustomerDTO
.
getPageSize
()
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
customerList
=
namedParameterJdbcTemplate
.
query
(
sql
,
param
,
new
BeanPropertyRowMapper
<>(
CustomerListDTO
.
class
)
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
return
null
;
resultDTO
.
setDescription
(
e
.
getMessage
());
}
}
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 @
bebc9042
...
@@ -7,7 +7,7 @@ import java.util.Date;
...
@@ -7,7 +7,7 @@ import java.util.Date;
@Getter
@Getter
@Setter
@Setter
public
class
CampaignCustomerDTO
{
public
class
CampaignCustomerDTO
extends
BaseDTO
{
private
Long
campaignCustomerListId
;
private
Long
campaignCustomerListId
;
private
Long
campaignId
;
private
Long
campaignId
;
private
Long
customerId
;
private
Long
customerId
;
...
...
src/main/java/com/viettel/campaign/web/dto/ContactCustResultDTO.java
View file @
bebc9042
...
@@ -19,7 +19,7 @@ public class ContactCustResultDTO extends BaseDTO{
...
@@ -19,7 +19,7 @@ public class ContactCustResultDTO extends BaseDTO{
private
Short
recordStatus
;
private
Short
recordStatus
;
private
String
description
;
private
String
description
;
private
Date
createTime
;
private
Date
createTime
;
private
Stri
ng
callTime
;
private
Lo
ng
callTime
;
private
Long
agentId
;
private
Long
agentId
;
private
Long
campaignId
;
private
Long
campaignId
;
private
String
campaignName
;
private
String
campaignName
;
...
...
src/main/java/com/viettel/campaign/web/dto/CustomerCustomDTO.java
View file @
bebc9042
...
@@ -15,6 +15,10 @@ public class CustomerCustomDTO {
...
@@ -15,6 +15,10 @@ public class CustomerCustomDTO {
String
companyName
;
String
companyName
;
String
customerType
;
String
customerType
;
String
currentAddress
;
String
currentAddress
;
Short
callAllowed
;
Short
emailAllowed
;
Short
smsAllowed
;
String
ipccStatus
;
String
mobileNumber
;
String
mobileNumber
;
String
email
;
String
email
;
}
}
src/main/java/com/viettel/campaign/web/dto/CustomerListDTO.java
View file @
bebc9042
...
@@ -21,4 +21,7 @@ public class CustomerListDTO extends BaseDTO {
...
@@ -21,4 +21,7 @@ public class CustomerListDTO extends BaseDTO {
private
Date
updateAt
;
private
Date
updateAt
;
private
String
source
;
private
String
source
;
private
String
deptCreate
;
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 @
bebc9042
...
@@ -41,4 +41,5 @@ public class CampaignRequestDTO extends BaseDTO {
...
@@ -41,4 +41,5 @@ public class CampaignRequestDTO extends BaseDTO {
String
campaignId
;
String
campaignId
;
String
surveyStatus
;
String
surveyStatus
;
String
roleUser
;
String
roleUser
;
String
contactCustId
;
}
}
src/main/java/com/viettel/campaign/web/rest/CampaignController.java
View file @
bebc9042
package
com.viettel.campaign.web.rest
;
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.CampaignExecuteService
;
import
com.viettel.campaign.service.CampaignService
;
import
com.viettel.campaign.service.CampaignService
;
import
com.viettel.campaign.web.dto.CampaignDTO
;
import
com.viettel.campaign.web.dto.CampaignDTO
;
...
@@ -13,6 +9,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
...
@@ -13,6 +9,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
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.cloud.sleuth.instrument.reactor.ReactorSleuth
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.MediaType
;
...
@@ -24,7 +21,6 @@ import javax.servlet.http.HttpServletResponse;
...
@@ -24,7 +21,6 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
@RestController
@RestController
...
@@ -40,12 +36,6 @@ public class CampaignController {
...
@@ -40,12 +36,6 @@ public class CampaignController {
@Autowired
@Autowired
CampaignExecuteService
campaignExecuteService
;
CampaignExecuteService
campaignExecuteService
;
@Autowired
TimeRangeDialModeRepository
timeRangeDialModeRepository
;
@Autowired
TimeZoneDialModeRepository
timeZoneDialModeRepository
;
@PostMapping
(
"/searchCampaignExecute"
)
@PostMapping
(
"/searchCampaignExecute"
)
@ResponseBody
@ResponseBody
public
ResponseEntity
<
ResultDTO
>
searchCampaignExecute
(
@RequestBody
CampaignRequestDTO
requestDto
)
{
public
ResponseEntity
<
ResultDTO
>
searchCampaignExecute
(
@RequestBody
CampaignRequestDTO
requestDto
)
{
...
@@ -164,15 +154,4 @@ public class CampaignController {
...
@@ -164,15 +154,4 @@ public class CampaignController {
headers
.
setContentType
(
MediaType
.
parseMediaType
(
"application/vnd.ms-excel"
));
headers
.
setContentType
(
MediaType
.
parseMediaType
(
"application/vnd.ms-excel"
));
return
new
ResponseEntity
<
byte
[]>(
contentReturn
,
headers
,
HttpStatus
.
OK
);
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 @
bebc9042
...
@@ -179,7 +179,7 @@ public class CustomerController {
...
@@ -179,7 +179,7 @@ public class CustomerController {
return
new
ResponseEntity
(
result
,
HttpStatus
.
OK
);
return
new
ResponseEntity
(
result
,
HttpStatus
.
OK
);
}
}
@
Ge
tMapping
(
"/getCustomerRecall"
)
@
Pos
tMapping
(
"/getCustomerRecall"
)
@ResponseBody
@ResponseBody
public
ResponseEntity
<
ResultDTO
>
getCustomerRecall
(
@RequestParam
(
"campaignId"
)
Long
campaignId
,
@RequestParam
(
"customerId"
)
Long
customerId
)
{
public
ResponseEntity
<
ResultDTO
>
getCustomerRecall
(
@RequestParam
(
"campaignId"
)
Long
campaignId
,
@RequestParam
(
"customerId"
)
Long
customerId
)
{
ResultDTO
result
=
customerService
.
getCustomerRecall
(
campaignId
,
customerId
);
ResultDTO
result
=
customerService
.
getCustomerRecall
(
campaignId
,
customerId
);
...
...
src/main/resources/sql/campaign-execute/get-combo-campaign-type.sql
View file @
bebc9042
select
PAR_VALUE
apParamId
,
select
PAR_VALUE
apParamId
,
PAR_NAME
parName
PAR_NAME
parName
from
AP_PARAM
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 @
bebc9042
select
COMPLETE_VALUE
apParamId
,
select
distinct
COMPLETE_VALUE
apParamId
,
COMPLETE_NAME
parName
COMPLETE_NAME
parName
from
CAMPAIGN_COMPLETE_CODE
from
CAMPAIGN_COMPLETE_CODE
where
to_char
(
COMPLETE_TYPE
)
=
:
p_complete_type
and
STATUS
=
1
and
COMPANY_SITE_ID
=
:
p_company_site_id
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 @
bebc9042
...
@@ -3,11 +3,12 @@ select b.campaign_code campaignCode,
...
@@ -3,11 +3,12 @@ select b.campaign_code campaignCode,
c
.
user_name
userName
,
c
.
user_name
userName
,
a
.
phone_number
phoneNumber
,
a
.
phone_number
phoneNumber
,
d
.
name
customerName
,
d
.
name
customerName
,
a
.
create_time
createTime
,
to_date
(
a
.
start_call
,
'DD/MM/YYYY'
)
startCall
,
e
.
complete_name
contactStatus
,
e
.
complete_name
contactStatus
,
f
.
complete_name
surveyStatus
,
f
.
complete_name
surveyStatus
,
g
.
status
status
,
g
.
status
status
,
a
.
status
recordStatus
a
.
status
recordStatus
,
(
a
.
end_time
-
a
.
start_call
)
*
24
*
60
callTime
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
...
...
src/main/resources/sql/campaign-mng/campaign-customer-detail-by-params.sql
View file @
bebc9042
...
@@ -8,6 +8,10 @@ select
...
@@ -8,6 +8,10 @@ select
b
.
COMPANY_NAME
companyName
,
b
.
COMPANY_NAME
companyName
,
b
.
CUSTOMER_TYPE
customerType
,
b
.
CUSTOMER_TYPE
customerType
,
b
.
CURRENT_ADDRESS
currentAddress
,
b
.
CURRENT_ADDRESS
currentAddress
,
b
.
CALL_ALLOWED
callAllowed
,
b
.
EMAIL_ALLOWED
emailAllowed
,
b
.
SMS_ALLOWED
smsAllowed
,
b
.
IPCC_STATUS
ipccStatus
,
c
.
MOBILE
mobileNumber
,
c
.
MOBILE
mobileNumber
,
d
.
EMAIL
email
d
.
EMAIL
email
from
CUSTOMER_LIST_MAPPING
a
from
CUSTOMER_LIST_MAPPING
a
...
...
src/main/resources/sql/campaign-mng/search-customer-list-info-from-customer-list.sql
View file @
bebc9042
...
@@ -19,16 +19,26 @@ count(customer_id) ktt
...
@@ -19,16 +19,26 @@ count(customer_id) ktt
from
campaign_customer
where
campaign_id
=
:
p_campaign_id
and
status
=
0
from
campaign_customer
where
campaign_id
=
:
p_campaign_id
and
status
=
0
and
in_campaign_status
=
1
and
in_campaign_status
=
1
group
by
customer_list_id
,
company_site_id
group
by
customer_list_id
,
company_site_id
)
),
datas
as
(
select
customer_list_code
ma
,
select
customer_list_code
customerListCode
,
customer_list_name
ten
,
customer_list_name
customerListName
,
cl
.
company_site_id
,
nvl
(
total
,
0
)
totalCusInList
,
nvl
(
total
,
0
)
tong
,
nvl
(
tt
,
0
)
totalCusInteract
,
nvl
(
tt
,
0
)
tongtt
,
nvl
(
ktt
,
0
)
totalCusNotInteract
nvl
(
ktt
,
0
)
tongktt
from
customer_list
cl
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
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
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
)
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
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 @
bebc9042
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