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
82b23ea9
Commit
82b23ea9
authored
Sep 01, 2019
by
Phạm Duy Phi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
phipd commit
parent
705d15ea
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
28 deletions
+34
-28
src/main/java/com/viettel/campaign/service/AgentsService.java
...main/java/com/viettel/campaign/service/AgentsService.java
+2
-2
src/main/java/com/viettel/campaign/service/impl/AgentsServiceImpl.java
.../com/viettel/campaign/service/impl/AgentsServiceImpl.java
+28
-22
src/main/java/com/viettel/campaign/web/rest/AgentsController.java
.../java/com/viettel/campaign/web/rest/AgentsController.java
+4
-4
No files found.
src/main/java/com/viettel/campaign/service/AgentsService.java
View file @
82b23ea9
...
...
@@ -9,7 +9,7 @@ import java.util.List;
public
interface
AgentsService
{
ResultDTO
getAgentsByAgentId
(
String
agentId
);
ResultDTO
getAllAgentByCompanySiteId
(
int
page
,
int
pageSize
,
Long
companySiteId
);
ResultDTO
getAllAgentByCompanySiteId
(
int
page
,
int
pageSize
,
Long
companySiteId
,
Long
campaignId
);
ResultDTO
getAllAgentSelectedByCompanySiteId
(
int
page
,
int
pageSize
,
Long
companySiteId
,
Long
campaignId
);
...
...
@@ -17,7 +17,7 @@ public interface AgentsService {
ResultDTO
deleteCampaignAgentById
(
List
<
Long
>
campaignAgentId
);
ResultDTO
searchCampaignAgentByName
(
int
page
,
int
pageSize
,
Long
companySiteId
,
String
userName
,
String
fullName
);
ResultDTO
searchCampaignAgentByName
(
int
page
,
int
pageSize
,
Long
c
ampaignId
,
Long
c
ompanySiteId
,
String
userName
,
String
fullName
);
ResultDTO
searchCampaignAgentSelectByName
(
int
page
,
int
pageSize
,
Long
companySiteId
,
Long
campaignId
,
String
userName
,
String
fullName
);
...
...
src/main/java/com/viettel/campaign/service/impl/AgentsServiceImpl.java
View file @
82b23ea9
...
...
@@ -62,7 +62,7 @@ public class AgentsServiceImpl implements AgentsService {
@Override
@Transactional
(
DataSourceQualify
.
ACD_FULL
)
public
ResultDTO
getAllAgentByCompanySiteId
(
int
page
,
int
pageSize
,
Long
companySiteId
)
{
public
ResultDTO
getAllAgentByCompanySiteId
(
int
page
,
int
pageSize
,
Long
companySiteId
,
Long
campaignId
)
{
ResultDTO
resultDTO
=
new
ResultDTO
();
SessionFactory
sessionFactory
=
HibernateUtil
.
getSessionFactory
();
...
...
@@ -83,36 +83,41 @@ public class AgentsServiceImpl implements AgentsService {
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"SELECT"
);
sb
.
append
(
" a.USER_ID userId,"
);
sb
.
append
(
" a.USER_NAME userName,"
);
sb
.
append
(
" a.STATUS status,"
);
sb
.
append
(
" a.FULL_NAME fullName,"
);
sb
.
append
(
" a.COMPANY_SITE_ID companySiteId,"
);
sb
.
append
(
" b.FILTER_TYPE filterType,"
);
sb
.
append
(
" b.CAMPAIGN_AGENT_ID campaignAgentId,"
);
sb
.
append
(
" d.ROLE_CODE roleCode"
);
sb
.
append
(
" FROM VSA_USERS a"
);
sb
.
append
(
" LEFT JOIN CAMPAIGN_AGENT b on a.USER_ID = b.AGENT_ID"
);
sb
.
append
(
" INNER JOIN USER_ROLE c on a.USER_ID = c.USER_ID"
);
sb
.
append
(
" INNER JOIN ROLE d on c.ROLE_ID = d.ROLE_ID"
);
sb
.
append
(
" vu.USER_ID userId,"
);
sb
.
append
(
" vu.USER_NAME userName,"
);
sb
.
append
(
" vu.STATUS status,"
);
sb
.
append
(
" vu.FULL_NAME fullName,"
);
sb
.
append
(
" vu.COMPANY_SITE_ID companySiteId,"
);
sb
.
append
(
" r.ROLE_CODE roleCode"
);
sb
.
append
(
" FROM VSA_USERS vu"
);
sb
.
append
(
" INNER JOIN USER_ROLE ur on vu.USER_ID = ur.USER_ID"
);
sb
.
append
(
" INNER JOIN ROLE r on ur.ROLE_ID = r.ROLE_ID"
);
sb
.
append
(
" WHERE 1 = 1"
);
sb
.
append
(
" AND a.COMPANY_SITE_ID = :p_company_site_id"
);
sb
.
append
(
" AND a.STATUS = 1"
);
sb
.
append
(
" AND b.AGENT_ID IS NULL"
);
sb
.
append
(
" AND d.ROLE_CODE IN ('AGENT', 'SUPERVISOR')"
);
sb
.
append
(
" ORDER BY UPPER(a.FULL_NAME)"
);
sb
.
append
(
" AND vu.COMPANY_SITE_ID = :p_company_site_id"
);
sb
.
append
(
" AND vu.STATUS = 1"
);
sb
.
append
(
" AND r.ROLE_CODE IN ('AGENT', 'SUPERVISOR')"
);
sb
.
append
(
" AND vu.USER_ID NOT IN (SELECT vu.USER_ID userId"
);
sb
.
append
(
" FROM VSA_USERS vu"
);
sb
.
append
(
" LEFT JOIN CAMPAIGN_AGENT ca on vu.USER_ID = ca.AGENT_ID"
);
sb
.
append
(
" INNER JOIN USER_ROLE ur on vu.USER_ID = ur.USER_ID"
);
sb
.
append
(
" INNER JOIN ROLE r on ur.ROLE_ID = r.ROLE_ID"
);
sb
.
append
(
" WHERE 1 = 1"
);
sb
.
append
(
" AND vu.COMPANY_SITE_ID = :p_company_site_id"
);
sb
.
append
(
" AND vu.STATUS = 1"
);
sb
.
append
(
" AND ca.CAMPAIGN_ID = :p_campaign_id"
);
sb
.
append
(
" AND r.ROLE_CODE IN ('AGENT', 'SUPERVISOR'))"
);
sb
.
append
(
" ORDER BY UPPER(vu.FULL_NAME)"
);
SQLQuery
query
=
session
.
createSQLQuery
(
sb
.
toString
());
query
.
setParameter
(
"p_company_site_id"
,
companySiteId
);
query
.
setParameter
(
"p_campaign_id"
,
campaignId
);
query
.
addScalar
(
"userId"
,
new
LongType
());
query
.
addScalar
(
"userName"
,
new
StringType
());
query
.
addScalar
(
"status"
,
new
ShortType
());
query
.
addScalar
(
"fullName"
,
new
StringType
());
query
.
addScalar
(
"companySiteId"
,
new
LongType
());
query
.
addScalar
(
"filterType"
,
new
ShortType
());
query
.
addScalar
(
"campaignAgentId"
,
new
LongType
());
query
.
addScalar
(
"roleCode"
,
new
StringType
());
query
.
setResultTransformer
(
Transformers
.
aliasToBean
(
VSAUsersDTO
.
class
));
...
...
@@ -276,7 +281,7 @@ public class AgentsServiceImpl implements AgentsService {
}
@Override
public
ResultDTO
searchCampaignAgentByName
(
int
page
,
int
pageSize
,
Long
companySiteId
,
String
userName
,
String
fullName
)
{
public
ResultDTO
searchCampaignAgentByName
(
int
page
,
int
pageSize
,
Long
c
ampaignId
,
Long
c
ompanySiteId
,
String
userName
,
String
fullName
)
{
ResultDTO
resultDTO
=
new
ResultDTO
();
SessionFactory
sessionFactory
=
HibernateUtil
.
getSessionFactory
();
...
...
@@ -320,12 +325,13 @@ public class AgentsServiceImpl implements AgentsService {
sqlStrBuilder
.
append
(
" AND d.ROLE_CODE IN ('AGENT', 'SUPERVISOR')"
);
sqlStrBuilder
.
append
(
" AND a.STATUS = 1"
);
sqlStrBuilder
.
append
(
" AND
b.AGENT_ID IS NULL
"
);
sqlStrBuilder
.
append
(
" AND
(b.CAMPAIGN_ID IS NULL OR b.CAMPAIGN_ID <> :p_campaign_id)
"
);
sqlStrBuilder
.
append
(
" ORDER BY UPPER(a.FULL_NAME)"
);
SQLQuery
query
=
session
.
createSQLQuery
(
sqlStrBuilder
.
toString
());
query
.
setParameter
(
"p_company_site_id"
,
companySiteId
);
query
.
setParameter
(
"p_campaign_id"
,
campaignId
);
if
(!
DataUtil
.
isNullOrEmpty
(
userName
))
{
query
.
setParameter
(
"p_user_name"
,
"%"
+
...
...
src/main/java/com/viettel/campaign/web/rest/AgentsController.java
View file @
82b23ea9
...
...
@@ -33,8 +33,8 @@ public class AgentsController {
@GetMapping
(
"/findAll"
)
@ResponseBody
public
ResponseEntity
<
ResultDTO
>
listAgentByCompanySiteId
(
@RequestParam
(
"page"
)
int
page
,
@RequestParam
(
"pageSize"
)
int
pageSize
,
@RequestParam
(
"companySiteId"
)
Long
companySiteId
)
{
ResultDTO
result
=
agentsService
.
getAllAgentByCompanySiteId
(
page
,
pageSize
,
companySiteId
);
public
ResponseEntity
<
ResultDTO
>
listAgentByCompanySiteId
(
@RequestParam
(
"page"
)
int
page
,
@RequestParam
(
"pageSize"
)
int
pageSize
,
@RequestParam
(
"companySiteId"
)
Long
companySiteId
,
@RequestParam
(
"campaignId"
)
Long
campaignId
)
{
ResultDTO
result
=
agentsService
.
getAllAgentByCompanySiteId
(
page
,
pageSize
,
companySiteId
,
campaignId
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
...
...
@@ -63,8 +63,8 @@ public class AgentsController {
@GetMapping
(
"/searchCampaignAgent"
)
@ResponseBody
public
ResponseEntity
<
ResultDTO
>
searchCampaignAgent
(
@RequestParam
(
"page"
)
int
page
,
@RequestParam
(
"pageSize"
)
int
pageSize
,
@RequestParam
(
"companySiteId"
)
Long
companySiteId
,
@RequestParam
(
"userName"
)
String
userName
,
@RequestParam
(
"fullName"
)
String
fullName
)
{
ResultDTO
result
=
agentsService
.
searchCampaignAgentByName
(
page
,
pageSize
,
companySiteId
,
userName
,
fullName
);
public
ResponseEntity
<
ResultDTO
>
searchCampaignAgent
(
@RequestParam
(
"page"
)
int
page
,
@RequestParam
(
"pageSize"
)
int
pageSize
,
@RequestParam
(
"c
ampaignId"
)
Long
campaignId
,
@RequestParam
(
"c
ompanySiteId"
)
Long
companySiteId
,
@RequestParam
(
"userName"
)
String
userName
,
@RequestParam
(
"fullName"
)
String
fullName
)
{
ResultDTO
result
=
agentsService
.
searchCampaignAgentByName
(
page
,
pageSize
,
c
ampaignId
,
c
ompanySiteId
,
userName
,
fullName
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
...
...
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