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
e289c51c
Commit
e289c51c
authored
Sep 05, 2019
by
=
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hungtt-commit fix bug individual customer
parent
17f6c980
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
20 deletions
+25
-20
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignRepositoryImpl.java
...ign/repository/ccms_full/impl/CampaignRepositoryImpl.java
+3
-4
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
...om/viettel/campaign/service/impl/CustomerServiceImpl.java
+20
-15
src/main/java/com/viettel/campaign/web/dto/CampaignCustomerDTO.java
...ava/com/viettel/campaign/web/dto/CampaignCustomerDTO.java
+1
-1
src/main/java/com/viettel/campaign/web/dto/request_dto/CampaignRequestDTO.java
...ttel/campaign/web/dto/request_dto/CampaignRequestDTO.java
+1
-0
No files found.
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignRepositoryImpl.java
View file @
e289c51c
...
...
@@ -605,8 +605,6 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
List
<
CustomerListDTO
>
list
=
new
ArrayList
();
ResultDTO
resultDTO
=
new
ResultDTO
();
Map
<
String
,
String
>
params
=
new
HashMap
<>();
// StringBuilder sb = new StringBuilder();
try
{
// String sql = SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_MNG, "get-list-campaign-customer");
String
sql
=
"with campaign_customer_id as (\n"
+
...
...
@@ -740,8 +738,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
sb
.
append
(
" where a.status = 1"
);
sb
.
append
(
" and (:p_cus_list_code is null or upper(a.customer_list_code) like '%'||:p_cus_list_code||'%')"
);
sb
.
append
(
" and (:p_cus_list_name is null or upper(a.customer_list_name) like '%'||:p_cus_list_name||'%')"
);
sb
.
append
(
" and (:p_to_date is null or (
a.create_at
<= to_date(:p_to_date, 'DD/MM/YYYY')))"
);
sb
.
append
(
" and (:p_from_date is null or (
a.create_at
>= to_date(:p_from_date, 'DD/MM/YYYY')))"
);
sb
.
append
(
" and (:p_to_date is null or (
(a.create_at + :p_time_zone_offset/24)
<= to_date(:p_to_date, 'DD/MM/YYYY')))"
);
sb
.
append
(
" and (:p_from_date is null or (
(a.create_at + :p_time_zone_offset/24)
>= to_date(:p_from_date, 'DD/MM/YYYY')))"
);
sb
.
append
(
" and (a.company_site_id = :p_company_site_id)"
);
sb
.
append
(
" and (a.customer_list_id not in (select CUSTOMER_LIST_ID from campaign_customer_id))"
);
sb
.
append
(
" ),"
);
...
...
@@ -762,6 +760,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
query
.
setParameter
(
"p_from_date"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getCreateTimeFr
())
?
null
:
dto
.
getCreateTimeFr
());
query
.
setParameter
(
"p_page_number"
,
dto
.
getPage
());
query
.
setParameter
(
"p_page_size"
,
dto
.
getPageSize
());
query
.
setParameter
(
"p_time_zone_offset"
,
dto
.
getTimezoneOffset
());
query
.
addScalar
(
"customerListId"
,
new
LongType
());
query
.
addScalar
(
"customerListCode"
,
new
StringType
());
...
...
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
View file @
e289c51c
...
...
@@ -1948,43 +1948,43 @@ public class CustomerServiceImpl implements CustomerService {
sb
.
append
(
" AND C.customer_id not in (select customer_id from campaign_customer where campaign_id = :p_campaign_id) "
);
List
<
CustomerQueryDTO
>
customerDTOList
=
campaignCustomerDTO
.
getListQuery
();
if
(
customerDTOList
.
get
(
0
).
getField
()
>
0
)
{
if
(
customerDTOList
.
get
(
0
).
getField
()
>
0
)
{
// field dong
switch
(
customerDTOList
.
get
(
0
).
getType
())
{
case
"combobox"
:
sb
.
append
(
"and (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
0
).
getField
()
+
" and cfo.field_option_value_id "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
""
+
customerDTOList
.
get
(
0
).
getCondition
()
+
")"
);
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
()
+
"%')"
);
sb
.
append
(
"and (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
0
).
getField
()
+
" and cfo.value_text "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" '%"
+
customerDTOList
.
get
(
0
).
getCondition
()
.
trim
()
+
"%')"
);
}
else
{
sb
.
append
(
"and (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
0
).
getField
()
+
" and cfo.value_text "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
"
"
+
customerDTOList
.
get
(
0
).
getCondition
()
+
"
)"
);
sb
.
append
(
"and (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
0
).
getField
()
+
" and cfo.value_text "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
"
'"
+
customerDTOList
.
get
(
0
).
getCondition
().
trim
()
+
"'
)"
);
}
break
;
case
"date"
:
sb
.
append
(
"and (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
0
).
getField
()
+
" and
cfo.value_date "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" to_date("
+
customerDTOList
.
get
(
0
).
getCondition
()
+
"
, 'DD/MM/YYYY'))"
);
sb
.
append
(
"and (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
0
).
getField
()
+
" and
(cfo.value_date +"
+
campaignCustomerDTO
.
getTimezoneOffset
()
+
"/24)"
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" to_date('"
+
customerDTOList
.
get
(
0
).
getCondition
().
trim
()
+
"'
, 'DD/MM/YYYY'))"
);
break
;
case
"number"
:
sb
.
append
(
"and (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
0
).
getField
()
+
" and cfo.value_number "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" "
+
customerDTOList
.
get
(
0
).
getCondition
()
+
")"
);
break
;
case
"checkbox"
:
sb
.
append
(
"and (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
0
).
getField
()
+
" and cfo.value_checkbox "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" "
+
customerDTOList
.
get
(
0
).
getCondition
(
)
+
")"
);
sb
.
append
(
"and (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
0
).
getField
()
+
" and cfo.value_checkbox "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" "
+
(
"true"
.
equals
(
customerDTOList
.
get
(
0
).
getCondition
())
?
"1"
:
"0"
)
+
")"
);
break
;
}
}
else
{
}
else
{
// field tinh
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
()
+
"%')"
);
sb
.
append
(
"and (
"
+
requestCustomer
.
get
(
customerDTOList
.
get
(
0
).
getField
().
toString
())
+
"
"
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" '%"
+
customerDTOList
.
get
(
0
).
getCondition
()
+
"%')"
);
}
else
{
sb
.
append
(
"and
"
+
requestCustomer
.
get
(
customerDTOList
.
get
(
0
).
getField
().
toString
())
+
" "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" "
+
customerDTOList
.
get
(
0
).
getCondition
()
);
sb
.
append
(
"and
("
+
requestCustomer
.
get
(
customerDTOList
.
get
(
0
).
getField
().
toString
())
+
" "
+
customerDTOList
.
get
(
0
).
getOperator
()
+
" "
+
customerDTOList
.
get
(
0
).
getCondition
()
+
")"
);
}
}
for
(
int
i
=
1
;
i
<
campaignCustomerDTO
.
getListQuery
().
size
();
i
++)
{
if
(
customerDTOList
.
get
(
i
).
getField
()
<
0
)
{
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("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
())
+
" "
+
customerDTOList
.
get
(
i
).
getOperator
()
+
" "
+
"'%"
+
customerDTOList
.
get
(
i
).
getCondition
()
+
"%' "
);
+
"'%"
+
customerDTOList
.
get
(
i
).
getCondition
().
trim
()
+
"%' "
);
}
else
{
sb
.
append
(
" "
+
customerDTOList
.
get
(
i
).
getJoin
()
+
" "
+
requestCustomer
.
get
(
customerDTOList
.
get
(
i
).
getField
().
toString
())
+
" "
...
...
@@ -1994,19 +1994,24 @@ public class CustomerServiceImpl implements CustomerService {
}
else
{
switch
(
customerDTOList
.
get
(
i
).
getType
())
{
case
"combobox"
:
sb
.
append
(
"and
(cfo.customize_fields_id ="
+
customerDTOList
.
get
(
i
).
getField
()
+
" and cfo.field_option_value_id "
+
customerDTOList
.
get
(
i
).
getOperator
()
+
" "
+
customerDTOList
.
get
(
i
).
getCondition
()
+
")"
);
sb
.
append
(
customerDTOList
.
get
(
i
).
getJoin
()
+
"
(cfo.customize_fields_id ="
+
customerDTOList
.
get
(
i
).
getField
()
+
" and cfo.field_option_value_id "
+
customerDTOList
.
get
(
i
).
getOperator
()
+
" "
+
customerDTOList
.
get
(
i
).
getCondition
()
+
")"
);
break
;
case
"text"
:
sb
.
append
(
"and (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
i
).
getField
()
+
" and cfo.value_text "
+
customerDTOList
.
get
(
i
).
getOperator
()
+
" %'"
+
customerDTOList
.
get
(
i
).
getCondition
()
+
"%')"
);
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
()
+
"%')"
);
}
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
()
+
"')"
);
}
// sb.append("and (cfo.customize_fields_id =" + customerDTOList.get(i).getField() + " and cfo.value_text " + customerDTOList.get(i).getOperator() + " %'" + customerDTOList.get(i).getCondition() + "%')");
break
;
case
"date"
:
sb
.
append
(
"and (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
i
).
getField
()
+
" and cfo.value_date "
+
customerDTOList
.
get
(
i
).
getOperator
()
+
" "
+
customerDTOList
.
get
(
i
).
getCondition
()
+
"
)"
);
sb
.
append
(
customerDTOList
.
get
(
i
).
getJoin
()
+
" (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
i
).
getField
()
+
" and (cfo.value_date + "
+
campaignCustomerDTO
.
getTimezoneOffset
()
+
"/24)"
+
customerDTOList
.
get
(
i
).
getOperator
()
+
" to_date('"
+
customerDTOList
.
get
(
i
).
getCondition
().
trim
()
+
"', 'DD/MM/YYYY')
)"
);
break
;
case
"number"
:
sb
.
append
(
"and
(cfo.customize_fields_id ="
+
customerDTOList
.
get
(
i
).
getField
()
+
" and cfo.value_number "
+
customerDTOList
.
get
(
i
).
getOperator
()
+
" "
+
customerDTOList
.
get
(
i
).
getCondition
()
+
")"
);
sb
.
append
(
customerDTOList
.
get
(
i
).
getJoin
()
+
"
(cfo.customize_fields_id ="
+
customerDTOList
.
get
(
i
).
getField
()
+
" and cfo.value_number "
+
customerDTOList
.
get
(
i
).
getOperator
()
+
" "
+
customerDTOList
.
get
(
i
).
getCondition
()
+
")"
);
break
;
case
"checkbox"
:
sb
.
append
(
"and (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
i
).
getField
()
+
" and cfo.value_checkbox "
+
customerDTOList
.
get
(
i
).
getOperator
()
+
" "
+
customerDTOList
.
get
(
i
).
getCondition
(
)
+
")"
);
sb
.
append
(
customerDTOList
.
get
(
i
).
getJoin
()
+
" (cfo.customize_fields_id ="
+
customerDTOList
.
get
(
i
).
getField
()
+
" and cfo.value_checkbox "
+
customerDTOList
.
get
(
i
).
getOperator
()
+
" "
+
(
"true"
.
equals
(
customerDTOList
.
get
(
i
).
getCondition
())
?
"1"
:
"0"
)
+
")"
);
break
;
}
}
...
...
src/main/java/com/viettel/campaign/web/dto/CampaignCustomerDTO.java
View file @
e289c51c
...
...
@@ -31,5 +31,5 @@ public class CampaignCustomerDTO extends BaseDTO{
private
String
lstCustomerId
;
private
List
<
CustomerQueryDTO
>
listQuery
;
private
Long
field
;
private
Integer
timezoneOffset
;
}
src/main/java/com/viettel/campaign/web/dto/request_dto/CampaignRequestDTO.java
View file @
e289c51c
...
...
@@ -58,4 +58,5 @@ public class CampaignRequestDTO extends BaseDTO {
String
customerListId
;
String
statuses
;
String
channels
;
Integer
timezoneOffset
;
}
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