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
2dd144f3
Commit
2dd144f3
authored
Sep 12, 2019
by
Phạm Duy Phi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
phipd commit
parent
8740b74e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
17 deletions
+37
-17
src/main/java/com/viettel/campaign/repository/ccms_full/CustomerListRepository.java
...campaign/repository/ccms_full/CustomerListRepository.java
+3
-0
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
...om/viettel/campaign/service/impl/CustomerServiceImpl.java
+32
-17
src/main/java/com/viettel/campaign/utils/Constants.java
src/main/java/com/viettel/campaign/utils/Constants.java
+2
-0
No files found.
src/main/java/com/viettel/campaign/repository/ccms_full/CustomerListRepository.java
View file @
2dd144f3
...
@@ -14,6 +14,9 @@ public interface CustomerListRepository extends JpaRepository<CustomerList, Long
...
@@ -14,6 +14,9 @@ public interface CustomerListRepository extends JpaRepository<CustomerList, Long
CustomerList
findByCustomerListCode
(
String
customerListCode
);
CustomerList
findByCustomerListCode
(
String
customerListCode
);
@Query
(
"select c from CustomerList c where c.customerListId in (:p_ids) and c.companySiteId=:p_company_site_id and c.status = 1"
)
List
<
CustomerList
>
findAllCustomerList
(
@Param
(
"p_ids"
)
List
<
Long
>
p_ids
,
@Param
(
"p_company_site_id"
)
Long
p_company_site_id
);
@Modifying
@Modifying
@Query
(
"update CustomerList c set c.status = 0 where c.customerListId=:p_customer_list_id and c.companySiteId=:p_company_site_id"
)
@Query
(
"update CustomerList c set c.status = 0 where c.customerListId=:p_customer_list_id and c.companySiteId=:p_company_site_id"
)
int
deleteCustomerList
(
@Param
(
"p_customer_list_id"
)
Long
p_customer_list_id
,
@Param
(
"p_company_site_id"
)
Long
p_company_site_id
);
int
deleteCustomerList
(
@Param
(
"p_customer_list_id"
)
Long
p_customer_list_id
,
@Param
(
"p_company_site_id"
)
Long
p_company_site_id
);
...
...
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
View file @
2dd144f3
...
@@ -393,10 +393,9 @@ public class CustomerServiceImpl implements CustomerService {
...
@@ -393,10 +393,9 @@ public class CustomerServiceImpl implements CustomerService {
public
ResultDTO
deleteCustomer
(
CustomerRequestDTO
customerRequestDTO
)
{
public
ResultDTO
deleteCustomer
(
CustomerRequestDTO
customerRequestDTO
)
{
ResultDTO
resultDTO
=
new
ResultDTO
();
ResultDTO
resultDTO
=
new
ResultDTO
();
List
<
Long
>
listId
=
new
ArrayList
<>();
List
<
Long
>
listId
=
new
ArrayList
<>();
listId
.
add
(
customerRequestDTO
.
getCustomerId
());
try
{
try
{
if
(
customerRequestDTO
!=
null
)
{
if
(
customerRequestDTO
!=
null
)
{
listId
.
add
(
customerRequestDTO
.
getCustomerId
());
if
(
customerListMappingRepository
.
findAllCustomerListMapping
(
listId
,
customerRequestDTO
.
getCustomerListId
(),
customerRequestDTO
.
getCompanySiteId
()).
size
()
>
0
)
{
if
(
customerListMappingRepository
.
findAllCustomerListMapping
(
listId
,
customerRequestDTO
.
getCustomerListId
(),
customerRequestDTO
.
getCompanySiteId
()).
size
()
>
0
)
{
// delete
// delete
// customerRepository.deleteById(customerDTO.getCustomerId());
// customerRepository.deleteById(customerDTO.getCustomerId());
...
@@ -405,8 +404,8 @@ public class CustomerServiceImpl implements CustomerService {
...
@@ -405,8 +404,8 @@ public class CustomerServiceImpl implements CustomerService {
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
}
else
{
}
else
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
DELETE_
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
DELETE_
ERROR
);
}
}
}
else
{
}
else
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
...
@@ -425,10 +424,15 @@ public class CustomerServiceImpl implements CustomerService {
...
@@ -425,10 +424,15 @@ public class CustomerServiceImpl implements CustomerService {
ResultDTO
resultDTO
=
new
ResultDTO
();
ResultDTO
resultDTO
=
new
ResultDTO
();
try
{
try
{
if
(
customerRequestDTO
!=
null
)
{
if
(
customerRequestDTO
!=
null
)
{
// customerRepository.deleteIds(ids);
if
(
customerListMappingRepository
.
findAllCustomerListMapping
(
customerRequestDTO
.
getIds
(),
customerRequestDTO
.
getCustomerListId
(),
customerRequestDTO
.
getCompanySiteId
()).
size
()
>
0
)
{
customerListMappingRepository
.
deleteMappingByCustomerIds
(
customerRequestDTO
.
getIds
(),
customerRequestDTO
.
getCustomerListId
(),
customerRequestDTO
.
getCompanySiteId
());
//customerRepository.deleteIds(ids);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
customerListMappingRepository
.
deleteMappingByCustomerIds
(
customerRequestDTO
.
getIds
(),
customerRequestDTO
.
getCustomerListId
(),
customerRequestDTO
.
getCompanySiteId
());
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
}
else
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
DELETE_ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
DELETE_ERROR
);
}
}
else
{
}
else
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
...
@@ -721,17 +725,23 @@ public class CustomerServiceImpl implements CustomerService {
...
@@ -721,17 +725,23 @@ public class CustomerServiceImpl implements CustomerService {
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
deleteCustomerList
(
CustomerListDTO
customerListDTO
)
{
public
ResultDTO
deleteCustomerList
(
CustomerListDTO
customerListDTO
)
{
ResultDTO
resultDTO
=
new
ResultDTO
();
ResultDTO
resultDTO
=
new
ResultDTO
();
List
<
Long
>
ids
=
new
ArrayList
<>();
ids
.
add
(
customerListDTO
.
getCustomerListId
());
try
{
try
{
// delete
// delete
if
(
DataUtil
.
isNullOrZero
(
campaignCustomerListRepository
.
campaignCount
(
customerListDTO
.
getCustomerListId
())))
{
if
(
DataUtil
.
isNullOrZero
(
campaignCustomerListRepository
.
campaignCount
(
customerListDTO
.
getCustomerListId
())))
{
customerListRepository
.
deleteCustomerList
(
customerListDTO
.
getCustomerListId
(),
customerListDTO
.
getCompanySiteId
());
if
(
customerListRepository
.
findAllCustomerList
(
ids
,
customerListDTO
.
getCompanySiteId
()).
size
()
>
0
)
{
customerListRepository
.
deleteCustomerList
(
customerListDTO
.
getCustomerListId
(),
customerListDTO
.
getCompanySiteId
());
customerListMappingRepository
.
deleteMappingByCustomerListId
(
customerListDTO
.
getCustomerListId
(),
customerListDTO
.
getCompanySiteId
());
customerListMappingRepository
.
deleteMappingByCustomerListId
(
customerListDTO
.
getCustomerListId
(),
customerListDTO
.
getCompanySiteId
());
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
}
else
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
DELETE_ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
DELETE_ERROR
);
}
}
else
{
}
else
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
...
@@ -751,12 +761,17 @@ public class CustomerServiceImpl implements CustomerService {
...
@@ -751,12 +761,17 @@ public class CustomerServiceImpl implements CustomerService {
try
{
try
{
if
(
customerRequestDTO
!=
null
)
{
if
(
customerRequestDTO
!=
null
)
{
if
(
DataUtil
.
isNullOrZero
(
campaignCustomerListRepository
.
campaignIdsCount
(
customerRequestDTO
.
getIds
())))
{
if
(
DataUtil
.
isNullOrZero
(
campaignCustomerListRepository
.
campaignIdsCount
(
customerRequestDTO
.
getIds
())))
{
customerListRepository
.
deleteCustomerListIds
(
customerRequestDTO
.
getIds
(),
customerRequestDTO
.
getCompanySiteId
());
if
(
customerListRepository
.
findAllCustomerList
(
customerRequestDTO
.
getIds
(),
customerRequestDTO
.
getCompanySiteId
()).
size
()
>
0
)
{
customerListRepository
.
deleteCustomerListIds
(
customerRequestDTO
.
getIds
(),
customerRequestDTO
.
getCompanySiteId
());
customerListMappingRepository
.
deleteMappingByCustomerListIds
(
customerRequestDTO
.
getIds
(),
customerRequestDTO
.
getCompanySiteId
());
customerListMappingRepository
.
deleteMappingByCustomerListIds
(
customerRequestDTO
.
getIds
(),
customerRequestDTO
.
getCompanySiteId
());
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
}
else
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
DELETE_ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
DELETE_ERROR
);
}
}
else
{
}
else
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
...
...
src/main/java/com/viettel/campaign/utils/Constants.java
View file @
2dd144f3
...
@@ -7,10 +7,12 @@ public class Constants {
...
@@ -7,10 +7,12 @@ public class Constants {
public
interface
ApiErrorCode
{
public
interface
ApiErrorCode
{
String
ERROR
=
"01"
;
String
ERROR
=
"01"
;
String
SUCCESS
=
"00"
;
String
SUCCESS
=
"00"
;
String
DELETE_ERROR
=
"02"
;
}
}
public
interface
ApiErrorDesc
{
public
interface
ApiErrorDesc
{
String
ERROR
=
"ERROR"
;
String
ERROR
=
"ERROR"
;
String
SUCCESS
=
"SUCCESS"
;
String
SUCCESS
=
"SUCCESS"
;
String
DELETE_ERROR
=
"DELETE_ERROR"
;
}
}
public
interface
FileType
{
public
interface
FileType
{
String
pdf
=
"pdf"
;
String
pdf
=
"pdf"
;
...
...
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