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
8244d79c
Commit
8244d79c
authored
Aug 20, 2019
by
Tu Bach
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into tubn
parents
6264ccd9
dfc637fe
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
95 additions
and
74 deletions
+95
-74
pom.xml
pom.xml
+2
-2
src/main/java/com/viettel/campaign/filter/CorsFilter.java
src/main/java/com/viettel/campaign/filter/CorsFilter.java
+21
-21
src/main/java/com/viettel/campaign/repository/ccms_full/CampaignCustomerRepository.java
...aign/repository/ccms_full/CampaignCustomerRepository.java
+17
-19
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignRepositoryImpl.java
...ign/repository/ccms_full/impl/CampaignRepositoryImpl.java
+1
-1
src/main/java/com/viettel/campaign/service/CampaignExecuteService.java
.../com/viettel/campaign/service/CampaignExecuteService.java
+3
-0
src/main/java/com/viettel/campaign/service/CampaignService.java
...in/java/com/viettel/campaign/service/CampaignService.java
+1
-2
src/main/java/com/viettel/campaign/service/impl/CampaignExecuteServiceImp.java
...ttel/campaign/service/impl/CampaignExecuteServiceImp.java
+34
-0
src/main/java/com/viettel/campaign/service/impl/CampaignServiceImpl.java
...om/viettel/campaign/service/impl/CampaignServiceImpl.java
+0
-20
src/main/java/com/viettel/campaign/web/rest/CampaignController.java
...ava/com/viettel/campaign/web/rest/CampaignController.java
+15
-8
src/main/resources/application.yml
src/main/resources/application.yml
+1
-1
No files found.
pom.xml
View file @
8244d79c
...
...
@@ -49,8 +49,8 @@
<dependency>
<groupId>
com.oracle
</groupId>
<artifactId>
ojdbc7
</artifactId>
<scope>
system
</scope
>
<systemPath>
${project.basedir}/lib/ojdbc7.jar
</systemPath
>
<!-- <scope>system</scope>--
>
<!-- <systemPath>${project.basedir}/lib/ojdbc7.jar</systemPath>--
>
<version>
1.0
</version>
</dependency>
<dependency>
...
...
src/main/java/com/viettel/campaign/filter/CorsFilter.java
View file @
8244d79c
...
...
@@ -31,27 +31,27 @@ public class CorsFilter implements Filter {
HttpServletRequest
request
=
(
HttpServletRequest
)
req
;
//
chain.doFilter(req, resp);
if
(
"OPTIONS"
.
equalsIgnoreCase
(
request
.
getMethod
()))
{
chain
.
doFilter
(
req
,
resp
);
return
;
}
if
(
"/"
.
equals
(
request
.
getRequestURI
()))
{
chain
.
doFilter
(
req
,
resp
);
return
;
}
String
xAuthToken
=
request
.
getHeader
(
"X-Auth-Token"
);
if
(
xAuthToken
==
null
||
""
.
equals
(
xAuthToken
))
{
response
.
sendError
(
HttpServletResponse
.
SC_UNAUTHORIZED
,
"The token is null."
);
return
;
}
Object
obj
=
RedisUtil
.
getInstance
().
get
(
xAuthToken
);
if
(
obj
instanceof
UserSession
)
{
chain
.
doFilter
(
req
,
resp
);
}
else
{
response
.
sendError
(
HttpServletResponse
.
SC_UNAUTHORIZED
,
"The token is invalid."
);
}
chain
.
doFilter
(
req
,
resp
);
//
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
//
chain.doFilter(req, resp);
//
return;
//
}
//
if ("/".equals(request.getRequestURI())) {
//
chain.doFilter(req, resp);
//
return;
//
}
//
String xAuthToken = request.getHeader("X-Auth-Token");
//
if (xAuthToken == null || "".equals(xAuthToken)) {
//
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is null.");
//
return;
//
}
//
Object obj = RedisUtil.getInstance().get(xAuthToken);
//
if (obj instanceof UserSession) {
//
chain.doFilter(req, resp);
//
} else {
//
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is invalid.");
//
}
}
@Override
...
...
src/main/java/com/viettel/campaign/repository/ccms_full/CampaignCustomerRepository.java
View file @
8244d79c
...
...
@@ -13,28 +13,26 @@ import java.util.List;
@Repository
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
interface
CampaignCustomerRepository
extends
JpaRepository
<
CampaignCustomer
,
Long
>,
CampaignCustomerRepositoryCustom
{
@Query
(
value
=
"SELECT COUNT(*) "
+
" FROM CAMPAIGN_CUSTOMER CC "
+
" JOIN CAMPAIGN C ON CC.CAMPAIGN_ID = C.CAMPAIGN_ID "
+
" LEFT JOIN CAMPAIGN_COMPLETE_CODE CCC ON CC.STATUS = CCC.COMPLETE_VALUE"
+
" WHERE CC.COMPANY_SITE_ID = :companySiteId "
+
" AND CC.AGENT_ID = :agentId"
+
" AND C.STATUS = 2 "
+
" AND CC.RECALL_TIME <= SYSDATE "
+
" AND CCC.IS_RECALL = 1"
,
nativeQuery
=
true
)
Long
countRecallCustomer
(
@Param
(
"companySiteId"
)
Long
pCompanySiteId
,
@Param
(
"agentId"
)
Long
agentId
);
@Query
(
value
=
"SELECT COUNT(*) "
+
"FROM CAMPAIGN_CUSTOMER CC JOIN CAMPAIGN_COMPLETE_CODE CCC ON CC.CAMPAIGN_ID = CCC.CAMPAIGN_ID "
+
"WHERE CC.STATUS = 3 AND CC.CAMPAIGN_ID = :campaignId AND CC.CUSTOMER_ID = :customerId AND CCC.IS_RECALL = 1 AND CCC.STATUS = 1 "
,
nativeQuery
=
true
)
"WHERE CC.CAMPAIGN_ID = :campaignId "
+
"AND CC.CUSTOMER_ID = :customerId "
+
"AND CC.STATUS = 3 "
+
"AND CCC.IS_RECALL = 1 "
+
"AND CCC.STATUS = 1 "
,
nativeQuery
=
true
)
Long
getCustomerRecall
(
@Param
(
"campaignId"
)
Long
campaignId
,
@Param
(
"customerId"
)
Long
customerId
);
@Query
(
value
=
"SELECT cc.customer_id \n"
+
"FROM campaign_customer cc LEFT JOIN receive_cust_log cl ON cc.customer_id = cl.customer_id\n"
+
"WHERE cc.campaign_id = :campaignId \n"
+
" AND cc.agent_id = :agentId \n"
+
" AND cc.in_campaign_status = 1 \n"
+
" AND cl.customer_id IS NULL \n"
+
" AND EXISTS(SELECT 1 \n"
+
" FROM campaign_complete_code ccc \n"
+
" WHERE cc.status = ccc.complete_value \n"
+
" AND ccc.status = 1 \n"
+
" AND ccc.is_recall = 1 \n"
+
" AND ccc.complete_type = 2 \n"
+
" AND ccc.company_site_id = :companySiteId) \n"
+
" AND cc.recall_time <= SYSDATE\n"
+
" AND cc.recall_time + interval :apParam MINUTE >= SYSDATE"
,
nativeQuery
=
true
)
List
<
CampaignCustomer
>
getCustomerRecallDate
(
@Param
(
"campaignId"
)
Long
campaignId
,
@Param
(
"agentId"
)
Long
agentId
,
@Param
(
"companySiteId"
)
Long
companySiteId
,
@Param
(
"apParam"
)
String
apParam
);
CampaignCustomer
findCampaignCustomerByCampaignCustomerId
(
Long
id
);
}
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignRepositoryImpl.java
View file @
8244d79c
...
...
@@ -159,7 +159,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
sb
.
append
(
" AND a.CUSTOMER_NUMBER <= :p_cusNumTo"
);
}
sb
.
append
(
" ORDER BY a.
START
_TIME DESC "
);
sb
.
append
(
" ORDER BY a.
CREATE
_TIME DESC "
);
SQLQuery
query
=
session
.
createSQLQuery
(
sb
.
toString
());
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getCampaignCode
()))
{
...
...
src/main/java/com/viettel/campaign/service/CampaignExecuteService.java
View file @
8244d79c
...
...
@@ -36,4 +36,7 @@ public interface CampaignExecuteService {
ResultDTO
callCustomer
(
ContactCustResultDTO
dto
);
ResultDTO
countRecallCustomer
(
Long
companySiteId
,
Long
agentId
);
ResultDTO
getCustomerRecall
(
Long
campaignId
,
Long
customerId
);
}
src/main/java/com/viettel/campaign/service/CampaignService.java
View file @
8244d79c
...
...
@@ -30,8 +30,6 @@ public interface CampaignService {
ResultDTO
addNewCampaign
(
CampaignDTO
campaignDTO
);
Map
countRecallCustomer
(
Long
companySiteId
,
Long
agentId
);
ResultDTO
findCampaignById
(
Long
campaignId
);
ResultDTO
changeCampaignStatus
(
CampaignDTO
dto
);
...
...
@@ -57,4 +55,5 @@ public interface CampaignService {
ResultDTO
getListFieldsToShow
(
CampaignRequestDTO
dto
);
//</editor-fold>
}
src/main/java/com/viettel/campaign/service/impl/CampaignExecuteServiceImp.java
View file @
8244d79c
...
...
@@ -495,4 +495,38 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
return
result
;
}
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
countRecallCustomer
(
Long
companySiteId
,
Long
agentId
)
{
Long
count
=
campaignCustomerRepository
.
countRecallCustomer
(
companySiteId
,
agentId
);
ResultDTO
resultDTO
=
new
ResultDTO
();
if
(
count
!=
null
)
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
resultDTO
.
setData
(
count
);
}
else
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
resultDTO
.
setData
(
0
);
}
return
resultDTO
;
}
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
getCustomerRecall
(
Long
campaignId
,
Long
customerId
)
{
Long
count
=
campaignCustomerRepository
.
getCustomerRecall
(
campaignId
,
customerId
);
ResultDTO
resultDTO
=
new
ResultDTO
();
if
(
count
!=
null
)
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
resultDTO
.
setData
(
count
);
}
else
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
resultDTO
.
setData
(
0
);
}
return
resultDTO
;
}
}
src/main/java/com/viettel/campaign/service/impl/CampaignServiceImpl.java
View file @
8244d79c
...
...
@@ -170,26 +170,6 @@ public class CampaignServiceImpl implements CampaignService {
return
resultDTO
;
}
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
Map
countRecallCustomer
(
Long
companySiteId
,
Long
agentId
)
{
Map
result
=
new
HashMap
();
Long
count
=
campaignRepository
.
countRecallCustomer
(
companySiteId
,
agentId
);
ResultDTO
resultDTO
=
new
ResultDTO
();
if
(
count
!=
null
)
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
result
.
put
(
"info"
,
resultDTO
);
result
.
put
(
"result"
,
count
);
}
else
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
result
.
put
(
"info"
,
resultDTO
);
result
.
put
(
"result"
,
0
);
}
return
result
;
}
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
findCampaignById
(
Long
campaignId
)
{
...
...
src/main/java/com/viettel/campaign/web/rest/CampaignController.java
View file @
8244d79c
...
...
@@ -96,13 +96,6 @@ public class CampaignController {
return
campaignService
.
addNewCampaign
(
dto
);
}
@GetMapping
(
"/countRecallCustomer"
)
@ResponseBody
public
ResponseEntity
countRecallCustomer
(
@RequestParam
(
"companySiteId"
)
Long
companySiteId
,
@RequestParam
(
"agentId"
)
Long
agentId
)
{
Map
result
=
campaignService
.
countRecallCustomer
(
companySiteId
,
agentId
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
@GetMapping
(
"/findByCampaignId"
)
@ResponseBody
public
ResponseEntity
findByCampaignId
(
@RequestParam
(
"campaignId"
)
Long
campaignId
)
{
...
...
@@ -163,7 +156,7 @@ public class CampaignController {
return
new
ResponseEntity
<
byte
[]>(
contentReturn
,
headers
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/changeCampaignStatus"
,
method
=
RequestMethod
.
P
U
T
)
@RequestMapping
(
value
=
"/changeCampaignStatus"
,
method
=
RequestMethod
.
P
OS
T
)
public
ResultDTO
changeCampaignStatus
(
@RequestBody
CampaignDTO
dto
,
HttpServletRequest
request
)
{
dto
.
setSessionId
(
request
.
getSession
().
getId
());
return
campaignService
.
changeCampaignStatus
(
dto
);
...
...
@@ -240,4 +233,18 @@ public class CampaignController {
ResultDTO
resultDTO
=
campaignService
.
getListFieldsToShow
(
dto
);
return
new
ResponseEntity
<>(
resultDTO
,
HttpStatus
.
OK
);
}
@GetMapping
(
"/countRecallCustomer"
)
@ResponseBody
public
ResponseEntity
countRecallCustomer
(
@RequestParam
(
"companySiteId"
)
Long
companySiteId
,
@RequestParam
(
"agentId"
)
Long
agentId
)
{
ResultDTO
result
=
campaignExecuteService
.
countRecallCustomer
(
companySiteId
,
agentId
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
@GetMapping
(
"/getCustomerRecall"
)
@ResponseBody
public
ResponseEntity
getCustomerRecall
(
@RequestParam
(
"campaignId"
)
Long
campaignId
,
@RequestParam
(
"customerId"
)
Long
customerId
)
{
ResultDTO
result
=
campaignExecuteService
.
getCustomerRecall
(
campaignId
,
customerId
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
}
src/main/resources/application.yml
View file @
8244d79c
server
:
port
:
9999
port
:
1111
spring
:
application
:
name
:
campaign
...
...
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