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
eb6c792e
Commit
eb6c792e
authored
Aug 25, 2019
by
=
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hungtt-commit campaign-mng customer-list
parent
01f97d3a
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
272 additions
and
2 deletions
+272
-2
src/main/java/com/viettel/campaign/repository/ccms_full/CampaignCustomerRepository.java
...aign/repository/ccms_full/CampaignCustomerRepository.java
+13
-1
src/main/java/com/viettel/campaign/repository/ccms_full/CampaignRepositoryCustom.java
...mpaign/repository/ccms_full/CampaignRepositoryCustom.java
+4
-0
src/main/java/com/viettel/campaign/repository/ccms_full/CustomerRepository.java
...tel/campaign/repository/ccms_full/CustomerRepository.java
+6
-0
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignRepositoryImpl.java
...ign/repository/ccms_full/impl/CampaignRepositoryImpl.java
+107
-0
src/main/java/com/viettel/campaign/service/CampaignService.java
...in/java/com/viettel/campaign/service/CampaignService.java
+6
-0
src/main/java/com/viettel/campaign/service/impl/CampaignServiceImpl.java
...om/viettel/campaign/service/impl/CampaignServiceImpl.java
+58
-0
src/main/java/com/viettel/campaign/web/dto/CampaignInformationDTO.java
.../com/viettel/campaign/web/dto/CampaignInformationDTO.java
+19
-0
src/main/java/com/viettel/campaign/web/dto/request_dto/CampaignRequestDTO.java
...ttel/campaign/web/dto/request_dto/CampaignRequestDTO.java
+3
-0
src/main/java/com/viettel/campaign/web/rest/CampaignController.java
...ava/com/viettel/campaign/web/rest/CampaignController.java
+22
-0
src/main/resources/sql/campaign-execute/get-execute-interactive.sql
...esources/sql/campaign-execute/get-execute-interactive.sql
+4
-1
src/main/resources/sql/campaign-mng/get-customer-campaign-information.sql
...es/sql/campaign-mng/get-customer-campaign-information.sql
+30
-0
No files found.
src/main/java/com/viettel/campaign/repository/ccms_full/CampaignCustomerRepository.java
View file @
eb6c792e
...
@@ -50,5 +50,17 @@ public interface CampaignCustomerRepository extends JpaRepository<CampaignCustom
...
@@ -50,5 +50,17 @@ public interface CampaignCustomerRepository extends JpaRepository<CampaignCustom
"AND CC.CUSTOMER_LIST_ID = :customerListId"
,
nativeQuery
=
true
)
"AND CC.CUSTOMER_LIST_ID = :customerListId"
,
nativeQuery
=
true
)
List
<
CampaignCustomer
>
findCustomerContacted
(
@Param
(
"campaignId"
)
Long
campaignId
,
@Param
(
"companySiteId"
)
Long
companySiteId
,
@Param
(
"customerListId"
)
Long
customerListId
);
List
<
CampaignCustomer
>
findCustomerContacted
(
@Param
(
"campaignId"
)
Long
campaignId
,
@Param
(
"companySiteId"
)
Long
companySiteId
,
@Param
(
"customerListId"
)
Long
customerListId
);
@Query
(
value
=
"with status_customer as (\n"
+
"select complete_value \n"
+
"from campaign_complete_code\n"
+
"where complete_value <> 4\n"
+
" and is_finish <> 1\n"
+
" and campaign_type = 1\n"
+
" and company_site_id = :p_company_site_id\n"
+
")\n"
+
"select * from campaign_customer\n"
+
"where campaign_id = :p_campaign_id\n"
+
" and customer_list_id = :p_cus_list_id\n"
+
" and (status = 0 or status in (select * from status_customer))"
,
nativeQuery
=
true
)
List
<
CampaignCustomer
>
findListCustomerToDel
(
@Param
(
"p_company_site_id"
)
Long
companySiteId
,
@Param
(
"p_campaign_id"
)
Long
campaignId
,
@Param
(
"p_cus_list_id"
)
Long
customerListId
);
}
}
src/main/java/com/viettel/campaign/repository/ccms_full/CampaignRepositoryCustom.java
View file @
eb6c792e
...
@@ -32,5 +32,9 @@ public interface CampaignRepositoryCustom {
...
@@ -32,5 +32,9 @@ public interface CampaignRepositoryCustom {
ResultDTO
getCustomerList
(
CampaignRequestDTO
dto
);
ResultDTO
getCustomerList
(
CampaignRequestDTO
dto
);
ResultDTO
getCustomerChoosenList
(
CampaignRequestDTO
dto
);
ResultDTO
getCustomerChoosenList
(
CampaignRequestDTO
dto
);
ResultDTO
getCampaignCustomerInformation
(
CampaignRequestDTO
dto
);
ResultDTO
getCustomerListInformation
(
CampaignRequestDTO
dto
);
//</editor-fold>
//</editor-fold>
}
}
src/main/java/com/viettel/campaign/repository/ccms_full/CustomerRepository.java
View file @
eb6c792e
...
@@ -32,4 +32,10 @@ public interface CustomerRepository extends JpaRepository<Customer, Long> {
...
@@ -32,4 +32,10 @@ public interface CustomerRepository extends JpaRepository<Customer, Long> {
@Query
(
"select c from Customer c left join com.viettel.campaign.model.ccms_full.CustomerTime ct on c.customerId = ct.customerId "
+
@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"
)
"where c.ipccStatus = 'locked' and c.siteId =?1 and ct.endTime <= ?2"
)
List
<
Customer
>
findAllByCondition
(
Long
siteId
,
Date
endTime
);
List
<
Customer
>
findAllByCondition
(
Long
siteId
,
Date
endTime
);
@Query
(
value
=
"select * from customer a\n"
+
"left join customer_list_mapping b on a.customer_id = b.customer_id\n"
+
"where b.customer_list_id = :p_customer_list_id\n"
+
" and a.customer_id not in (select cc.customer_id from campaign_customer cc where cc.campaign_id = :p_campaign_id and cc.customer_list_id = :p_customer_list_id)"
,
nativeQuery
=
true
)
List
<
Customer
>
findAllCutomerNotInCampagin
(
@Param
(
"p_customer_list_id"
)
Long
customerListId
,
@Param
(
"p_campaign_id"
)
Long
campaignId
);
}
}
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignRepositoryImpl.java
View file @
eb6c792e
...
@@ -864,4 +864,111 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
...
@@ -864,4 +864,111 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
return
resultDTO
;
return
resultDTO
;
}
}
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
getCampaignCustomerInformation
(
CampaignRequestDTO
dto
)
{
List
<
CampaignInformationDTO
>
list
=
new
ArrayList
();
ResultDTO
resultDTO
=
new
ResultDTO
();
Map
<
String
,
String
>
params
=
new
HashMap
<>();
StringBuilder
sb
=
new
StringBuilder
();
try
{
sb
.
append
(
" with status_customer as ("
);
sb
.
append
(
" select complete_value"
);
sb
.
append
(
" from campaign_complete_code"
);
sb
.
append
(
" where complete_value <> 4"
);
sb
.
append
(
" and is_finish <> 1"
);
sb
.
append
(
" and campaign_type = 1"
);
sb
.
append
(
" and company_site_id = :p_company_site_id"
);
sb
.
append
(
" ),"
);
sb
.
append
(
" count_customer as ("
);
sb
.
append
(
" select campaign_id campaignId,"
);
sb
.
append
(
" sum(case"
);
sb
.
append
(
" when customer_list_id is null then 1"
);
sb
.
append
(
" else 0"
);
sb
.
append
(
" end) totalIndividual,"
);
sb
.
append
(
" sum(case"
);
sb
.
append
(
" when status = 0 then 1"
);
sb
.
append
(
" else 0"
);
sb
.
append
(
" end) totalNotInteractive,"
);
sb
.
append
(
" sum(case"
);
sb
.
append
(
" when status in (select * from status_customer) then 1"
);
sb
.
append
(
" else 0"
);
sb
.
append
(
" end) totalNotCall"
);
sb
.
append
(
" from campaign_customer"
);
sb
.
append
(
" group by campaign_id"
);
sb
.
append
(
" )"
);
sb
.
append
(
" select a.*, b.customer_number campaignCustomer"
);
sb
.
append
(
" from count_customer a"
);
sb
.
append
(
" left join campaign b on a.campaignId = b.campaign_id"
);
sb
.
append
(
" where a.campaignId = :p_campaign_id"
);
params
.
put
(
"p_campaign_id"
,
dto
.
getCampaignId
());
params
.
put
(
"p_company_site_id"
,
dto
.
getCompanySiteId
());
list
=
namedParameterJdbcTemplate
.
query
(
sb
.
toString
(),
params
,
BeanPropertyRowMapper
.
newInstance
(
CampaignInformationDTO
.
class
));
if
(
list
.
size
()
>
0
)
{
resultDTO
.
setData
(
list
.
get
(
0
));
}
else
{
resultDTO
.
setData
(
list
);
}
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
}
return
resultDTO
;
}
@Override
public
ResultDTO
getCustomerListInformation
(
CampaignRequestDTO
dto
)
{
List
<
CampaignInformationDTO
>
list
=
new
ArrayList
();
ResultDTO
resultDTO
=
new
ResultDTO
();
Map
<
String
,
String
>
params
=
new
HashMap
<>();
StringBuilder
sb
=
new
StringBuilder
();
try
{
sb
.
append
(
" with status_customer as ("
);
sb
.
append
(
" select complete_value"
);
sb
.
append
(
" from campaign_complete_code"
);
sb
.
append
(
" where complete_value <> 4"
);
sb
.
append
(
" and is_finish <> 1"
);
sb
.
append
(
" and campaign_type = 1"
);
sb
.
append
(
" and company_site_id = :p_company_site_id"
);
sb
.
append
(
" ),"
);
sb
.
append
(
" count_customer as ("
);
sb
.
append
(
" select campaign_id campaignId,"
);
sb
.
append
(
" customer_list_id customerListId,"
);
sb
.
append
(
" sum(case"
);
sb
.
append
(
" when customer_list_id is null then 1"
);
sb
.
append
(
" else 0"
);
sb
.
append
(
" end) totalIndividual,"
);
sb
.
append
(
" sum(case"
);
sb
.
append
(
" when status = 0 then 1"
);
sb
.
append
(
" else 0"
);
sb
.
append
(
" end) totalNotInteractive,"
);
sb
.
append
(
" sum(case"
);
sb
.
append
(
" when status in (select * from status_customer) then 1"
);
sb
.
append
(
" else 0"
);
sb
.
append
(
" end) totalNotCall"
);
sb
.
append
(
" from campaign_customer"
);
sb
.
append
(
" group by customer_list_id, campaign_id"
);
sb
.
append
(
" )"
);
sb
.
append
(
" select a.*, b.customer_number campaignCustomer"
);
sb
.
append
(
" from count_customer a"
);
sb
.
append
(
" left join campaign b on a.campaignId = b.campaign_id"
);
sb
.
append
(
" where a.campaignId = :p_campaign_id"
);
sb
.
append
(
" and customerListId is not null"
);
params
.
put
(
"p_campaign_id"
,
dto
.
getCampaignId
());
params
.
put
(
"p_company_site_id"
,
dto
.
getCompanySiteId
());
list
=
namedParameterJdbcTemplate
.
query
(
sb
.
toString
(),
params
,
BeanPropertyRowMapper
.
newInstance
(
CampaignInformationDTO
.
class
));
resultDTO
.
setListData
(
list
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
}
return
resultDTO
;
}
}
}
src/main/java/com/viettel/campaign/service/CampaignService.java
View file @
eb6c792e
...
@@ -66,6 +66,12 @@ public interface CampaignService {
...
@@ -66,6 +66,12 @@ public interface CampaignService {
ResultDTO
deleteCustomerListFromCampaign
(
CampaignRequestDTO
dto
);
ResultDTO
deleteCustomerListFromCampaign
(
CampaignRequestDTO
dto
);
ResultDTO
saveFieldCustomer
(
CampaignRequestDTO
dto
);
ResultDTO
saveFieldCustomer
(
CampaignRequestDTO
dto
);
ResultDTO
getCampaignCustomerInformation
(
CampaignRequestDTO
dto
);
ResultDTO
getCustomerListInformation
(
CampaignRequestDTO
dto
);
ResultDTO
saveCustomerCampaign
(
CampaignRequestDTO
dto
);
//</editor-fold>
//</editor-fold>
}
}
src/main/java/com/viettel/campaign/service/impl/CampaignServiceImpl.java
View file @
eb6c792e
...
@@ -70,6 +70,9 @@ public class CampaignServiceImpl implements CampaignService {
...
@@ -70,6 +70,9 @@ public class CampaignServiceImpl implements CampaignService {
@Autowired
@Autowired
CampaignCustomerListColumnRepository
campaignCustomerListColumnRepository
;
CampaignCustomerListColumnRepository
campaignCustomerListColumnRepository
;
@Autowired
CustomerRepository
customerRepository
;
@Override
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
search
(
CampaignRequestDTO
requestDto
)
{
public
ResultDTO
search
(
CampaignRequestDTO
requestDto
)
{
...
@@ -613,6 +616,61 @@ public class CampaignServiceImpl implements CampaignService {
...
@@ -613,6 +616,61 @@ public class CampaignServiceImpl implements CampaignService {
return
resultDTO
;
return
resultDTO
;
}
}
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
getCampaignCustomerInformation
(
CampaignRequestDTO
dto
)
{
return
campaignRepositoryCustom
.
getCampaignCustomerInformation
(
dto
);
}
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
getCustomerListInformation
(
CampaignRequestDTO
dto
)
{
return
campaignRepositoryCustom
.
getCustomerListInformation
(
dto
);
}
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
saveCustomerCampaign
(
CampaignRequestDTO
dto
)
{
ResultDTO
resultDTO
=
new
ResultDTO
();
long
campaignId
=
Long
.
parseLong
(
dto
.
getCampaignId
());
long
companySiteId
=
Long
.
parseLong
(
dto
.
getCompanySiteId
());
List
<
CustomerListDTO
>
listCustomerDto
=
dto
.
getLstCustomerCampaign
();
try
{
// Thuc hien them giam khach hang
for
(
CustomerListDTO
customerListDTO
:
listCustomerDto
)
{
if
(
customerListDTO
.
getTotalCusAddRemove
()
>
0
)
{
// Them khach hang
// Lay ra danh sach khach hang phu hop de them
List
<
Customer
>
listCustomerToAdd
=
customerRepository
.
findAllCutomerNotInCampagin
(
customerListDTO
.
getCustomerListId
(),
campaignId
);
for
(
int
i
=
0
;
i
<
customerListDTO
.
getTotalCusAddRemove
();
i
++)
{
CampaignCustomer
campaignCustomerEntity
=
new
CampaignCustomer
();
campaignCustomerEntity
.
setCampaignId
(
campaignId
);
campaignCustomerEntity
.
setCustomerId
(
listCustomerToAdd
.
get
(
i
).
getCustomerId
());
campaignCustomerEntity
.
setStatus
((
short
)
0
);
campaignCustomerEntity
.
setRecallCount
(
0L
);
campaignCustomerEntity
.
setCustomerListId
(
customerListDTO
.
getCustomerListId
());
campaignCustomerEntity
.
setCompanySiteId
(
companySiteId
);
campaignCustomerEntity
.
setInCampaignStatus
((
short
)
1
);
campaignCustomerRepository
.
save
(
campaignCustomerEntity
);
}
}
else
if
(
customerListDTO
.
getTotalCusAddRemove
()
<
0
){
// Loai bo khach hang
long
custToDel
=
Math
.
abs
(
customerListDTO
.
getTotalCusAddRemove
());
// Lay ra danh sach khach hang can loai bo
List
<
CampaignCustomer
>
listCustomerToDelete
=
campaignCustomerRepository
.
findListCustomerToDel
(
companySiteId
,
campaignId
,
customerListDTO
.
getCustomerListId
());
for
(
int
j
=
0
;
j
<
custToDel
;
j
++)
{
campaignCustomerRepository
.
delete
(
listCustomerToDelete
.
get
(
j
));
}
}
}
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
}
return
resultDTO
;
}
// hungtt
// hungtt
private
Map
<
String
,
String
>
setMapData
(
Map
<
String
,
String
>
mapColumn
,
Locale
locale
)
{
private
Map
<
String
,
String
>
setMapData
(
Map
<
String
,
String
>
mapColumn
,
Locale
locale
)
{
mapColumn
.
put
(
"CUSTOMER_ID"
,
BundleUtils
.
getLangString
(
"CUSTOMER_ID"
,
locale
));
mapColumn
.
put
(
"CUSTOMER_ID"
,
BundleUtils
.
getLangString
(
"CUSTOMER_ID"
,
locale
));
...
...
src/main/java/com/viettel/campaign/web/dto/CampaignInformationDTO.java
0 → 100644
View file @
eb6c792e
package
com.viettel.campaign.web.dto
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public
class
CampaignInformationDTO
{
private
Long
campaignId
;
private
Long
totalIndividual
;
private
Long
totalNotInteractive
;
private
Long
totalNotCall
;
private
Long
campaignCustomer
;
private
Long
customerListId
;
}
src/main/java/com/viettel/campaign/web/dto/request_dto/CampaignRequestDTO.java
View file @
eb6c792e
...
@@ -2,6 +2,7 @@ package com.viettel.campaign.web.dto.request_dto;
...
@@ -2,6 +2,7 @@ package com.viettel.campaign.web.dto.request_dto;
import
com.viettel.campaign.web.dto.BaseDTO
;
import
com.viettel.campaign.web.dto.BaseDTO
;
import
com.viettel.campaign.web.dto.CustomerCustomDTO
;
import
com.viettel.campaign.web.dto.CustomerCustomDTO
;
import
com.viettel.campaign.web.dto.CustomerListDTO
;
import
com.viettel.campaign.web.dto.FieldsToShowDTO
;
import
com.viettel.campaign.web.dto.FieldsToShowDTO
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
...
@@ -53,4 +54,6 @@ public class CampaignRequestDTO extends BaseDTO {
...
@@ -53,4 +54,6 @@ public class CampaignRequestDTO extends BaseDTO {
String
createTimeFr
;
String
createTimeFr
;
String
lstCustomerListId
;
String
lstCustomerListId
;
List
<
FieldsToShowDTO
>
lstFiedCustomer
;
List
<
FieldsToShowDTO
>
lstFiedCustomer
;
List
<
CustomerListDTO
>
lstCustomerCampaign
;
String
customerListId
;
}
}
src/main/java/com/viettel/campaign/web/rest/CampaignController.java
View file @
eb6c792e
...
@@ -305,6 +305,28 @@ public class CampaignController {
...
@@ -305,6 +305,28 @@ public class CampaignController {
return
new
ResponseEntity
<>(
resultDTO
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
resultDTO
,
HttpStatus
.
OK
);
}
}
@PostMapping
(
"/getCampaignCustomerInformation"
)
@ResponseBody
public
ResponseEntity
getCampaignCustomerInformation
(
@RequestBody
CampaignRequestDTO
campaignRequestDTO
)
{
campaignRequestDTO
.
setCustomerListId
(
null
);
ResultDTO
resultDTO
=
campaignService
.
getCampaignCustomerInformation
(
campaignRequestDTO
);
return
new
ResponseEntity
<>(
resultDTO
,
HttpStatus
.
OK
);
}
@PostMapping
(
"/getCustomerListInformation"
)
@ResponseBody
public
ResponseEntity
getCustomerListInformation
(
@RequestBody
CampaignRequestDTO
campaignRequestDTO
)
{
ResultDTO
resultDTO
=
campaignService
.
getCustomerListInformation
(
campaignRequestDTO
);
return
new
ResponseEntity
<>(
resultDTO
,
HttpStatus
.
OK
);
}
@PostMapping
(
"/saveCustomerCampaign"
)
@ResponseBody
public
ResponseEntity
saveCustomerCampaign
(
@RequestBody
CampaignRequestDTO
campaignRequestDTO
)
{
ResultDTO
resultDTO
=
campaignService
.
saveCustomerCampaign
(
campaignRequestDTO
);
return
new
ResponseEntity
<>(
resultDTO
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/renewCampaign"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/renewCampaign"
,
method
=
RequestMethod
.
PUT
)
public
ResponseEntity
<
ResultDTO
>
renewCampaign
(
@RequestBody
CampaignDTO
campaignDTO
)
{
public
ResponseEntity
<
ResultDTO
>
renewCampaign
(
@RequestBody
CampaignDTO
campaignDTO
)
{
ResultDTO
result
=
campaignService
.
renewCampaign
(
campaignDTO
);
ResultDTO
result
=
campaignService
.
renewCampaign
(
campaignDTO
);
...
...
src/main/resources/sql/campaign-execute/get-execute-interactive.sql
View file @
eb6c792e
...
@@ -60,6 +60,9 @@ where a.status <> 0
...
@@ -60,6 +60,9 @@ where a.status <> 0
),
),
data
as
(
data
as
(
select
a
.
*
,
rownum
row_
from
data_temp
a
select
a
.
*
,
rownum
row_
from
data_temp
a
),
count_data
as
(
select
count
(
*
)
totalRow
from
data_temp
)
)
select
*
from
data
select
campaignCode
,
campaignName
,
userName
,
phoneNumber
,
customerName
,
startCall
,
contactStatus
,
surveyStatus
,
status
,
recordStatus
,
callTime
,
totalRow
from
data
,
count_
data
where
:
p_page_size
=
0
or
(
row_
>=
((:
p_page_number
-
1
)
*
:
p_page_size
+
1
)
and
row_
<
(:
p_page_number
*
:
p_page_size
+
1
))
where
:
p_page_size
=
0
or
(
row_
>=
((:
p_page_number
-
1
)
*
:
p_page_size
+
1
)
and
row_
<
(:
p_page_number
*
:
p_page_size
+
1
))
src/main/resources/sql/campaign-mng/get-customer-campaign-information.sql
0 → 100644
View file @
eb6c792e
with
status_customer
as
(
select
complete_value
from
campaign_complete_code
where
complete_value
<>
4
and
is_finish
<>
1
and
campaign_type
=
1
and
company_site_id
=
:
p_company_site_id
),
count_customer
as
(
select
campaign_id
campaignId
,
sum
(
case
when
customer_list_id
is
null
then
1
else
0
end
)
totalIndividual
,
sum
(
case
when
status
=
0
then
1
else
0
end
)
totalNotInteractive
,
sum
(
case
when
status
in
(
select
*
from
status_customer
)
then
1
else
0
end
)
totalNotCall
from
campaign_customer
where
:
p_cus_list_id
is
null
or
customer_list_id
=
:
p_cus_list_id
group
by
campaign_id
)
select
a
.
*
,
b
.
customer_number
campaignCustomer
from
count_customer
a
left
join
campaign
b
on
a
.
campaignId
=
b
.
campaign_id
where
a
.
campaignId
=
:
p_campaign_id
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