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
5e3ed78c
Commit
5e3ed78c
authored
Sep 03, 2019
by
Vu Duy Anh
Browse files
Options
Browse Files
Download
Plain Diff
anhvd accept merge
parents
36905cb9
6476719d
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
195 additions
and
124 deletions
+195
-124
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignExecuteRepositoryImp.java
...pository/ccms_full/impl/CampaignExecuteRepositoryImp.java
+5
-1
src/main/java/com/viettel/campaign/service/CampaignExecuteService.java
.../com/viettel/campaign/service/CampaignExecuteService.java
+2
-0
src/main/java/com/viettel/campaign/service/impl/CampaignExecuteServiceImp.java
...ttel/campaign/service/impl/CampaignExecuteServiceImp.java
+20
-5
src/main/java/com/viettel/campaign/service/impl/CampaignServiceImpl.java
...om/viettel/campaign/service/impl/CampaignServiceImpl.java
+23
-18
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
...om/viettel/campaign/service/impl/CustomerServiceImpl.java
+132
-98
src/main/java/com/viettel/campaign/web/dto/request_dto/CustomerQueryDTO.java
...iettel/campaign/web/dto/request_dto/CustomerQueryDTO.java
+5
-1
src/main/java/com/viettel/campaign/web/rest/CampaignExecuteController.java
.../viettel/campaign/web/rest/CampaignExecuteController.java
+7
-0
src/main/java/com/viettel/campaign/web/rest/CustomerController.java
...ava/com/viettel/campaign/web/rest/CustomerController.java
+1
-1
No files found.
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignExecuteRepositoryImp.java
View file @
5e3ed78c
...
...
@@ -126,7 +126,9 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
sql
.
append
(
" CC2.COMPLETE_NAME AS surveyStatus, "
);
sql
.
append
(
" C.STATUS AS status, "
);
sql
.
append
(
" CCR.STATUS AS recordStatus, "
);
sql
.
append
(
" (( CCR.END_TIME - CCR.START_CALL ) * 24 * 60 * 60) AS callTime "
);
sql
.
append
(
" (( CCR.END_TIME - CCR.START_CALL ) * 24 * 60 * 60) AS callTime, "
);
sql
.
append
(
" C.CAMPAIGN_ID AS campaignId, "
);
sql
.
append
(
" CUS.CUSTOMER_ID AS customerId "
);
sql
.
append
(
"FROM CONTACT_CUST_RESULT CCR "
);
sql
.
append
(
" INNER JOIN CAMPAIGN C ON CCR.CAMPAIGN_ID = C.CAMPAIGN_ID "
);
sql
.
append
(
" INNER JOIN VSA_USERS VU ON CCR.AGENT_ID = VU.USER_ID "
);
...
...
@@ -293,6 +295,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
item
.
setStatus
(
obj
[
10
]
==
null
?
0
:
((
BigDecimal
)
obj
[
10
]).
shortValueExact
());
item
.
setRecordStatus
(
obj
[
11
]
==
null
?
0
:
((
BigDecimal
)
obj
[
11
]).
shortValueExact
());
item
.
setCallTime
(
obj
[
12
]
==
null
?
0L
:
((
BigDecimal
)
obj
[
12
]).
longValueExact
());
item
.
setCampaignId
(
obj
[
13
]
==
null
?
0L
:
((
BigDecimal
)
obj
[
13
]).
longValueExact
());
item
.
setCustomerId
(
obj
[
14
]
==
null
?
0L
:
((
BigDecimal
)
obj
[
14
]).
longValueExact
());
list
.
add
(
item
);
}
...
...
src/main/java/com/viettel/campaign/service/CampaignExecuteService.java
View file @
5e3ed78c
...
...
@@ -52,4 +52,6 @@ public interface CampaignExecuteService {
ResultDTO
createListContacQuestResult
(
List
<
ContactQuestResultDTO
>
dtoList
);
String
getDialModeAtCurrent
(
Long
campaignId
,
Long
companySiteId
);
ResultDTO
getContactCustResultById
(
Long
contactCustResultId
);
}
src/main/java/com/viettel/campaign/service/impl/CampaignExecuteServiceImp.java
View file @
5e3ed78c
...
...
@@ -38,9 +38,6 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
@Autowired
ModelMapper
modelMapper
;
@Autowired
ContactCustResultRepository
ccResultRepository
;
@Autowired
ReceiveCustLogRepository
custLogRepository
;
...
...
@@ -68,6 +65,9 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
@Autowired
CampaignCustomerListColumnRepository
campaignCustomerListColumnRepository
;
@Autowired
ContactCustResultRepository
ccResultRepository
;
@Autowired
ContactQuestResultRepository
contactQuestResultRepository
;
...
...
@@ -226,9 +226,9 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
++
rowIndex
;
++
count
;
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
finally
{
}
finally
{
if
(
workbook
!=
null
)
workbook
.
close
();
}
...
...
@@ -728,4 +728,19 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
return
"-1"
;
}
@Override
public
ResultDTO
getContactCustResultById
(
Long
contactCustResultId
)
{
ResultDTO
resultDTO
=
new
ResultDTO
();
try
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
resultDTO
.
setData
(
ccResultRepository
.
findById
(
contactCustResultId
));
}
catch
(
Exception
e
)
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
}
return
resultDTO
;
}
}
src/main/java/com/viettel/campaign/service/impl/CampaignServiceImpl.java
View file @
5e3ed78c
...
...
@@ -2,9 +2,7 @@ package com.viettel.campaign.service.impl;
import
com.viettel.campaign.config.DataSourceQualify
;
import
com.viettel.campaign.model.ccms_full.*
;
//import com.viettel.campaign.model.UserActionLog;
import
com.viettel.campaign.repository.ccms_full.*
;
//import com.viettel.campaign.repository.UserActionLogRepository;
import
com.viettel.campaign.service.CampaignService
;
import
com.viettel.campaign.utils.BundleUtils
;
import
com.viettel.campaign.utils.Constants
;
...
...
@@ -14,7 +12,9 @@ import com.viettel.campaign.web.dto.*;
import
com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.ss.usermodel.CellStyle
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.util.CellRangeAddress
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.modelmapper.ModelMapper
;
...
...
@@ -22,12 +22,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
//import com.viettel.campaign.model.UserActionLog;
//import com.viettel.campaign.repository.UserActionLogRepository;
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
CampaignServiceImpl
implements
CampaignService
{
...
...
@@ -637,20 +636,26 @@ public class CampaignServiceImpl implements CampaignService {
List
<
CustomerListDTO
>
listCustomerDto
=
dto
.
getLstCustomerCampaign
();
try
{
// Thuc hien them giam khach hang
for
(
CustomerListDTO
customerListDTO
:
listCustomerDto
)
{
for
(
CustomerListDTO
customerListDTO
:
listCustomerDto
)
{
// Duyet tung customerList
if
(
customerListDTO
.
getTotalCusAddRemove
()
>
0
)
{
// Them khach hang
// Lay ra danh sach khach hang phu hop de them
List
<
Customer
>
listCustomerToAdd
=
customerRepository
.
findAllCutomerNotInCampagin
(
customerListDTO
.
getCustomerListId
(),
campaignId
);
for
(
int
i
=
0
;
i
<
customerListDTO
.
getTotalCusAddRemove
();
i
++)
{
CampaignCustomer
campaignCustomerEntity
=
new
CampaignCustomer
();
campaignCustomerEntity
.
setCampaignId
(
campaignId
);
campaignCustomerEntity
.
setCustomerId
(
listCustomerToAdd
.
get
(
i
).
getCustomerId
());
campaignCustomerEntity
.
setStatus
((
short
)
0
);
campaignCustomerEntity
.
setRecallCount
(
0L
);
campaignCustomerEntity
.
setCustomerListId
(
customerListDTO
.
getCustomerListId
());
campaignCustomerEntity
.
setCompanySiteId
(
companySiteId
);
campaignCustomerEntity
.
setInCampaignStatus
((
short
)
1
);
campaignCustomerRepository
.
save
(
campaignCustomerEntity
);
int
numOfCusInList
=
listCustomerToAdd
.
size
();
// Số khách hàng còn lại của chiến dịch chưa đc add vào campaign
for
(
int
i
=
0
,
j
=
0
;
(
i
<
customerListDTO
.
getTotalCusAddRemove
()
&&
j
<
numOfCusInList
);
j
++)
{
if
(
campaignCustomerRepository
.
findCampaignCustomerByCampaignIdAndCompanySiteIdAndCustomerId
(
campaignId
,
companySiteId
,
listCustomerToAdd
.
get
(
j
).
getCustomerId
())
!=
null
)
{
// Khach hang đã đc chèn vào campaign theo individual
continue
;
}
else
{
CampaignCustomer
campaignCustomerEntity
=
new
CampaignCustomer
();
campaignCustomerEntity
.
setCampaignId
(
campaignId
);
campaignCustomerEntity
.
setCustomerId
(
listCustomerToAdd
.
get
(
j
).
getCustomerId
());
campaignCustomerEntity
.
setStatus
((
short
)
0
);
campaignCustomerEntity
.
setRecallCount
(
0L
);
campaignCustomerEntity
.
setCustomerListId
(
customerListDTO
.
getCustomerListId
());
campaignCustomerEntity
.
setCompanySiteId
(
companySiteId
);
campaignCustomerEntity
.
setInCampaignStatus
((
short
)
1
);
campaignCustomerRepository
.
save
(
campaignCustomerEntity
);
i
+=
1
;
}
}
}
else
if
(
customerListDTO
.
getTotalCusAddRemove
()
<
0
){
// Loai bo khach hang
long
custToDel
=
Math
.
abs
(
customerListDTO
.
getTotalCusAddRemove
());
...
...
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
View file @
5e3ed78c
This diff is collapsed.
Click to expand it.
src/main/java/com/viettel/campaign/web/dto/request_dto/CustomerQueryDTO.java
View file @
5e3ed78c
package
com.viettel.campaign.web.dto.request_dto
;
import
com.viettel.campaign.web.dto.BaseDTO
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public
class
CustomerQueryDTO
extends
BaseDTO
{
String
join
;
Long
field
;
String
operator
;
String
condition
;
String
type
;
}
src/main/java/com/viettel/campaign/web/rest/CampaignExecuteController.java
View file @
5e3ed78c
...
...
@@ -180,4 +180,11 @@ public class CampaignExecuteController {
String
result
=
campaignExecuteService
.
getDialModeAtCurrent
(
companySiteId
,
campaignId
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
@GetMapping
(
"/getContactCustResultById"
)
@ResponseBody
public
ResponseEntity
getContactCustResultById
(
@RequestParam
(
"contactCustResultId"
)
Long
contactCustResultId
)
{
ResultDTO
result
=
campaignExecuteService
.
getContactCustResultById
(
contactCustResultId
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
}
src/main/java/com/viettel/campaign/web/rest/CustomerController.java
View file @
5e3ed78c
...
...
@@ -316,7 +316,7 @@ public class CustomerController {
return
new
ResponseEntity
<>(
resultDTO
,
HttpStatus
.
OK
);
}
@PostMapping
(
"/search
CustomizeFields
"
)
@PostMapping
(
"/search
IndividualCustomer
"
)
@ResponseBody
public
ResponseEntity
searchCustomizeFields
(
@RequestBody
CampaignCustomerDTO
campaignCustomerDTO
)
{
ResultDTO
result
=
customerService
.
searchCustomizeFields
(
campaignCustomerDTO
);
...
...
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