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
f6139454
Commit
f6139454
authored
Aug 07, 2019
by
Vu Duy Anh
Browse files
Options
Browse Files
Download
Plain Diff
anhvd commit change
parents
9810d9f3
34ea2d6c
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
333 additions
and
111 deletions
+333
-111
campaign.iml
campaign.iml
+0
-1
src/main/java/com/viettel/campaign/model/CustomerContact.java
...main/java/com/viettel/campaign/model/CustomerContact.java
+46
-0
src/main/java/com/viettel/campaign/repository/CustomerContactRepository.java
...iettel/campaign/repository/CustomerContactRepository.java
+10
-0
src/main/java/com/viettel/campaign/repository/CustomerListMappingRepository.java
...el/campaign/repository/CustomerListMappingRepository.java
+20
-2
src/main/java/com/viettel/campaign/repository/CustomerListRepository.java
...m/viettel/campaign/repository/CustomerListRepository.java
+6
-2
src/main/java/com/viettel/campaign/repository/CustomerRepository.java
...a/com/viettel/campaign/repository/CustomerRepository.java
+2
-0
src/main/java/com/viettel/campaign/repository/impl/CampaignRepositoryImpl.java
...ttel/campaign/repository/impl/CampaignRepositoryImpl.java
+21
-15
src/main/java/com/viettel/campaign/service/CustomerService.java
...in/java/com/viettel/campaign/service/CustomerService.java
+11
-3
src/main/java/com/viettel/campaign/service/impl/CampaignCompleteCodeServiceImpl.java
...ampaign/service/impl/CampaignCompleteCodeServiceImpl.java
+2
-1
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
...om/viettel/campaign/service/impl/CustomerServiceImpl.java
+128
-65
src/main/java/com/viettel/campaign/utils/SQLBuilder.java
src/main/java/com/viettel/campaign/utils/SQLBuilder.java
+0
-1
src/main/java/com/viettel/campaign/web/dto/CampaignDTO.java
src/main/java/com/viettel/campaign/web/dto/CampaignDTO.java
+1
-1
src/main/java/com/viettel/campaign/web/dto/CustomerContactDTO.java
...java/com/viettel/campaign/web/dto/CustomerContactDTO.java
+23
-0
src/main/java/com/viettel/campaign/web/dto/request_dto/CampaignCustomerRequestDTO.java
...paign/web/dto/request_dto/CampaignCustomerRequestDTO.java
+15
-0
src/main/java/com/viettel/campaign/web/dto/request_dto/DeleteCustomerRequestDTO.java
...ampaign/web/dto/request_dto/DeleteCustomerRequestDTO.java
+14
-0
src/main/java/com/viettel/campaign/web/rest/controller/CustomerController.java
...ttel/campaign/web/rest/controller/CustomerController.java
+23
-9
src/main/resources/sql/campaign-mng/search-campaign-customer-by-params.sql
...s/sql/campaign-mng/search-campaign-customer-by-params.sql
+11
-11
No files found.
campaign.iml
View file @
f6139454
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<module
org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule=
"true"
type=
"JAVA_MODULE"
version=
"4"
>
<module
org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule=
"true"
type=
"JAVA_MODULE"
version=
"4"
>
<component
name=
"ExternalSystem"
externalSystem=
"Maven"
/>
<component
name=
"FacetManager"
>
<component
name=
"FacetManager"
>
<facet
type=
"Spring"
name=
"Spring"
>
<facet
type=
"Spring"
name=
"Spring"
>
<configuration
/>
<configuration
/>
...
...
src/main/java/com/viettel/campaign/model/CustomerContact.java
0 → 100644
View file @
f6139454
package
com.viettel.campaign.model
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotNull
;
import
java.util.Date
;
@Entity
@Table
(
name
=
"CUSTOMER_CONTACT"
)
@Getter
@Setter
public
class
CustomerContact
{
@Id
@Basic
(
optional
=
false
)
@NotNull
@Column
(
name
=
"CONTACT_ID"
)
private
Long
contactId
;
@Column
(
name
=
"CUSTOMER_ID"
)
private
Long
customerId
;
@Column
(
name
=
"CONTACT_TYPE"
)
private
Short
contactType
;
@Column
(
name
=
"CONTACT"
)
private
String
contact
;
@Column
(
name
=
"IS_DIRECT_LINE"
)
private
Short
isDirectLine
;
@Column
(
name
=
"STATUS"
)
private
Short
status
;
@Column
(
name
=
"CREATE_DATE"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Date
createDate
;
@Column
(
name
=
"UPDATE_DATE"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Date
updateDate
;
@Column
(
name
=
"CREATE_BY"
)
private
String
createBy
;
@Column
(
name
=
"UPDATE_BY"
)
private
String
updateBy
;
@Column
(
name
=
"START_DATE"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Date
startDate
;
@Column
(
name
=
"END_DATE"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Date
endDate
;
}
src/main/java/com/viettel/campaign/repository/CustomerContactRepository.java
0 → 100644
View file @
f6139454
package
com.viettel.campaign.repository
;
import
com.viettel.campaign.model.CustomerContact
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
java.util.List
;
public
interface
CustomerContactRepository
extends
JpaRepository
<
CustomerContact
,
Long
>
{
List
<
CustomerContact
>
findByCustomerIdAndAndContactTypeAndContact
(
Long
customerId
,
Short
contactType
,
String
contact
);
}
src/main/java/com/viettel/campaign/repository/CustomerListMappingRepository.java
View file @
f6139454
...
@@ -6,9 +6,27 @@ import org.springframework.data.jpa.repository.Modifying;
...
@@ -6,9 +6,27 @@ import org.springframework.data.jpa.repository.Modifying;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.repository.query.Param
;
import
org.springframework.data.repository.query.Param
;
import
java.util.List
;
public
interface
CustomerListMappingRepository
extends
JpaRepository
<
CustomerListMapping
,
Long
>
{
public
interface
CustomerListMappingRepository
extends
JpaRepository
<
CustomerListMapping
,
Long
>
{
// ----------- customer ------------ //
@Modifying
@Query
(
"delete from CustomerListMapping c where c.customerId=:p_customer_id and c.customerListId=:p_customer_list_id"
)
int
deleteMappingByCustomerId
(
@Param
(
"p_customer_id"
)
Long
p_customer_id
,
@Param
(
"p_customer_list_id"
)
Long
p_customer_list_id
);
@Modifying
@Query
(
"delete from CustomerListMapping c where c.customerId in (:p_id) and c.customerListId =:p_customer_list_id"
)
int
deleteMappingByCustomerIds
(
@Param
(
"p_id"
)
List
<
Long
>
p_id
,
@Param
(
"p_customer_list_id"
)
Long
p_customer_list_id
);
// ----------- customer list --------------- //
@Modifying
@Query
(
"delete from CustomerListMapping c where c.customerListId=:p_customerListId"
)
int
deleteMappingByCustomerListId
(
@Param
(
"p_customerListId"
)
Long
p_customerListId
);
@Modifying
@Modifying
@Query
(
"delete from CustomerListMapping c where c.customerListId
=:customerListId
"
)
@Query
(
"delete from CustomerListMapping c where c.customerListId
in (:p_ids)
"
)
int
deleteMappingByCustomerListId
(
@Param
(
"customerListId"
)
Long
customerListId
);
int
deleteMappingByCustomerListId
s
(
@Param
(
"p_ids"
)
List
<
Long
>
p_ids
);
}
}
src/main/java/com/viettel/campaign/repository/CustomerListRepository.java
View file @
f6139454
...
@@ -15,6 +15,10 @@ public interface CustomerListRepository extends JpaRepository<CustomerList, Long
...
@@ -15,6 +15,10 @@ public interface CustomerListRepository extends JpaRepository<CustomerList, Long
CustomerList
findByCustomerListCode
(
String
customerListCode
);
CustomerList
findByCustomerListCode
(
String
customerListCode
);
@Modifying
@Modifying
@Query
(
"delete from CustomerList c where c.customerListId in (:ids)"
)
@Query
(
"update CustomerList c set c.status = 0 where c.customerListId=:p_customerListId"
)
int
deleteCustomerListIds
(
@Param
(
"ids"
)
List
<
Long
>
ids
);
int
deleteCustomerList
(
@Param
(
"p_customerListId"
)
Long
p_customerListId
);
@Modifying
@Query
(
"update CustomerList c set c.status = 0 where c.customerListId in (:p_ids)"
)
int
deleteCustomerListIds
(
@Param
(
"p_ids"
)
List
<
Long
>
p_ids
);
}
}
src/main/java/com/viettel/campaign/repository/CustomerRepository.java
View file @
f6139454
...
@@ -16,6 +16,8 @@ public interface CustomerRepository extends JpaRepository<Customer, Long> {
...
@@ -16,6 +16,8 @@ public interface CustomerRepository extends JpaRepository<Customer, Long> {
Page
<
Customer
>
findAll
(
Pageable
pageable
);
Page
<
Customer
>
findAll
(
Pageable
pageable
);
List
<
Customer
>
findByCustomerId
(
Long
customerId
);
@Query
(
"FROM Customer WHERE name = ?1"
)
@Query
(
"FROM Customer WHERE name = ?1"
)
List
<
Customer
>
findByName
(
String
firstName
,
Pageable
pageable
);
List
<
Customer
>
findByName
(
String
firstName
,
Pageable
pageable
);
...
...
src/main/java/com/viettel/campaign/repository/impl/CampaignRepositoryImpl.java
View file @
f6139454
...
@@ -21,6 +21,7 @@ import org.springframework.stereotype.Repository;
...
@@ -21,6 +21,7 @@ import org.springframework.stereotype.Repository;
import
javax.persistence.EntityManager
;
import
javax.persistence.EntityManager
;
import
javax.persistence.Query
;
import
javax.persistence.Query
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -37,18 +38,17 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
...
@@ -37,18 +38,17 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
ResultDTO
result
=
new
ResultDTO
();
ResultDTO
result
=
new
ResultDTO
();
List
<
CampaignDTO
>
lst
=
new
ArrayList
<>();
List
<
CampaignDTO
>
lst
=
new
ArrayList
<>();
StringBuilder
expression
=
new
StringBuilder
()
StringBuilder
expression
=
new
StringBuilder
()
.
append
(
" SELECT C.CAMPAIGN_CODE, C.CAMPAIGN_NAME, C.CONTENT, C.START_TIME, C.END_TIME, C.STATUS "
)
.
append
(
" SELECT C.CAMPAIGN_CODE, C.CAMPAIGN_NAME, C.CONTENT, C.START_TIME, C.END_TIME, C.STATUS
, CA.STATUS AS AGENT_STATUS
"
)
.
append
(
" FROM CAMPAIGN C INNER JOIN CAMPAIGN_AGENT CA ON C.CAMPAIGN_ID = CA.CAMPAIGN_ID "
)
.
append
(
" FROM CAMPAIGN C INNER JOIN CAMPAIGN_AGENT CA ON C.CAMPAIGN_ID = CA.CAMPAIGN_ID "
)
.
append
(
" WHERE 1 = 1 "
)
.
append
(
" WHERE 1 = 1 "
)
;
//.append(" AND CA.AGENT_ID = :pAgentId ")
//.append(" AND CA.AGENT_ID = :pAgentId ")
.
append
(
" AND C.STATUS IN (2,3) "
);
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getCampaignCode
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getCampaignCode
()))
{
expression
.
append
(
" AND C.CAMPAIGN_
ID IN (:pCampaingId
) "
);
expression
.
append
(
" AND C.CAMPAIGN_
CODE IN (:pCampaignCode
) "
);
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getCampaignName
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getCampaignName
()))
{
expression
.
append
(
" AND UPPER(C.CAMPAIGN_NAME) LIKE
CONCAT('%',:pCampaignName,'%')
"
);
expression
.
append
(
" AND UPPER(C.CAMPAIGN_NAME) LIKE
:pCampaignName
"
);
}
}
if
(!
DataUtil
.
isNullOrZero
(
campaignRequestDto
.
getStatus
().
longValue
()))
{
if
(!
DataUtil
.
isNullOrZero
(
campaignRequestDto
.
getStatus
().
longValue
()))
{
...
@@ -88,40 +88,45 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
...
@@ -88,40 +88,45 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getCampaignCode
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getCampaignCode
()))
{
String
[]
lstCode
=
campaignRequestDto
.
getCampaignCode
().
split
(
","
);
String
[]
lstCode
=
campaignRequestDto
.
getCampaignCode
().
split
(
","
);
query
.
setParameter
(
"
:pCampaingId
"
,
lstCode
);
query
.
setParameter
(
"
pCampaignCode
"
,
lstCode
);
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getCampaignName
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getCampaignName
()))
{
query
.
setParameter
(
":pCampaignName"
,
campaignRequestDto
.
getCampaignName
().
toUpperCase
());
query
.
setParameter
(
"pCampaignName"
,
"%"
+
campaignRequestDto
.
getCampaignName
().
toUpperCase
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\\\%"
)
.
replaceAll
(
"_"
,
"\\\\_"
)
+
"%"
);
}
}
if
(!
DataUtil
.
isNullOrZero
(
campaignRequestDto
.
getStatus
().
longValue
()))
{
if
(!
DataUtil
.
isNullOrZero
(
campaignRequestDto
.
getStatus
().
longValue
()))
{
if
(
campaignRequestDto
.
getStatus
()
!=
0
)
if
(
campaignRequestDto
.
getStatus
()
!=
0
)
query
.
setParameter
(
"
:
pStatus"
,
campaignRequestDto
.
getStatus
());
query
.
setParameter
(
"pStatus"
,
campaignRequestDto
.
getStatus
());
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getFromDateFr
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getFromDateFr
()))
{
query
.
setParameter
(
"
:
pStartTimeFr"
,
campaignRequestDto
.
getFromDateFr
());
query
.
setParameter
(
"pStartTimeFr"
,
campaignRequestDto
.
getFromDateFr
());
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getFromDateTo
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getFromDateTo
()))
{
query
.
setParameter
(
"
:
pStartTimeTo"
,
campaignRequestDto
.
getFromDateTo
());
query
.
setParameter
(
"pStartTimeTo"
,
campaignRequestDto
.
getFromDateTo
());
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getToDateFr
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getToDateFr
()))
{
query
.
setParameter
(
"
:
pEndTimeFr"
,
campaignRequestDto
.
getToDateFr
());
query
.
setParameter
(
"pEndTimeFr"
,
campaignRequestDto
.
getToDateFr
());
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getToDateTo
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getToDateTo
()))
{
query
.
setParameter
(
"
:
pEndTimeTo"
,
campaignRequestDto
.
getToDateTo
());
query
.
setParameter
(
"pEndTimeTo"
,
campaignRequestDto
.
getToDateTo
());
}
}
if
(!
DataUtil
.
isNullOrZero
(
campaignRequestDto
.
getNumOfCusFr
()))
{
if
(!
DataUtil
.
isNullOrZero
(
campaignRequestDto
.
getNumOfCusFr
()))
{
query
.
setParameter
(
"
:
pCustNumFr"
,
campaignRequestDto
.
getNumOfCusFr
());
query
.
setParameter
(
"pCustNumFr"
,
campaignRequestDto
.
getNumOfCusFr
());
}
}
if
(!
DataUtil
.
isNullOrZero
(
campaignRequestDto
.
getNumOfCusTo
()))
{
if
(!
DataUtil
.
isNullOrZero
(
campaignRequestDto
.
getNumOfCusTo
()))
{
query
.
setParameter
(
"
:
pCustNumTo"
,
campaignRequestDto
.
getNumOfCusTo
());
query
.
setParameter
(
"pCustNumTo"
,
campaignRequestDto
.
getNumOfCusTo
());
}
}
result
.
setTotalRow
(
query
.
getResultList
().
size
());
result
.
setTotalRow
(
query
.
getResultList
().
size
());
...
@@ -144,7 +149,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
...
@@ -144,7 +149,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
item
.
setContent
((
String
)
obj
[
2
]);
item
.
setContent
((
String
)
obj
[
2
]);
item
.
setStartTime
((
Date
)
obj
[
3
]);
item
.
setStartTime
((
Date
)
obj
[
3
]);
item
.
setEndTime
((
Date
)
obj
[
4
]);
item
.
setEndTime
((
Date
)
obj
[
4
]);
item
.
setStatus
(((
Short
)
obj
[
5
]));
item
.
setStatus
(((
BigDecimal
)
obj
[
5
]).
shortValueExact
());
item
.
setAgentStatus
(((
BigDecimal
)
obj
[
6
]).
shortValueExact
());
lst
.
add
(
item
);
lst
.
add
(
item
);
}
}
...
...
src/main/java/com/viettel/campaign/service/CustomerService.java
View file @
f6139454
...
@@ -3,6 +3,8 @@ package com.viettel.campaign.service;
...
@@ -3,6 +3,8 @@ package com.viettel.campaign.service;
import
com.viettel.campaign.web.dto.CustomerDTO
;
import
com.viettel.campaign.web.dto.CustomerDTO
;
import
com.viettel.campaign.web.dto.CustomerListDTO
;
import
com.viettel.campaign.web.dto.CustomerListDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.web.dto.request_dto.CampaignCustomerRequestDTO
;
import
com.viettel.campaign.web.dto.request_dto.DeleteCustomerRequestDTO
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -12,13 +14,15 @@ public interface CustomerService {
...
@@ -12,13 +14,15 @@ public interface CustomerService {
Map
listAllCustomer
(
int
page
,
int
pageSize
,
String
sort
);
Map
listAllCustomer
(
int
page
,
int
pageSize
,
String
sort
);
ResultDTO
getCustomerId
(
Long
customerId
);
Map
listCustByName
(
int
page
,
int
pageSize
,
String
sort
,
String
name
);
Map
listCustByName
(
int
page
,
int
pageSize
,
String
sort
,
String
name
);
ResultDTO
createCustomer
(
CustomerDTO
customerDTO
);
ResultDTO
createCustomer
(
CustomerDTO
customerDTO
);
ResultDTO
deleteCustomer
(
CustomerDTO
customer
DTO
);
ResultDTO
deleteCustomer
(
DeleteCustomerRequestDTO
deleteCustomerRequest
DTO
);
ResultDTO
deleteIds
(
List
<
Long
>
ids
);
ResultDTO
deleteIds
(
DeleteCustomerRequestDTO
deleteCustomerRequestDTO
);
// ------------ customer list ------------ //
// ------------ customer list ------------ //
...
@@ -32,5 +36,9 @@ public interface CustomerService {
...
@@ -32,5 +36,9 @@ public interface CustomerService {
ResultDTO
deleteCustomerListIds
(
List
<
Long
>
ids
);
ResultDTO
deleteCustomerListIds
(
List
<
Long
>
ids
);
ResultDTO
searchCustomerList
(
String
customerListCode
,
String
customerListName
,
Date
dateFrom
,
Date
dateTo
,
int
page
,
int
pageSize
,
String
sort
);
ResultDTO
searchCustomerList
(
CampaignCustomerRequestDTO
campaignCustomerRequestDTO
);
// ------------ customer contact ------------ //
ResultDTO
getCustomerContact
(
Long
customerId
,
Short
contactType
,
String
contact
);
}
}
src/main/java/com/viettel/campaign/service/CampaignCompleteCodeServiceImpl.java
→
src/main/java/com/viettel/campaign/service/
impl/
CampaignCompleteCodeServiceImpl.java
View file @
f6139454
package
com.viettel.campaign.service
;
package
com.viettel.campaign.service
.impl
;
import
com.viettel.campaign.service.CampaignCompleteCodeService
;
import
com.viettel.campaign.utils.Constants
;
import
com.viettel.campaign.utils.Constants
;
import
com.viettel.campaign.web.dto.CampaignCompleteCodeDTO
;
import
com.viettel.campaign.web.dto.CampaignCompleteCodeDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
...
...
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
View file @
f6139454
This diff is collapsed.
Click to expand it.
src/main/java/com/viettel/campaign/utils/SQLBuilder.java
View file @
f6139454
...
@@ -17,7 +17,6 @@ import org.springframework.data.domain.Sort;
...
@@ -17,7 +17,6 @@ import org.springframework.data.domain.Sort;
public
class
SQLBuilder
{
public
class
SQLBuilder
{
public
static
final
String
SQL_MODULE_CAMPAIGN_MNG
=
"campaign-mng"
;
public
static
final
String
SQL_MODULE_CAMPAIGN_MNG
=
"campaign-mng"
;
public
static
final
String
SQL_MODULE_CAMPAIGN_STATUS_MNG
=
"campaign-status-mng"
;
public
static
final
String
SQL_MODULE_CAMPAIGN_STATUS_MNG
=
"campaign-status-mng"
;
public
static
final
String
SQL_MODULE_CAMPAIGN_CUSTOMER
=
"campaign-customer"
;
public
static
String
getSqlQueryById
(
String
module
,
public
static
String
getSqlQueryById
(
String
module
,
String
queryId
)
{
String
queryId
)
{
...
...
src/main/java/com/viettel/campaign/web/dto/CampaignDTO.java
View file @
f6139454
...
@@ -63,5 +63,5 @@ public class CampaignDTO extends BaseDTO {
...
@@ -63,5 +63,5 @@ public class CampaignDTO extends BaseDTO {
private
String
timeZoneMinute
;
private
String
timeZoneMinute
;
private
List
<
TimeRangeDialModeDTO
>
lstTimeRange
;
private
List
<
TimeRangeDialModeDTO
>
lstTimeRange
;
private
List
<
TimeZoneDialModeDTO
>
lstTimeZone
;
private
List
<
TimeZoneDialModeDTO
>
lstTimeZone
;
private
Short
agentStatus
;
}
}
src/main/java/com/viettel/campaign/web/dto/CustomerContactDTO.java
0 → 100644
View file @
f6139454
package
com.viettel.campaign.web.dto
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.Date
;
@Getter
@Setter
public
class
CustomerContactDTO
{
private
Long
contactId
;
private
Long
customerId
;
private
Short
contactType
;
private
String
contact
;
private
Short
isDirectLine
;
private
Short
status
;
private
Date
createDate
;
private
Date
updateDate
;
private
String
createBy
;
private
String
updateBy
;
private
Date
startDate
;
private
Date
endDate
;
}
src/main/java/com/viettel/campaign/web/dto/request_dto/CampaignCustomerRequestDTO.java
0 → 100644
View file @
f6139454
package
com.viettel.campaign.web.dto.request_dto
;
import
com.viettel.campaign.web.dto.BaseDTO
;
import
lombok.Getter
;
import
lombok.Setter
;
@Getter
@Setter
public
class
CampaignCustomerRequestDTO
extends
BaseDTO
{
String
customerListCode
;
String
customerListName
;
String
convertedDateFrom
;
String
convertedDateTo
;
String
companySiteId
;
}
src/main/java/com/viettel/campaign/web/dto/request_dto/DeleteCustomerRequestDTO.java
0 → 100644
View file @
f6139454
package
com.viettel.campaign.web.dto.request_dto
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.List
;
@Getter
@Setter
public
class
DeleteCustomerRequestDTO
{
Long
customerId
;
Long
customerListId
;
List
<
Long
>
customerIds
;
}
src/main/java/com/viettel/campaign/web/rest/controller/CustomerController.java
View file @
f6139454
...
@@ -4,6 +4,8 @@ import com.viettel.campaign.web.dto.CustomerDTO;
...
@@ -4,6 +4,8 @@ import com.viettel.campaign.web.dto.CustomerDTO;
import
com.viettel.campaign.web.dto.CustomerListDTO
;
import
com.viettel.campaign.web.dto.CustomerListDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.service.CustomerService
;
import
com.viettel.campaign.service.CustomerService
;
import
com.viettel.campaign.web.dto.request_dto.CampaignCustomerRequestDTO
;
import
com.viettel.campaign.web.dto.request_dto.DeleteCustomerRequestDTO
;
import
org.apache.log4j.Logger
;
import
org.apache.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
...
@@ -12,7 +14,6 @@ import org.springframework.stereotype.Controller;
...
@@ -12,7 +14,6 @@ import org.springframework.stereotype.Controller;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -33,6 +34,13 @@ public class CustomerController {
...
@@ -33,6 +34,13 @@ public class CustomerController {
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
}
@GetMapping
(
"/findCustomerId"
)
@ResponseBody
public
ResponseEntity
<
ResultDTO
>
findAllCustomerName
(
@RequestParam
(
"customerId"
)
Long
customerId
)
{
ResultDTO
result
=
customerService
.
getCustomerId
(
customerId
);
return
new
ResponseEntity
(
result
,
HttpStatus
.
OK
);
}
@GetMapping
(
"/findCustomerByName"
)
@GetMapping
(
"/findCustomerByName"
)
@ResponseBody
@ResponseBody
public
ResponseEntity
findAllCustomerName
(
@RequestParam
(
"page"
)
int
page
,
@RequestParam
(
"pageSize"
)
int
pageSize
,
@RequestParam
(
"sort"
)
String
sort
,
@RequestParam
(
"name"
)
String
name
)
{
public
ResponseEntity
findAllCustomerName
(
@RequestParam
(
"page"
)
int
page
,
@RequestParam
(
"pageSize"
)
int
pageSize
,
@RequestParam
(
"sort"
)
String
sort
,
@RequestParam
(
"name"
)
String
name
)
{
...
@@ -61,17 +69,17 @@ public class CustomerController {
...
@@ -61,17 +69,17 @@ public class CustomerController {
@PostMapping
(
"/delete"
)
@PostMapping
(
"/delete"
)
@ResponseBody
@ResponseBody
public
ResultDTO
deleteCustomer
(
@RequestBody
@Valid
CustomerDTO
customer
DTO
)
{
public
ResultDTO
deleteCustomer
(
@RequestBody
@Valid
DeleteCustomerRequestDTO
deleteCustomerRequest
DTO
)
{
ResultDTO
result
=
new
ResultDTO
();
ResultDTO
result
=
new
ResultDTO
();
result
=
customerService
.
deleteCustomer
(
customer
DTO
);
result
=
customerService
.
deleteCustomer
(
deleteCustomerRequest
DTO
);
return
result
;
return
result
;
}
}
@PostMapping
(
"/deleteIds"
)
@PostMapping
(
"/deleteIds"
)
@ResponseBody
@ResponseBody
public
ResultDTO
deleteIds
(
@RequestBody
@Valid
List
<
Long
>
ids
)
{
public
ResultDTO
deleteIds
(
@RequestBody
@Valid
DeleteCustomerRequestDTO
deleteCustomerRequestDTO
)
{
ResultDTO
result
=
new
ResultDTO
();
ResultDTO
result
=
new
ResultDTO
();
result
=
customerService
.
deleteIds
(
ids
);
result
=
customerService
.
deleteIds
(
deleteCustomerRequestDTO
);
return
result
;
return
result
;
}
}
...
@@ -140,10 +148,16 @@ public class CustomerController {
...
@@ -140,10 +148,16 @@ public class CustomerController {
return
result
;
return
result
;
}
}
@GetMapping
(
"/searchCustomerList"
)
@RequestMapping
(
value
=
"/searchCustomerList"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
ResponseEntity
searchCustomerList
(
@RequestBody
CampaignCustomerRequestDTO
campaignCustomerRequestDTO
)
{
public
ResponseEntity
searchCustomerList
(
@RequestParam
(
"customerListCode"
)
String
customerListCode
,
@RequestParam
(
"customerListName"
)
String
customerListName
,
@RequestParam
(
"dateFrom"
)
Date
dateFrom
,
@RequestParam
(
"dateTo"
)
Date
dateTo
,
@RequestParam
(
"page"
)
int
page
,
@RequestParam
(
"pageSize"
)
int
pageSize
,
@RequestParam
(
"sort"
)
String
sort
)
{
ResultDTO
result
=
customerService
.
searchCustomerList
(
campaignCustomerRequestDTO
);
ResultDTO
result
=
customerService
.
searchCustomerList
(
customerListCode
,
customerListName
,
dateFrom
,
dateTo
,
page
,
pageSize
,
sort
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
}
@GetMapping
(
"/findCustomerContact"
)
@ResponseBody
public
ResponseEntity
<
ResultDTO
>
findAllCustomerContact
(
@RequestParam
(
"customerId"
)
Long
customerId
,
@RequestParam
(
"contactType"
)
Short
contactType
,
@RequestParam
(
"contact"
)
String
contact
)
{
ResultDTO
result
=
customerService
.
getCustomerContact
(
customerId
,
contactType
,
contact
);
return
new
ResponseEntity
(
result
,
HttpStatus
.
OK
);
}
}
}
src/main/resources/sql/campaign-mng/search-campaign-customer-by-params.sql
View file @
f6139454
SELECT
SELECT
CUSTOMER_LIST_ID
,
CUSTOMER_LIST_ID
customerListId
,
COMPANY_SITE_ID
,
COMPANY_SITE_ID
companySiteId
,
CUSTOMER_LIST_CODE
,
CUSTOMER_LIST_CODE
customerListCode
,
CUSTOMER_LIST_NAME
,
CUSTOMER_LIST_NAME
customerListName
,
STATUS
,
STATUS
status
,
CREATE_BY
,
CREATE_BY
createBy
,
CREATE_AT
,
CREATE_AT
createAt
,
UPDATE_BY
,
UPDATE_BY
updateBy
,
UPDATE_AT
,
UPDATE_AT
updateAt
,
SOURCE
,
SOURCE
source
,
DEPT_CREATE
DEPT_CREATE
deptCreate
FROM
CUSTOMER_LIST
FROM
CUSTOMER_LIST
WHERE
1
=
1
WHERE
1
=
1
AND
CREATE_AT
BETWEEN
:
p_date_from
AND
:
p_date_to
AND
CREATE_AT
BETWEEN
:
p_date_from
AND
:
p_date_to
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment