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
d608f591
Commit
d608f591
authored
Aug 09, 2019
by
Vu Duy Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
anhvd commit change
parent
55a6b806
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
85 additions
and
7 deletions
+85
-7
src/main/java/com/viettel/campaign/repository/CampaignRepositoryCustom.java
...viettel/campaign/repository/CampaignRepositoryCustom.java
+2
-0
src/main/java/com/viettel/campaign/repository/impl/CampaignRepositoryImpl.java
...ttel/campaign/repository/impl/CampaignRepositoryImpl.java
+42
-2
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
+9
-4
src/main/java/com/viettel/campaign/web/rest/controller/CampaignController.java
...ttel/campaign/web/rest/controller/CampaignController.java
+5
-0
src/main/resources/sql/campaign-mng/check-allow-campaign-status-to-prepare.sql
...l/campaign-mng/check-allow-campaign-status-to-prepare.sql
+16
-0
src/main/resources/sql/campaign-mng/search-campaign-by-params.sql
.../resources/sql/campaign-mng/search-campaign-by-params.sql
+9
-1
No files found.
src/main/java/com/viettel/campaign/repository/CampaignRepositoryCustom.java
View file @
d608f591
...
...
@@ -13,4 +13,6 @@ public interface CampaignRepositoryCustom {
ResultDTO
findByCampaignCode
(
CampaignRequestDTO
requestDTO
);
String
getMaxCampaignIndex
();
ResultDTO
checkAllowStatusToPrepare
(
Long
campaignId
);
}
src/main/java/com/viettel/campaign/repository/impl/CampaignRepositoryImpl.java
View file @
d608f591
...
...
@@ -192,7 +192,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getCampaignName
()))
{
sqlStr
.
append
(
" AND UPPER(a.CAMPAIGN_NAME) LIKE :p_name"
);
}
if
(
requestDto
.
getStatus
()
!=
null
&&
requestDto
.
getStatus
()
>
0
)
{
if
(
requestDto
.
getStatus
()
!=
null
&&
requestDto
.
getStatus
()
>
=
0
)
{
sqlStr
.
append
(
" AND a.STATUS = :p_status"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getFromDateFr
()))
{
...
...
@@ -245,7 +245,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
query
.
setParameter
(
"p_company_site_id"
,
requestDto
.
getCompanySiteId
());
if
(
requestDto
.
getStatus
()
!=
null
&&
requestDto
.
getStatus
()
>
0
)
{
if
(
requestDto
.
getStatus
()
!=
null
&&
requestDto
.
getStatus
()
>
=
0
)
{
query
.
setParameter
(
"p_status"
,
requestDto
.
getStatus
());
}
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getFromDateFr
()))
{
...
...
@@ -287,6 +287,14 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
query
.
addScalar
(
"numOfJoinedCus"
,
new
LongType
());
query
.
addScalar
(
"numOfNotJoinedCus"
,
new
LongType
());
query
.
addScalar
(
"numOfLockCus"
,
new
LongType
());
query
.
addScalar
(
"companySiteId"
,
new
LongType
());
query
.
addScalar
(
"content"
,
new
StringType
());
query
.
addScalar
(
"maxRecall"
,
new
IntegerType
());
query
.
addScalar
(
"recallType"
,
new
IntegerType
());
query
.
addScalar
(
"recallDuration"
,
new
IntegerType
());
query
.
addScalar
(
"currentTimeMode"
,
new
LongType
());
query
.
addScalar
(
"wrapupTimeConnect"
,
new
LongType
());
query
.
addScalar
(
"wrapupTimeDisconnect"
,
new
LongType
());
query
.
setResultTransformer
(
Transformers
.
aliasToBean
(
CampaignDTO
.
class
));
int
count
=
0
;
...
...
@@ -407,4 +415,36 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
return
null
;
}
@Override
public
ResultDTO
checkAllowStatusToPrepare
(
Long
campaignId
)
{
logger
.
info
(
"Start check allow campaign status to prepare::"
);
ResultDTO
result
=
new
ResultDTO
();
if
(
DataUtil
.
isNullOrZero
(
campaignId
))
{
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
result
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
return
result
;
}
SessionFactory
sessionFactory
=
HibernateUtil
.
getSessionFactory
();
Session
session
=
sessionFactory
.
openSession
();
try
{
StringBuilder
sqlStr
=
new
StringBuilder
();
sqlStr
.
append
(
SQLBuilder
.
getSqlQueryById
(
SQLBuilder
.
SQL_MODULE_CAMPAIGN_MNG
,
"check-allow-campaign-status-to-prepare"
));
SQLQuery
query
=
session
.
createSQLQuery
(
sqlStr
.
toString
());
query
.
setParameter
(
"p_campaignId"
,
campaignId
);
List
<
Object
[]>
list
=
query
.
list
();
if
(
list
.
size
()
>
0
)
{
result
.
setData
(
list
.
get
(
0
));
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
result
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
}
}
catch
(
Exception
ex
)
{
logger
.
error
(
ex
.
getMessage
(),
ex
);
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
result
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
}
finally
{
session
.
close
();
}
return
result
;
}
}
src/main/java/com/viettel/campaign/service/CampaignService.java
View file @
d608f591
...
...
@@ -20,4 +20,6 @@ public interface CampaignService {
ResultDTO
findCampaignById
(
Long
campaignId
);
ResultDTO
changeCampaignStatus
(
CampaignDTO
dto
);
ResultDTO
checkAllowStatusToPrepare
(
Long
campaignId
);
}
src/main/java/com/viettel/campaign/service/impl/CampaignServiceImpl.java
View file @
d608f591
...
...
@@ -163,13 +163,13 @@ public class CampaignServiceImpl implements CampaignService {
if
(
dto
.
getStatus
().
equals
((
short
)
-
1
))
{
userActionLog
.
setActionType
((
short
)
2
);
}
else
if
(
dto
.
getStatus
().
equals
((
short
)
5
))
{
else
if
(
dto
.
getStatus
().
equals
((
short
)
4
))
{
userActionLog
.
setActionType
((
short
)
7
);
}
else
if
(
dto
.
getStatus
().
equals
((
short
)
4
))
{
else
if
(
dto
.
getStatus
().
equals
((
short
)
3
))
{
userActionLog
.
setActionType
((
short
)
4
);
}
else
if
(
dto
.
getStatus
().
equals
((
short
)
3
))
{
else
if
(
dto
.
getStatus
().
equals
((
short
)
2
))
{
userActionLog
.
setActionType
((
short
)
5
);
}
...
...
@@ -189,12 +189,17 @@ public class CampaignServiceImpl implements CampaignService {
return
result
;
}
@Override
public
ResultDTO
checkAllowStatusToPrepare
(
Long
campaignId
)
{
return
campaignRepository
.
checkAllowStatusToPrepare
(
campaignId
);
}
private
String
generateCampaignCode
(
String
campaignType
,
Short
chanel
)
{
int
year
=
Calendar
.
getInstance
().
get
(
Calendar
.
YEAR
);
String
maxIndexStr
=
campaignRepository
.
getMaxCampaignIndex
();
if
(
maxIndexStr
!=
null
)
{
Long
maxIndex
=
Long
.
valueOf
(
maxIndexStr
)
+
1
;
String
result
=
campaignType
+
"_"
+
String
.
valueOf
(
chanel
)
+
"_"
+
String
.
valueOf
(
year
)
+
"_"
+
maxIndex
.
toString
();
String
result
=
campaignType
+
"_"
+
chanel
+
"_"
+
year
+
"_"
+
maxIndex
.
toString
();
return
result
;
}
return
null
;
...
...
src/main/java/com/viettel/campaign/web/rest/controller/CampaignController.java
View file @
d608f591
...
...
@@ -110,4 +110,9 @@ public class CampaignController {
dto
.
setSessionId
(
request
.
getSession
().
getId
());
return
campaignService
.
changeCampaignStatus
(
dto
);
}
@RequestMapping
(
value
=
"/check-allow-status-to-prepare"
,
method
=
RequestMethod
.
GET
)
public
ResultDTO
checkAllowStatusToPrepare
(
@RequestParam
(
"campaignId"
)
Long
campaignId
)
{
return
campaignService
.
checkAllowStatusToPrepare
(
campaignId
);
}
}
src/main/resources/sql/campaign-mng/check-allow-campaign-status-to-prepare.sql
0 → 100644
View file @
d608f591
WITH
COUNT_LIST
AS
(
SELECT
(
SELECT
COUNT
(
1
)
FROM
CAMPAIGN_CUSTOMER
WHERE
CAMPAIGN_ID
=
:
p_campaignId
)
countCamp
,
(
SELECT
COUNT
(
1
)
FROM
CAMPAIGN_AGENT
WHERE
CAMPAIGN_ID
=
:
p_campaignId
)
countAgent
,
(
select
COUNT
(
1
)
FROM
SCENARIO
s
INNER
JOIN
SCENARIO_QUESTION
sq
ON
s
.
SCENARIO_ID
=
sq
.
SCENARIO_ID
INNER
JOIN
SCENARIO_ANSWER
sa
ON
sq
.
SCENARIO_QUESTION_ID
=
sa
.
SCENARIO_QUESTION_ID
WHERE
s
.
CAMPAIGN_ID
=
:
p_campaignId
)
countScenario
FROM
DUAL
)
SELECT
c
.
countCamp
countCamp
,
c
.
countAgent
countAgent
,
c
.
countScenario
countScenario
,
CASE
WHEN
(
c
.
countCamp
IS
NOT
NULL
AND
c
.
countAgent
IS
NOT
NULL
AND
c
.
countScenario
IS
NOT
NULL
)
THEN
'00'
ELSE
'01'
END
as
code
FROM
COUNT_LIST
c
src/main/resources/sql/campaign-mng/search-campaign-by-params.sql
View file @
d608f591
...
...
@@ -12,7 +12,15 @@ SELECT
a
.
CUSTOMER_NUMBER
cusNum
,
b
.
SLKHThamgiaCD
numOfJoinedCus
,
c
.
SLKHChuaTuongTac
numOfNotJoinedCus
,
d
.
SLKHDoNotCall_Khoa
numOfLockCus
d
.
SLKHDoNotCall_Khoa
numOfLockCus
,
a
.
COMPANY_SITE_ID
companySiteId
,
a
.
CONTENT
content
,
a
.
MAX_RECALL
maxRecall
,
a
.
RECALL_TYPE
recallType
,
a
.
RECALL_DURATION
recallDuration
,
a
.
CURRENT_TIME_MODE
currentTimeMode
,
a
.
WRAPUP_TIME_CONNECT
wrapupTimeConnect
,
a
.
WRAPUP_TIME_DISCONNECT
wrapupTimeDisconnect
FROM
CAMPAIGN
a
LEFT
JOIN
(
SELECT
campaign_id
,
COUNT
(
*
)
AS
SLKHThamgiaCD
FROM
campaign_customer
cc
INNER
JOIN
CUSTOMER
cus
ON
cc
.
CUSTOMER_ID
=
cus
.
CUSTOMER_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