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
03ae6a62
Commit
03ae6a62
authored
Aug 22, 2019
by
Vu Duy Anh
Browse files
Options
Browse Files
Download
Plain Diff
anhvd accept merge
parents
7571fdbd
bf5364c2
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
0 deletions
+62
-0
src/main/java/com/viettel/campaign/repository/ccms_full/CampaignCustomerListRepository.java
.../repository/ccms_full/CampaignCustomerListRepository.java
+2
-0
src/main/java/com/viettel/campaign/repository/ccms_full/CampaignCustomerRepository.java
...aign/repository/ccms_full/CampaignCustomerRepository.java
+16
-0
src/main/java/com/viettel/campaign/service/CampaignService.java
...in/java/com/viettel/campaign/service/CampaignService.java
+2
-0
src/main/java/com/viettel/campaign/service/impl/CampaignServiceImpl.java
...om/viettel/campaign/service/impl/CampaignServiceImpl.java
+35
-0
src/main/java/com/viettel/campaign/web/rest/CampaignController.java
...ava/com/viettel/campaign/web/rest/CampaignController.java
+7
-0
No files found.
src/main/java/com/viettel/campaign/repository/ccms_full/CampaignCustomerListRepository.java
View file @
03ae6a62
...
@@ -14,4 +14,6 @@ public interface CampaignCustomerListRepository extends JpaRepository<CampaignCu
...
@@ -14,4 +14,6 @@ public interface CampaignCustomerListRepository extends JpaRepository<CampaignCu
@Query
(
"select count (c.campaignId) from CampaignCustomerList c where c.customerListId in (:ids)"
)
@Query
(
"select count (c.campaignId) from CampaignCustomerList c where c.customerListId in (:ids)"
)
Long
campaignIdsCount
(
@Param
(
"ids"
)
List
<
Long
>
ids
);
Long
campaignIdsCount
(
@Param
(
"ids"
)
List
<
Long
>
ids
);
void
deleteCampaignCustomerListByCampaignIdAndCustomerListIdAndCompanySiteId
(
Long
campaignId
,
Long
customerListId
,
Long
companySiteId
);
}
}
src/main/java/com/viettel/campaign/repository/ccms_full/CampaignCustomerRepository.java
View file @
03ae6a62
...
@@ -35,4 +35,20 @@ public interface CampaignCustomerRepository extends JpaRepository<CampaignCustom
...
@@ -35,4 +35,20 @@ public interface CampaignCustomerRepository extends JpaRepository<CampaignCustom
Long
getCustomerRecall
(
@Param
(
"campaignId"
)
Long
campaignId
,
@Param
(
"customerId"
)
Long
customerId
);
Long
getCustomerRecall
(
@Param
(
"campaignId"
)
Long
campaignId
,
@Param
(
"customerId"
)
Long
customerId
);
CampaignCustomer
findCampaignCustomerByCampaignCustomerId
(
Long
id
);
CampaignCustomer
findCampaignCustomerByCampaignCustomerId
(
Long
id
);
@Query
(
value
=
"SELECT * FROM CAMPAIGN_CUSTOMER CC "
+
"WHERE CC.STATUS = 0 "
+
"AND CC.CAMPAIGN_ID = :campaignId "
+
"AND CC.COMPANY_SITE_ID = :companySiteId "
+
"AND CC.CUSTOMER_LIST_ID = :customerListId"
,
nativeQuery
=
true
)
List
<
CampaignCustomer
>
findCustomerNoContact
(
@Param
(
"campaignId"
)
Long
campaignId
,
@Param
(
"companySiteId"
)
Long
companySiteId
,
@Param
(
"customerListId"
)
Long
customerListId
);
@Query
(
value
=
"SELECT * FROM CAMPAIGN_CUSTOMER CC "
+
"WHERE CC.STATUS IN (SELECT COMPLETE_VALUE from CAMPAIGN_COMPLETE_CODE where STATUS = 1 and IS_FINISH = 0 and IS_RECALL = 0)"
+
"AND CC.CAMPAIGN_ID = :campaignId "
+
"AND CC.COMPANY_SITE_ID = :companySiteId "
+
"AND CC.CUSTOMER_LIST_ID = :customerListId"
,
nativeQuery
=
true
)
List
<
CampaignCustomer
>
findCustomerContacted
(
@Param
(
"campaignId"
)
Long
campaignId
,
@Param
(
"companySiteId"
)
Long
companySiteId
,
@Param
(
"customerListId"
)
Long
customerListId
);
}
}
src/main/java/com/viettel/campaign/service/CampaignService.java
View file @
03ae6a62
...
@@ -62,6 +62,8 @@ public interface CampaignService {
...
@@ -62,6 +62,8 @@ public interface CampaignService {
ResultDTO
getCustomerChoosenList
(
CampaignRequestDTO
dto
);
ResultDTO
getCustomerChoosenList
(
CampaignRequestDTO
dto
);
ResultDTO
addCustomerListToCampaign
(
CampaignRequestDTO
dto
);
ResultDTO
addCustomerListToCampaign
(
CampaignRequestDTO
dto
);
ResultDTO
deleteCustomerListFromCampaign
(
CampaignRequestDTO
dto
);
//</editor-fold>
//</editor-fold>
}
}
src/main/java/com/viettel/campaign/service/impl/CampaignServiceImpl.java
View file @
03ae6a62
...
@@ -64,6 +64,9 @@ public class CampaignServiceImpl implements CampaignService {
...
@@ -64,6 +64,9 @@ public class CampaignServiceImpl implements CampaignService {
@Autowired
@Autowired
CampaignCustomerListRepository
campaignCustomerListRepository
;
CampaignCustomerListRepository
campaignCustomerListRepository
;
@Autowired
CampaignCustomerRepository
campaignCustomerRepository
;
@Override
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
search
(
CampaignRequestDTO
requestDto
)
{
public
ResultDTO
search
(
CampaignRequestDTO
requestDto
)
{
...
@@ -526,6 +529,38 @@ public class CampaignServiceImpl implements CampaignService {
...
@@ -526,6 +529,38 @@ public class CampaignServiceImpl implements CampaignService {
return
resultDTO
;
return
resultDTO
;
}
}
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
deleteCustomerListFromCampaign
(
CampaignRequestDTO
dto
)
{
ResultDTO
resultDTO
=
new
ResultDTO
();
String
[]
lstCusListId
=
dto
.
getLstCustomerListId
().
split
(
","
);
long
campaignId
=
Long
.
parseLong
(
dto
.
getCampaignId
());
long
companySiteId
=
Long
.
parseLong
(
dto
.
getCompanySiteId
());
try
{
for
(
String
cusListId
:
lstCusListId
)
{
// Xoa danh sach khach hang khoi campaign_customerList
campaignCustomerListRepository
.
deleteCampaignCustomerListByCampaignIdAndCustomerListIdAndCompanySiteId
(
campaignId
,
Long
.
parseLong
(
cusListId
),
companySiteId
);
// Thuc hien xoa cac khach hang chua lien lac tai bang campaign_customer
List
<
CampaignCustomer
>
listCampaignCustomer
=
campaignCustomerRepository
.
findCustomerNoContact
(
campaignId
,
companySiteId
,
Long
.
parseLong
(
cusListId
));
for
(
CampaignCustomer
entity
:
listCampaignCustomer
)
{
campaignCustomerRepository
.
delete
(
entity
);
}
// Thuc hien update cac khach hang da lien lac
List
<
CampaignCustomer
>
list
=
campaignCustomerRepository
.
findCustomerContacted
(
campaignId
,
companySiteId
,
Long
.
parseLong
(
cusListId
));
for
(
CampaignCustomer
campaignCustomer:
list
)
{
campaignCustomer
.
setInCampaignStatus
((
short
)
0
);
}
}
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/rest/CampaignController.java
View file @
03ae6a62
...
@@ -287,6 +287,13 @@ public class CampaignController {
...
@@ -287,6 +287,13 @@ public class CampaignController {
ResultDTO
resultDTO
=
campaignService
.
addCustomerListToCampaign
(
campaignRequestDTO
);
ResultDTO
resultDTO
=
campaignService
.
addCustomerListToCampaign
(
campaignRequestDTO
);
return
new
ResponseEntity
<>(
resultDTO
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
resultDTO
,
HttpStatus
.
OK
);
}
}
@PostMapping
(
"/deleteCustomerListFromCampaign"
)
@ResponseBody
public
ResponseEntity
deleteCustomerListFromCampaign
(
@RequestBody
CampaignRequestDTO
campaignRequestDTO
)
{
ResultDTO
resultDTO
=
campaignService
.
deleteCustomerListFromCampaign
(
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
);
...
...
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