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
2cbe3756
Commit
2cbe3756
authored
Aug 09, 2019
by
Phạm Duy Phi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
phipd commit: commit
parent
373e6d79
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
4 deletions
+53
-4
src/main/java/com/viettel/campaign/repository/CustomerListRepository.java
...m/viettel/campaign/repository/CustomerListRepository.java
+3
-0
src/main/java/com/viettel/campaign/service/CustomerService.java
...in/java/com/viettel/campaign/service/CustomerService.java
+3
-0
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
...om/viettel/campaign/service/impl/CustomerServiceImpl.java
+38
-3
src/main/java/com/viettel/campaign/web/rest/controller/CustomerController.java
...ttel/campaign/web/rest/controller/CustomerController.java
+8
-1
src/main/resources/sql/campaign-mng/search-campaign-customer-by-params.sql
...s/sql/campaign-mng/search-campaign-customer-by-params.sql
+1
-0
No files found.
src/main/java/com/viettel/campaign/repository/CustomerListRepository.java
View file @
2cbe3756
...
...
@@ -21,4 +21,7 @@ public interface CustomerListRepository extends JpaRepository<CustomerList, Long
@Modifying
@Query
(
"update CustomerList c set c.status = 0 where c.customerListId in (:p_ids) and c.companySiteId=:p_company_site_id"
)
int
deleteCustomerListIds
(
@Param
(
"p_ids"
)
List
<
Long
>
p_ids
,
@Param
(
"p_company_site_id"
)
Long
p_company_site_id
);
@Query
(
value
=
"SELECT * FROM (SELECT *, MAX(CREATE_AT) OVER() AS LATEST_CREATED FROM CUSTOMER_LIST) WHERE CREATE_AT = LATEST_CREATED"
,
nativeQuery
=
true
)
CustomerList
latestCreated
();
}
src/main/java/com/viettel/campaign/service/CustomerService.java
View file @
2cbe3756
package
com.viettel.campaign.service
;
import
com.viettel.campaign.model.CustomerList
;
import
com.viettel.campaign.web.dto.CustomerDTO
;
import
com.viettel.campaign.web.dto.CustomerListDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
...
...
@@ -34,6 +35,8 @@ public interface CustomerService {
ResultDTO
searchCustomerList
(
SearchCustomerRequestDTO
searchCustomerRequestDTO
);
CustomerList
getLatestCreated
();
// ------------ customer contact ------------ //
ResultDTO
getCustomerContact
(
Long
customerId
,
Short
contactType
,
String
contact
);
...
...
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
View file @
2cbe3756
...
...
@@ -156,9 +156,15 @@ public class CustomerServiceImpl implements CustomerService {
StringBuilder
sqlStrBuilder
=
new
StringBuilder
();
sqlStrBuilder
.
append
(
SQLBuilder
.
getSqlQueryById
(
SQLBuilder
.
SQL_MODULE_CAMPAIGN_MNG
,
"campaign-customer-detail-by-params"
));
sqlStrBuilder
.
append
(
" AND "
);
sqlStrBuilder
.
append
(
" ORDER BY name DESC"
);
sqlStrBuilder
.
append
(
" ORDER BY name DESC"
);
if
(!
DataUtil
.
isNullOrEmpty
(
name
))
{
sqlStrBuilder
.
append
(
" AND b.NAME LIKE :p_name"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
mobileNumber
))
{
sqlStrBuilder
.
append
(
" AND c.MOBILE LIKE :p_mobile_number"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
email
))
{
sqlStrBuilder
.
append
(
" AND d.EMAIL LIKE :p_email"
);
}
sqlStrBuilder
.
append
(
" ORDER BY name DESC"
);
SQLQuery
query
=
session
.
createSQLQuery
(
sqlStrBuilder
.
toString
());
...
...
@@ -166,6 +172,30 @@ public class CustomerServiceImpl implements CustomerService {
query
.
setParameter
(
"p_company_site_id"
,
companySiteId
);
query
.
setParameter
(
"p_customer_list_id"
,
customerListId
);
if
(!
DataUtil
.
isNullOrEmpty
(
name
))
{
query
.
setParameter
(
"p_name"
,
"%"
+
name
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
mobileNumber
))
{
query
.
setParameter
(
"p_mobile_number"
,
"%"
+
mobileNumber
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
email
))
{
query
.
setParameter
(
"p_email"
,
"%"
+
email
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
}
query
.
addScalar
(
"customerListMappingId"
,
new
LongType
());
query
.
addScalar
(
"companySiteId"
,
new
LongType
());
query
.
addScalar
(
"customerListId"
,
new
LongType
());
...
...
@@ -570,6 +600,11 @@ public class CustomerServiceImpl implements CustomerService {
return
resultDTO
;
}
@Override
public
CustomerList
getLatestCreated
()
{
return
customerListRepository
.
latestCreated
();
}
@Override
public
ResultDTO
getCustomerContact
(
Long
customerId
,
Short
contactType
,
String
contact
)
{
ResultDTO
result
=
new
ResultDTO
();
...
...
src/main/java/com/viettel/campaign/web/rest/controller/CustomerController.java
View file @
2cbe3756
...
...
@@ -25,7 +25,6 @@ import java.io.File;
import
java.nio.file.Files
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
@Controller
@RequestMapping
(
"/ipcc/customer"
)
...
...
@@ -164,6 +163,14 @@ public class CustomerController {
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
@GetMapping
(
"/latestCreated"
)
@ResponseBody
public
ResponseEntity
getLatestCreated
()
{
ResultDTO
result
=
new
ResultDTO
();
result
.
setData
(
customerService
.
getLatestCreated
());
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
)
{
...
...
src/main/resources/sql/campaign-mng/search-campaign-customer-by-params.sql
View file @
2cbe3756
...
...
@@ -12,4 +12,5 @@ SELECT
DEPT_CREATE
deptCreate
FROM
CUSTOMER_LIST
WHERE
1
=
1
AND
STATUS
=
1
AND
COMPANY_SITE_ID
=
:
p_company_site_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