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
f7f1e07f
Commit
f7f1e07f
authored
Sep 13, 2019
by
Tu Bach
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://git.myitsol.com/hanv/service-campaign
parents
e74f684b
eabbff67
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
...om/viettel/campaign/service/impl/CustomerServiceImpl.java
+12
-12
No files found.
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
View file @
f7f1e07f
...
...
@@ -789,6 +789,7 @@ public class CustomerServiceImpl implements CustomerService {
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
searchCustomerList
(
SearchCustomerRequestDTO
searchCustomerRequestDTO
)
{
LOGGER
.
info
(
"=== Start search customer list::"
);
TimeZone
tzClient
=
TimeZoneUtils
.
getZoneMinutes
((
long
)
searchCustomerRequestDTO
.
getTimezoneOffset
());
ResultDTO
resultDTO
=
new
ResultDTO
();
SessionFactory
sessionFactory
=
HibernateUtil
.
getSessionFactory
();
...
...
@@ -905,6 +906,8 @@ public class CustomerServiceImpl implements CustomerService {
}
catch
(
Exception
e
)
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
LOGGER
.
error
(
e
.
getMessage
(),
e
);
}
finally
{
if
(
session
!=
null
)
session
.
close
();
}
...
...
@@ -2263,18 +2266,15 @@ public class CustomerServiceImpl implements CustomerService {
sb
.
append
(
" c.current_address currentAddress,"
);
sb
.
append
(
" c.Description description"
);
sb
.
append
(
" FROM CUSTOMER C"
);
sb
.
append
(
"
inner
join (SELECT CUSTOMER_ID, LISTAGG(CONTACT, ', ') WITHIN GROUP (ORDER BY "
);
sb
.
append
(
"
left
join (SELECT CUSTOMER_ID, LISTAGG(CONTACT, ', ') WITHIN GROUP (ORDER BY "
);
sb
.
append
(
" NULL) AS CONTACT"
);
sb
.
append
(
" FROM CUSTOMER_CONTACT WHERE CONTACT_TYPE = 5 AND STATUS = 1 GROUP BY "
);
sb
.
append
(
" CUSTOMER_ID) cc on c.CUSTOMER_ID = cc.CUSTOMER_ID"
);
sb
.
append
(
"
inner
join (SELECT CUSTOMER_ID, LISTAGG(CONTACT, ', ') WITHIN GROUP (ORDER BY "
);
sb
.
append
(
"
left
join (SELECT CUSTOMER_ID, LISTAGG(CONTACT, ', ') WITHIN GROUP (ORDER BY "
);
sb
.
append
(
" NULL) AS CONTACT"
);
sb
.
append
(
" FROM CUSTOMER_CONTACT WHERE CONTACT_TYPE = 2 AND STATUS = 1 GROUP BY "
);
sb
.
append
(
" CUSTOMER_ID) cc2 on cc2.CUSTOMER_ID = c.CUSTOMER_ID "
);
// sb.append(" INNER JOIN CUSTOMER_contact cc ON (C.CUSTOMER_ID = Cc.customer_id " +
// "and cc.status = 1 and cc.contact_type = 5)");
// sb.append(" INNER JOIN CUSTOMER_contact Cc2 ON (C.CUSTOMER_ID = Cc2.customer_id and cc2.status = 1 and cc2.contact_type = 2)");
sb
.
append
(
"inner join customize_field_object cfo on c.customer_id = cfo.object_id and cfo.status = 1"
);
sb
.
append
(
" left join customize_field_object cfo on c.customer_id = cfo.object_id and cfo.status = 1"
);
sb
.
append
(
" AND C.STATUS = 1"
);
sb
.
append
(
" AND C.customer_id not in (select customer_id from campaign_customer where campaign_id = :p_campaign_id) "
);
sb
.
append
(
" where 1 = 1 "
);
...
...
@@ -2287,7 +2287,7 @@ public class CustomerServiceImpl implements CustomerService {
break
;
case
"text"
:
if
(
"like"
.
equals
(
customerDTOList
.
get
(
0
).
getOperator
())
||
"not like"
.
equals
(
customerDTOList
.
get
(
0
).
getOperator
()))
{
sb
.
append
(
"and (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
0
).
getField
()
+
" and
cfo.value_text "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" '%"
+
customerDTOList
.
get
(
0
).
getCondition
().
trim
().
replace
(
"\\"
,
"\\\\"
).
replaceAll
(
"%"
,
"\\%"
).
replaceAll
(
"_"
,
"\\_"
)
+
"%')"
);
sb
.
append
(
"and (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
0
).
getField
()
+
" and
upper(cfo.value_text) "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" '%"
+
customerDTOList
.
get
(
0
).
getCondition
().
trim
().
replace
(
"\\"
,
"\\\\"
).
replaceAll
(
"%"
,
"\\%"
).
replaceAll
(
"_"
,
"\\_"
).
toUpperCase
(
)
+
"%')"
);
}
else
{
sb
.
append
(
"and (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
0
).
getField
()
+
" and cfo.value_text "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" '"
+
customerDTOList
.
get
(
0
).
getCondition
().
trim
().
replace
(
"\\"
,
"\\\\"
).
replaceAll
(
"%"
,
"\\%"
).
replaceAll
(
"_"
,
"\\_"
)
+
"')"
);
}
...
...
@@ -2304,7 +2304,7 @@ public class CustomerServiceImpl implements CustomerService {
}
}
else
{
// field tinh
if
(
"like"
.
equals
(
customerDTOList
.
get
(
0
).
getOperator
())
||
"not like"
.
equals
(
customerDTOList
.
get
(
0
).
getOperator
()))
{
sb
.
append
(
"and (
"
+
requestCustomer
.
get
(
customerDTOList
.
get
(
0
).
getField
().
toString
())
+
" "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" '%"
+
customerDTOList
.
get
(
0
).
getCondition
().
trim
().
replace
(
"\\"
,
"\\\\"
).
replaceAll
(
"%"
,
"\\%"
).
replaceAll
(
"_"
,
"\\_"
)
+
"%')"
);
sb
.
append
(
"and (
upper("
+
requestCustomer
.
get
(
customerDTOList
.
get
(
0
).
getField
().
toString
())
+
") "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" '%"
+
customerDTOList
.
get
(
0
).
getCondition
().
trim
().
replace
(
"\\"
,
"\\\\"
).
replaceAll
(
"%"
,
"\\%"
).
replaceAll
(
"_"
,
"\\_"
).
toUpperCase
(
)
+
"%')"
);
}
else
if
(
customerDTOList
.
get
(
0
).
getField
()
==
-
8
||
customerDTOList
.
get
(
0
).
getField
()
==
-
9
)
{
sb
.
append
(
"and ("
+
requestCustomer
.
get
(
customerDTOList
.
get
(
0
).
getField
().
toString
())
+
" "
+
(
"="
.
equals
(
customerDTOList
.
get
(
0
).
getOperator
())
?
"like "
:
"not like"
)
+
" '%"
+
customerDTOList
.
get
(
0
).
getCondition
().
trim
().
replace
(
"\\"
,
"\\\\"
).
replaceAll
(
"%"
,
"\\%"
).
replaceAll
(
"_"
,
"\\_"
)
+
"%')"
);
}
else
{
...
...
@@ -2316,14 +2316,14 @@ public class CustomerServiceImpl implements CustomerService {
if
(
"like"
.
equals
(
customerDTOList
.
get
(
i
).
getOperator
())
||
"not like"
.
equals
(
customerDTOList
.
get
(
i
).
getOperator
()))
{
// sb.append("and (cfo.customize_fields_id =" + customerDTOList.get(i).getField() + " and cfo.value_text " + customerDTOList.get(i).getOperator() + " '%" + customerDTOList.get(i).getCondition() + "%')");
sb
.
append
(
" "
+
customerDTOList
.
get
(
i
).
getJoin
()
+
" ("
+
requestCustomer
.
get
(
customerDTOList
.
get
(
i
).
getField
().
toString
())
+
"
"
+
"upper("
+
requestCustomer
.
get
(
customerDTOList
.
get
(
i
).
getField
().
toString
())
+
")
"
+
customerDTOList
.
get
(
i
).
getOperator
()
+
" "
+
"'%"
+
customerDTOList
.
get
(
i
).
getCondition
().
trim
().
replace
(
"\\"
,
"\\\\"
).
replaceAll
(
"%"
,
"\\%"
).
replaceAll
(
"_"
,
"\\_"
)
+
"%' )"
);
+
"'%"
+
customerDTOList
.
get
(
i
).
getCondition
().
trim
().
replace
(
"\\"
,
"\\\\"
).
replaceAll
(
"%"
,
"\\%"
).
replaceAll
(
"_"
,
"\\_"
)
.
toUpperCase
()
+
"%' )"
);
}
else
if
(
customerDTOList
.
get
(
i
).
getField
()
==
-
8
||
customerDTOList
.
get
(
i
).
getField
()
==
-
9
)
{
sb
.
append
(
" "
+
customerDTOList
.
get
(
i
).
getJoin
()
+
" ("
+
requestCustomer
.
get
(
customerDTOList
.
get
(
i
).
getField
().
toString
())
+
" "
+
(
"="
.
equals
(
customerDTOList
.
get
(
i
).
getOperator
())
?
"like"
:
"not like"
)
+
" '%"
+
customerDTOList
.
get
(
i
).
getCondition
().
replace
(
"\\"
,
"\\\\"
).
replaceAll
(
"%"
,
"\\%"
).
replaceAll
(
"_"
,
"\\_"
)
+
"%' )"
);
+
customerDTOList
.
get
(
i
).
getCondition
().
replace
(
"\\"
,
"\\\\"
).
replaceAll
(
"%"
,
"\\%"
).
replaceAll
(
"_"
,
"\\_"
)
.
toUpperCase
()
+
"%' )"
);
}
else
{
sb
.
append
(
" "
+
customerDTOList
.
get
(
i
).
getJoin
()
+
" ("
+
requestCustomer
.
get
(
customerDTOList
.
get
(
i
).
getField
().
toString
())
+
" "
...
...
@@ -2337,7 +2337,7 @@ public class CustomerServiceImpl implements CustomerService {
break
;
case
"text"
:
if
(
"like"
.
equals
(
customerDTOList
.
get
(
i
).
getOperator
())
||
"not like"
.
equals
(
customerDTOList
.
get
(
i
).
getOperator
()))
{
sb
.
append
(
customerDTOList
.
get
(
i
).
getJoin
()
+
" (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
0
).
getField
()
+
" and
cfo.value_text "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" '%"
+
customerDTOList
.
get
(
0
).
getCondition
().
trim
().
replace
(
"\\"
,
"\\\\"
).
replaceAll
(
"%"
,
"\\%"
).
replaceAll
(
"_"
,
"\\_"
)
+
"%')"
);
sb
.
append
(
customerDTOList
.
get
(
i
).
getJoin
()
+
" (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
0
).
getField
()
+
" and
upper(cfo.value_text) "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" '%"
+
customerDTOList
.
get
(
0
).
getCondition
().
trim
().
replace
(
"\\"
,
"\\\\"
).
replaceAll
(
"%"
,
"\\%"
).
replaceAll
(
"_"
,
"\\_"
).
toUpperCase
(
)
+
"%')"
);
}
else
{
sb
.
append
(
customerDTOList
.
get
(
i
).
getJoin
()
+
" (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
0
).
getField
()
+
" and cfo.value_text "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" '"
+
customerDTOList
.
get
(
0
).
getCondition
().
trim
().
replace
(
"\\"
,
"\\\\"
).
replaceAll
(
"%"
,
"\\%"
).
replaceAll
(
"_"
,
"\\_"
)
+
"')"
);
}
...
...
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