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
00b43f0b
Commit
00b43f0b
authored
5 years ago
by
Phạm Duy Phi
Browse files
Options
Browse Files
Download
Plain Diff
phipd commit
parents
e32be465
34ea2d6c
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
168 additions
and
217 deletions
+168
-217
campaign.iml
campaign.iml
+0
-196
lib/ojdbc6-11.2.0.3.jar
lib/ojdbc6-11.2.0.3.jar
+0
-0
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/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
+10
-0
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
...om/viettel/campaign/service/impl/CustomerServiceImpl.java
+41
-4
src/main/java/com/viettel/campaign/web/dto/CampaignDTO.java
src/main/java/com/viettel/campaign/web/dto/CampaignDTO.java
+1
-2
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/rest/controller/CustomerController.java
...ttel/campaign/web/rest/controller/CustomerController.java
+14
-0
No files found.
campaign.iml
View file @
00b43f0b
This diff is collapsed.
Click to expand it.
lib/ojdbc6-11.2.0.3.jar
0 → 100644
View file @
00b43f0b
File added
This diff is collapsed.
Click to expand it.
src/main/java/com/viettel/campaign/model/CustomerContact.java
0 → 100644
View file @
00b43f0b
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
;
}
This diff is collapsed.
Click to expand it.
src/main/java/com/viettel/campaign/repository/CustomerContactRepository.java
0 → 100644
View file @
00b43f0b
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
);
}
This diff is collapsed.
Click to expand it.
src/main/java/com/viettel/campaign/repository/CustomerRepository.java
View file @
00b43f0b
...
...
@@ -16,6 +16,8 @@ public interface CustomerRepository extends JpaRepository<Customer, Long> {
Page
<
Customer
>
findAll
(
Pageable
pageable
);
List
<
Customer
>
findByCustomerId
(
Long
customerId
);
@Query
(
"FROM Customer WHERE name = ?1"
)
List
<
Customer
>
findByName
(
String
firstName
,
Pageable
pageable
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/viettel/campaign/repository/impl/CampaignRepositoryImpl.java
View file @
00b43f0b
...
...
@@ -21,6 +21,7 @@ import org.springframework.stereotype.Repository;
import
javax.persistence.EntityManager
;
import
javax.persistence.Query
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -37,18 +38,17 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
ResultDTO
result
=
new
ResultDTO
();
List
<
CampaignDTO
>
lst
=
new
ArrayList
<>();
StringBuilder
expression
=
new
StringBuilder
()
.
append
(
" SELECT C.CAMPAIGN_CODE, C.CAMPAIGN_NAME, C.CONTENT, C.START_TIME, C.END_TIME, C.STATUS "
)
.
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
(
" WHERE 1 = 1 "
)
.
append
(
" WHERE 1 = 1 "
)
;
//.append(" AND CA.AGENT_ID = :pAgentId ")
.
append
(
" AND C.STATUS IN (2,3) "
);
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
()))
{
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
()))
{
...
...
@@ -88,40 +88,45 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getCampaignCode
()))
{
String
[]
lstCode
=
campaignRequestDto
.
getCampaignCode
().
split
(
","
);
query
.
setParameter
(
"
:pCampaingId
"
,
lstCode
);
query
.
setParameter
(
"
pCampaignCode
"
,
lstCode
);
}
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
(
campaignRequestDto
.
getStatus
()
!=
0
)
query
.
setParameter
(
"
:
pStatus"
,
campaignRequestDto
.
getStatus
());
query
.
setParameter
(
"pStatus"
,
campaignRequestDto
.
getStatus
());
}
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getFromDateFr
()))
{
query
.
setParameter
(
"
:
pStartTimeFr"
,
campaignRequestDto
.
getFromDateFr
());
query
.
setParameter
(
"pStartTimeFr"
,
campaignRequestDto
.
getFromDateFr
());
}
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getFromDateTo
()))
{
query
.
setParameter
(
"
:
pStartTimeTo"
,
campaignRequestDto
.
getFromDateTo
());
query
.
setParameter
(
"pStartTimeTo"
,
campaignRequestDto
.
getFromDateTo
());
}
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getToDateFr
()))
{
query
.
setParameter
(
"
:
pEndTimeFr"
,
campaignRequestDto
.
getToDateFr
());
query
.
setParameter
(
"pEndTimeFr"
,
campaignRequestDto
.
getToDateFr
());
}
if
(!
DataUtil
.
isNullOrEmpty
(
campaignRequestDto
.
getToDateTo
()))
{
query
.
setParameter
(
"
:
pEndTimeTo"
,
campaignRequestDto
.
getToDateTo
());
query
.
setParameter
(
"pEndTimeTo"
,
campaignRequestDto
.
getToDateTo
());
}
if
(!
DataUtil
.
isNullOrZero
(
campaignRequestDto
.
getNumOfCusFr
()))
{
query
.
setParameter
(
"
:
pCustNumFr"
,
campaignRequestDto
.
getNumOfCusFr
());
query
.
setParameter
(
"pCustNumFr"
,
campaignRequestDto
.
getNumOfCusFr
());
}
if
(!
DataUtil
.
isNullOrZero
(
campaignRequestDto
.
getNumOfCusTo
()))
{
query
.
setParameter
(
"
:
pCustNumTo"
,
campaignRequestDto
.
getNumOfCusTo
());
query
.
setParameter
(
"pCustNumTo"
,
campaignRequestDto
.
getNumOfCusTo
());
}
result
.
setTotalRow
(
query
.
getResultList
().
size
());
...
...
@@ -144,7 +149,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
item
.
setContent
((
String
)
obj
[
2
]);
item
.
setStartTime
((
Date
)
obj
[
3
]);
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
);
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/viettel/campaign/service/CustomerService.java
View file @
00b43f0b
...
...
@@ -12,6 +12,8 @@ public interface CustomerService {
ResultDTO
listAllCustomer
(
int
page
,
int
pageSize
,
String
sort
,
long
customerListId
,
long
companySiteId
);
ResultDTO
getCustomerId
(
Long
customerId
);
Map
listCustByName
(
int
page
,
int
pageSize
,
String
sort
,
String
name
);
ResultDTO
createCustomer
(
CustomerDTO
customerDTO
);
...
...
@@ -32,5 +34,13 @@ public interface CustomerService {
ResultDTO
deleteCustomerListIds
(
CustomerRequestDTO
customerRequestDTO
);
<<<<<<<
HEAD
ResultDTO
searchCustomerList
(
SearchCustomerRequestDTO
searchCustomerRequestDTO
);
=======
ResultDTO
searchCustomerList
(
CampaignCustomerRequestDTO
campaignCustomerRequestDTO
);
// ------------ customer contact ------------ //
ResultDTO
getCustomerContact
(
Long
customerId
,
Short
contactType
,
String
contact
);
>>>>>>>
34
ea2d6ca2abb80539da3dd29437f08fed559e93
}
This diff is collapsed.
Click to expand it.
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
View file @
00b43f0b
package
com.viettel.campaign.service.impl
;
import
com.viettel.campaign.mapper.CustomerListMapper
;
import
com.viettel.campaign.model.CustomerContact
;
import
com.viettel.campaign.model.CustomerList
;
import
com.viettel.campaign.repository.CampaignCustomerListRepository
;
import
com.viettel.campaign.repository.CustomerListMappingRepository
;
import
com.viettel.campaign.repository.CustomerListRepository
;
import
com.viettel.campaign.repository.*
;
import
com.viettel.campaign.service.CustomerService
;
import
com.viettel.campaign.utils.Constants
;
import
com.viettel.campaign.utils.HibernateUtil
;
...
...
@@ -15,7 +14,6 @@ import com.viettel.campaign.web.dto.CustomerListDTO;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.mapper.CustomerMapper
;
import
com.viettel.campaign.model.Customer
;
import
com.viettel.campaign.repository.CustomerRepository
;
import
com.viettel.campaign.utils.DataUtil
;
import
com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO
;
import
com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO
;
...
...
@@ -48,6 +46,9 @@ public class CustomerServiceImpl implements CustomerService {
@Autowired
CustomerListRepository
customerListRepository
;
@Autowired
CustomerContactRepository
customerContactRepository
;
@Autowired
CampaignCustomerListRepository
campaignCustomerListRepository
;
...
...
@@ -127,6 +128,24 @@ public class CustomerServiceImpl implements CustomerService {
return
resultDTO
;
}
@Override
public
ResultDTO
getCustomerId
(
Long
customerId
)
{
ResultDTO
resultDTO
=
new
ResultDTO
();
List
<
Customer
>
customer
=
customerRepository
.
findByCustomerId
(
customerId
);
if
(
customer
!=
null
)
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
"customer data"
);
resultDTO
.
setListData
(
customer
);
}
else
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
"customer data null"
);
}
return
resultDTO
;
}
@Override
public
Map
listCustByName
(
int
page
,
int
pageSize
,
String
sort
,
String
name
)
{
Map
result
=
new
HashMap
();
...
...
@@ -451,4 +470,22 @@ public class CustomerServiceImpl implements CustomerService {
return
resultDTO
;
}
@Override
public
ResultDTO
getCustomerContact
(
Long
customerId
,
Short
contactType
,
String
contact
)
{
ResultDTO
result
=
new
ResultDTO
();
List
<
CustomerContact
>
customer
=
customerContactRepository
.
findByCustomerIdAndAndContactTypeAndContact
(
customerId
,
contactType
,
contact
);
if
(
customer
!=
null
)
{
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
result
.
setDescription
(
"customer contact data"
);
result
.
setListData
(
customer
);
}
else
{
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
result
.
setDescription
(
"customer contact data null"
);
}
return
result
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/viettel/campaign/web/dto/CampaignDTO.java
View file @
00b43f0b
...
...
@@ -57,6 +57,5 @@ public class CampaignDTO extends BaseDTO {
private
Long
numOfNotJoinedCus
;
private
Long
numOfLockCus
;
private
String
campaignTypeName
;
private
Short
agentStatus
;
}
This diff is collapsed.
Click to expand it.
src/main/java/com/viettel/campaign/web/dto/CustomerContactDTO.java
0 → 100644
View file @
00b43f0b
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
;
}
This diff is collapsed.
Click to expand it.
src/main/java/com/viettel/campaign/web/rest/controller/CustomerController.java
View file @
00b43f0b
...
...
@@ -33,6 +33,13 @@ public class CustomerController {
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"
)
@ResponseBody
public
ResponseEntity
findAllCustomerName
(
@RequestParam
(
"page"
)
int
page
,
@RequestParam
(
"pageSize"
)
int
pageSize
,
@RequestParam
(
"sort"
)
String
sort
,
@RequestParam
(
"name"
)
String
name
)
{
...
...
@@ -145,4 +152,11 @@ public class CustomerController {
ResultDTO
result
=
customerService
.
searchCustomerList
(
searchCustomerRequestDTO
);
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
);
}
}
This diff is collapsed.
Click to expand it.
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