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
9e99b655
Commit
9e99b655
authored
Aug 09, 2019
by
Phạm Duy Phi
Browse files
Options
Browse Files
Download
Plain Diff
commit
parents
2cbe3756
9df5481c
Changes
35
Show whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
558 additions
and
232 deletions
+558
-232
.mvn/wrapper/MavenWrapperDownloader.java
.mvn/wrapper/MavenWrapperDownloader.java
+0
-114
.mvn/wrapper/maven-wrapper.jar
.mvn/wrapper/maven-wrapper.jar
+0
-0
.mvn/wrapper/maven-wrapper.properties
.mvn/wrapper/maven-wrapper.properties
+0
-1
lib/ojdbc6-11.2.0.3.jar
lib/ojdbc6-11.2.0.3.jar
+0
-0
src/main/java/com/viettel/campaign/repository/CampaignCompleteCodeRepository.java
...l/campaign/repository/CampaignCompleteCodeRepository.java
+4
-4
src/main/java/com/viettel/campaign/repository/CampaignCompleteCodeRepositoryCustom.java
...aign/repository/CampaignCompleteCodeRepositoryCustom.java
+1
-0
src/main/java/com/viettel/campaign/repository/CampaignCustomerRepository.java
...ettel/campaign/repository/CampaignCustomerRepository.java
+14
-0
src/main/java/com/viettel/campaign/repository/CampaignRepository.java
...a/com/viettel/campaign/repository/CampaignRepository.java
+3
-0
src/main/java/com/viettel/campaign/repository/CustomerContactRepository.java
...iettel/campaign/repository/CustomerContactRepository.java
+5
-1
src/main/java/com/viettel/campaign/repository/CustomerListRepository.java
...m/viettel/campaign/repository/CustomerListRepository.java
+1
-0
src/main/java/com/viettel/campaign/repository/UserActionLogRepositoryCustom.java
...el/campaign/repository/UserActionLogRepositoryCustom.java
+13
-0
src/main/java/com/viettel/campaign/repository/impl/CampaignExecuteRepositoryImp.java
...ampaign/repository/impl/CampaignExecuteRepositoryImp.java
+82
-19
src/main/java/com/viettel/campaign/repository/impl/TicketRepositoryImpl.java
...iettel/campaign/repository/impl/TicketRepositoryImpl.java
+1
-1
src/main/java/com/viettel/campaign/repository/impl/UserActionLogRepositoryImpl.java
...campaign/repository/impl/UserActionLogRepositoryImpl.java
+59
-0
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/CustomerService.java
...in/java/com/viettel/campaign/service/CustomerService.java
+15
-0
src/main/java/com/viettel/campaign/service/UserActionLogService.java
...va/com/viettel/campaign/service/UserActionLogService.java
+8
-0
src/main/java/com/viettel/campaign/service/impl/CampaignCompleteCodeServiceImpl.java
...ampaign/service/impl/CampaignCompleteCodeServiceImpl.java
+77
-37
src/main/java/com/viettel/campaign/service/impl/CampaignServiceImpl.java
...om/viettel/campaign/service/impl/CampaignServiceImpl.java
+47
-8
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
...om/viettel/campaign/service/impl/CustomerServiceImpl.java
+67
-17
src/main/java/com/viettel/campaign/service/impl/UserActionLogServiceImpl.java
...ettel/campaign/service/impl/UserActionLogServiceImpl.java
+14
-0
src/main/java/com/viettel/campaign/web/dto/CampaignDTO.java
src/main/java/com/viettel/campaign/web/dto/CampaignDTO.java
+1
-0
src/main/java/com/viettel/campaign/web/dto/ContactCustResultDTO.java
...va/com/viettel/campaign/web/dto/ContactCustResultDTO.java
+1
-1
src/main/java/com/viettel/campaign/web/dto/CustomerContactDTO.java
...java/com/viettel/campaign/web/dto/CustomerContactDTO.java
+1
-1
src/main/java/com/viettel/campaign/web/dto/UserActionLogDTO.java
...n/java/com/viettel/campaign/web/dto/UserActionLogDTO.java
+23
-0
src/main/java/com/viettel/campaign/web/rest/CampaignCompleteCodeController.java
...tel/campaign/web/rest/CampaignCompleteCodeController.java
+2
-1
src/main/java/com/viettel/campaign/web/rest/controller/CampaignController.java
...ttel/campaign/web/rest/controller/CampaignController.java
+22
-2
src/main/java/com/viettel/campaign/web/rest/controller/CustomerController.java
...ttel/campaign/web/rest/controller/CustomerController.java
+23
-2
src/main/resources/i18n/language_en.properties
src/main/resources/i18n/language_en.properties
+14
-14
src/main/resources/sql/campaign-execute/get-combo-campaign-type.sql
...esources/sql/campaign-execute/get-combo-campaign-type.sql
+1
-1
src/main/resources/sql/campaign-execute/get-execute-interactive.sql
...esources/sql/campaign-execute/get-execute-interactive.sql
+2
-7
src/main/resources/sql/campaign-mng/insert-to-user-action-log.sql
.../resources/sql/campaign-mng/insert-to-user-action-log.sql
+18
-0
src/main/resources/sql/campaign-mng/search-customer-list-info-from-customer-list.sql
...aign-mng/search-customer-list-info-from-customer-list.sql
+34
-0
src/main/resources/sql/campaign-status-mng/get-max-value-completevalue.sql
...s/sql/campaign-status-mng/get-max-value-completevalue.sql
+1
-0
src/main/resources/sql/campaign-status-mng/search-campaign-status-by-params.sql
.../campaign-status-mng/search-campaign-status-by-params.sql
+2
-1
No files found.
.mvn/wrapper/MavenWrapperDownloader.java
deleted
100644 → 0
View file @
2cbe3756
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.net.URL
;
import
java.nio.channels.Channels
;
import
java.nio.channels.ReadableByteChannel
;
import
java.util.Properties
;
public
class
MavenWrapperDownloader
{
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private
static
final
String
DEFAULT_DOWNLOAD_URL
=
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
;
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private
static
final
String
MAVEN_WRAPPER_PROPERTIES_PATH
=
".mvn/wrapper/maven-wrapper.properties"
;
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private
static
final
String
MAVEN_WRAPPER_JAR_PATH
=
".mvn/wrapper/maven-wrapper.jar"
;
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private
static
final
String
PROPERTY_NAME_WRAPPER_URL
=
"wrapperUrl"
;
public
static
void
main
(
String
args
[])
{
System
.
out
.
println
(
"- Downloader started"
);
File
baseDirectory
=
new
File
(
args
[
0
]);
System
.
out
.
println
(
"- Using base directory: "
+
baseDirectory
.
getAbsolutePath
());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File
mavenWrapperPropertyFile
=
new
File
(
baseDirectory
,
MAVEN_WRAPPER_PROPERTIES_PATH
);
String
url
=
DEFAULT_DOWNLOAD_URL
;
if
(
mavenWrapperPropertyFile
.
exists
())
{
FileInputStream
mavenWrapperPropertyFileInputStream
=
null
;
try
{
mavenWrapperPropertyFileInputStream
=
new
FileInputStream
(
mavenWrapperPropertyFile
);
Properties
mavenWrapperProperties
=
new
Properties
();
mavenWrapperProperties
.
load
(
mavenWrapperPropertyFileInputStream
);
url
=
mavenWrapperProperties
.
getProperty
(
PROPERTY_NAME_WRAPPER_URL
,
url
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"- ERROR loading '"
+
MAVEN_WRAPPER_PROPERTIES_PATH
+
"'"
);
}
finally
{
try
{
if
(
mavenWrapperPropertyFileInputStream
!=
null
)
{
mavenWrapperPropertyFileInputStream
.
close
();
}
}
catch
(
IOException
e
)
{
// Ignore ...
}
}
}
System
.
out
.
println
(
"- Downloading from: : "
+
url
);
File
outputFile
=
new
File
(
baseDirectory
.
getAbsolutePath
(),
MAVEN_WRAPPER_JAR_PATH
);
if
(!
outputFile
.
getParentFile
().
exists
())
{
if
(!
outputFile
.
getParentFile
().
mkdirs
())
{
System
.
out
.
println
(
"- ERROR creating output direcrory '"
+
outputFile
.
getParentFile
().
getAbsolutePath
()
+
"'"
);
}
}
System
.
out
.
println
(
"- Downloading to: "
+
outputFile
.
getAbsolutePath
());
try
{
downloadFileFromURL
(
url
,
outputFile
);
System
.
out
.
println
(
"Done"
);
System
.
exit
(
0
);
}
catch
(
Throwable
e
)
{
System
.
out
.
println
(
"- Error downloading"
);
e
.
printStackTrace
();
System
.
exit
(
1
);
}
}
private
static
void
downloadFileFromURL
(
String
urlString
,
File
destination
)
throws
Exception
{
URL
website
=
new
URL
(
urlString
);
ReadableByteChannel
rbc
;
rbc
=
Channels
.
newChannel
(
website
.
openStream
());
FileOutputStream
fos
=
new
FileOutputStream
(
destination
);
fos
.
getChannel
().
transferFrom
(
rbc
,
0
,
Long
.
MAX_VALUE
);
fos
.
close
();
rbc
.
close
();
}
}
.mvn/wrapper/maven-wrapper.jar
deleted
100644 → 0
View file @
2cbe3756
File deleted
.mvn/wrapper/maven-wrapper.properties
deleted
100644 → 0
View file @
2cbe3756
distributionUrl
=
https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip
lib/ojdbc6-11.2.0.3.jar
deleted
100644 → 0
View file @
2cbe3756
File deleted
src/main/java/com/viettel/campaign/repository/CampaignCompleteCodeRepository.java
View file @
9e99b655
...
...
@@ -23,12 +23,12 @@ public interface CampaignCompleteCodeRepository extends JpaRepository<CampaignCo
List
<
CampaignCompleteCode
>
findByCompleteNameContains
(
String
name
,
Pageable
pageable
);
@Modifying
@Query
(
"
delete from CampaignCompleteCode c
where c.campaignCompleteCodeId in (:ids)"
)
@Query
(
"
update CampaignCompleteCode c set c.status = 0
where c.campaignCompleteCodeId in (:ids)"
)
int
deleteds
(
@Param
(
"ids"
)
List
<
Long
>
ids
);
// @Query(value="SELECT
max(completeValue) FROM CampaignCompleteCode WHERE companySiteId = :companySiteId GROUP BY companySiteId")
//
Short findByMaxCompanySiteId(Long companySiteId);
List
<
CampaignCompleteCode
>
findCampaignCompleteCodesByCompanySiteId
(
Long
companySiteId
);
@Query
(
value
=
"SELECT
max(completeValue) FROM CampaignCompleteCode WHERE companySiteId = :companySiteId GROUP BY companySiteId"
)
Short
findByMaxCompanySiteId
(
Long
companySiteId
);
//
List<CampaignCompleteCode> findCampaignCompleteCodesByCompanySiteId(Long companySiteId);
// List<CampaignCompleteCode> findByCampaignIdContainsAndChanel(Long campaignId, String chanel);
}
src/main/java/com/viettel/campaign/repository/CampaignCompleteCodeRepositoryCustom.java
View file @
9e99b655
...
...
@@ -7,4 +7,5 @@ public interface CampaignCompleteCodeRepositoryCustom {
ResultDTO
updateStatusById
(
Long
id
);
ResultDTO
findMaxValueCampaignType
(
Long
companySiteId
);
}
src/main/java/com/viettel/campaign/repository/CampaignCustomerRepository.java
0 → 100644
View file @
9e99b655
package
com.viettel.campaign.repository
;
import
com.viettel.campaign.model.CampaignCustomer
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.repository.query.Param
;
public
interface
CampaignCustomerRepository
extends
JpaRepository
<
CampaignCustomer
,
Long
>
{
@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
)
Long
getCustomerRecall
(
@Param
(
"campaignId"
)
Long
campaignId
,
@Param
(
"customerId"
)
Long
customerId
);
}
src/main/java/com/viettel/campaign/repository/CampaignRepository.java
View file @
9e99b655
...
...
@@ -19,5 +19,8 @@ public interface CampaignRepository extends JpaRepository<Campaign, Long>, Campa
" AND cc.agentId = :pAgentId"
)
Long
countRecallCustomer
(
@Param
(
"pCompanySiteId"
)
Long
pCompanySiteId
,
@Param
(
"pAgentId"
)
Long
pAgentId
);
Campaign
findByCampaignId
(
Long
campaignId
);
Campaign
findCampaignByCampaignIdAndCompanySiteId
(
Long
campaignId
,
Long
companySiteId
);
}
src/main/java/com/viettel/campaign/repository/CustomerContactRepository.java
View file @
9e99b655
package
com.viettel.campaign.repository
;
import
com.viettel.campaign.model.CustomerContact
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.repository.query.Param
;
import
java.util.List
;
public
interface
CustomerContactRepository
extends
JpaRepository
<
CustomerContact
,
Long
>
{
List
<
CustomerContact
>
findByCustomerIdAndAndContactTypeAndContact
(
Long
customerId
,
Short
contactType
,
String
contact
);
@Query
(
"FROM CustomerContact WHERE status = 1 AND customerId = :customerId AND contactType = :contactType AND (contact IS NULL OR UPPER(contact) LIKE UPPER(concat('%', :contact, '%')))"
)
List
<
CustomerContact
>
findByCustomerIdAndAndContactTypeAndContact
(
@Param
(
"customerId"
)
Long
customerId
,
@Param
(
"contactType"
)
Short
contactType
,
@Param
(
"contact"
)
String
contact
,
Pageable
pageable
);
}
src/main/java/com/viettel/campaign/repository/CustomerListRepository.java
View file @
9e99b655
package
com.viettel.campaign.repository
;
import
com.viettel.campaign.model.CustomerList
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
...
...
src/main/java/com/viettel/campaign/repository/UserActionLogRepositoryCustom.java
0 → 100644
View file @
9e99b655
package
com.viettel.campaign.repository
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.web.dto.UserActionLogDTO
;
/**
* @author anhvd_itsol
*/
public
interface
UserActionLogRepositoryCustom
{
ResultDTO
insertToUserActionLog
(
UserActionLogDTO
userActionLogDTO
);
}
src/main/java/com/viettel/campaign/repository/impl/CampaignExecuteRepositoryImp.java
View file @
9e99b655
...
...
@@ -43,12 +43,11 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
public
List
<
ApParamDTO
>
getComboBoxStatus
(
String
companySiteId
,
String
completeType
)
{
List
<
ApParamDTO
>
list
=
new
ArrayList
<>();
Map
<
String
,
String
>
params
=
new
HashMap
<>();
String
sql
=
SQLBuilder
.
getSqlQueryById
(
Constants
.
SQL_MODULES
.
MODULE_EXECUTE
,
"get-combo-
connect-
status"
);
String
sql
=
SQLBuilder
.
getSqlQueryById
(
Constants
.
SQL_MODULES
.
MODULE_EXECUTE
,
"get-combo-status"
);
try
{
params
.
put
(
"p_company_site_id"
,
companySiteId
);
params
.
put
(
"p_complete_type"
,
completeType
);
list
=
namedParameterJdbcTemplate
.
query
(
sql
,
params
,
BeanPropertyRowMapper
.
newInstance
(
ApParamDTO
.
class
));
// list = namedParameterJdbcTemplate.getJdbcTemplate().query(sql, (PreparedStatementSetter) params, BeanPropertyRowMapper.newInstance(ComboBoxDTO.class));
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
...
...
@@ -82,37 +81,69 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
String
sql
=
SQLBuilder
.
getSqlQueryById
(
Constants
.
SQL_MODULES
.
MODULE_EXECUTE
,
"get-execute-interactive"
);
sqlBuilder
.
append
(
sql
);
sqlBuilder
.
append
(
" and to_char(a.customer_id) like :p_customer_id"
);
sqlBuilder
.
append
(
" and to_char(a.contact_status) in (:p_list_contact_status)"
);
sqlBuilder
.
append
(
" and to_char(a.call_status) in (:p_list_survey_status)"
);
sqlBuilder
.
append
(
" and to_char(a.status) in (:p_list_record_status)"
);
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getPhoneNumber
()))
{
sqlBuilder
.
append
(
" and a.phone_number like :p_phone_number"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignId
()))
{
sqlBuilder
.
append
(
" and b.campaign_code in (:p_list_campaign_id) "
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignName
()))
{
sqlBuilder
.
append
(
" and upper(
campaignName) like upper(:p_campaign_name)
"
);
sqlBuilder
.
append
(
" and upper(
b.campaign_name) like :p_campaign_name
"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getAgentId
()))
{
sqlBuilder
.
append
(
" and upper(
userName) like upper(:p_user_name)
"
);
sqlBuilder
.
append
(
" and upper(
c.user_name) like :p_user_name
"
);
}
SQLQuery
query
=
session
.
createSQLQuery
(
sqlBuilder
.
toString
());
query
.
setParameterList
(
"p_list_campaign_id"
,
dto
.
getCampaignId
().
split
(
","
));
query
.
setParameter
(
"p_customer_id"
,
dto
.
getCustomerId
());
query
.
setParameter
(
"p_company_site_id"
,
dto
.
getCompanySiteId
());
query
.
setParameter
(
"p_customer_id"
,
"%"
+
dto
.
getCustomerId
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
query
.
setParameter
(
"p_date_from"
,
dto
.
getFromDate
());
query
.
setParameter
(
"p_date_to"
,
dto
.
getToDate
());
query
.
setParameterList
(
"p_list_contact_status"
,
dto
.
getContactStatus
().
split
(
","
));
query
.
setParameterList
(
"p_list_survey_status"
,
dto
.
getSurveyStatus
().
split
(
","
));
query
.
setParameterList
(
"p_list_record_status"
,
dto
.
getRecordStatus
().
split
(
","
));
query
.
setParameter
(
"p_phone_number"
,
dto
.
getPhoneNumber
());
query
.
setParameter
(
"p_call_time_from"
,
dto
.
getCallTimeFrom
());
query
.
setParameter
(
"p_call_time_to"
,
dto
.
getCallTimeTo
());
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignId
()))
{
query
.
setParameterList
(
"p_list_campaign_id"
,
dto
.
getCampaignId
().
split
(
","
));
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getPhoneNumber
()))
{
query
.
setParameter
(
"p_phone_number"
,
"%"
+
dto
.
getPhoneNumber
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignName
()))
{
query
.
setParameter
(
"p_campaign_name"
,
dto
.
getCampaignName
().
trim
());
query
.
setParameter
(
"p_campaign_name"
,
"%"
+
dto
.
getCampaignName
().
toUpperCase
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getAgentId
()))
{
query
.
setParameter
(
"p_user_name"
,
dto
.
getAgentId
().
trim
());
query
.
setParameter
(
"p_user_name"
,
"%"
+
dto
.
getAgentId
().
toUpperCase
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
}
query
.
addScalar
(
"campaignCode"
,
new
StringType
());
query
.
addScalar
(
"campaignName"
,
new
StringType
());
query
.
addScalar
(
"userName"
,
new
StringType
());
query
.
addScalar
(
"phoneNumber"
,
new
Lo
ngType
());
query
.
addScalar
(
"phoneNumber"
,
new
Stri
ngType
());
query
.
addScalar
(
"customerName"
,
new
StringType
());
query
.
addScalar
(
"createTime"
,
new
DateType
());
query
.
addScalar
(
"contactStatus"
,
new
StringType
());
...
...
@@ -156,9 +187,9 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
logger
.
error
(
e
.
getMessage
(),
e
);
}
finally
{
session
.
close
();
}
return
resultDTO
;
}
}
@Override
public
List
<
ContactCustResultDTO
>
getExcelInteractiveResult
(
CampaignRequestDTO
dto
)
{
...
...
@@ -172,37 +203,69 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
String
sql
=
SQLBuilder
.
getSqlQueryById
(
Constants
.
SQL_MODULES
.
MODULE_EXECUTE
,
"get-execute-interactive"
);
sqlBuilder
.
append
(
sql
);
sqlBuilder
.
append
(
" and to_char(a.customer_id) like :p_customer_id"
);
sqlBuilder
.
append
(
" and to_char(a.contact_status) in (:p_list_contact_status)"
);
sqlBuilder
.
append
(
" and to_char(a.call_status) in (:p_list_survey_status)"
);
sqlBuilder
.
append
(
" and to_char(a.status) in (:p_list_record_status)"
);
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getPhoneNumber
()))
{
sqlBuilder
.
append
(
" and a.phone_number like :p_phone_number"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignId
()))
{
sqlBuilder
.
append
(
" and b.campaign_code in (:p_list_campaign_id) "
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignName
()))
{
sqlBuilder
.
append
(
" and upper(
campaignName) like upper(:p_campaign_name)
"
);
sqlBuilder
.
append
(
" and upper(
b.campaign_name) like :p_campaign_name
"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getAgentId
()))
{
sqlBuilder
.
append
(
" and upper(
userName) like upper(:p_user_name)
"
);
sqlBuilder
.
append
(
" and upper(
c.user_name) like :p_user_name
"
);
}
SQLQuery
query
=
session
.
createSQLQuery
(
sqlBuilder
.
toString
());
query
.
setParameterList
(
"p_list_campaign_id"
,
dto
.
getCampaignId
().
split
(
","
));
query
.
setParameter
(
"p_customer_id"
,
dto
.
getCustomerId
());
query
.
setParameter
(
"p_company_site_id"
,
dto
.
getCompanySiteId
());
query
.
setParameter
(
"p_customer_id"
,
"%"
+
dto
.
getCustomerId
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
query
.
setParameter
(
"p_date_from"
,
dto
.
getFromDate
());
query
.
setParameter
(
"p_date_to"
,
dto
.
getToDate
());
query
.
setParameterList
(
"p_list_contact_status"
,
dto
.
getContactStatus
().
split
(
","
));
query
.
setParameterList
(
"p_list_survey_status"
,
dto
.
getSurveyStatus
().
split
(
","
));
query
.
setParameterList
(
"p_list_record_status"
,
dto
.
getRecordStatus
().
split
(
","
));
query
.
setParameter
(
"p_phone_number"
,
dto
.
getPhoneNumber
());
query
.
setParameter
(
"p_call_time_from"
,
dto
.
getCallTimeFrom
());
query
.
setParameter
(
"p_call_time_to"
,
dto
.
getCallTimeTo
());
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignId
()))
{
query
.
setParameterList
(
"p_list_campaign_id"
,
dto
.
getCampaignId
().
split
(
","
));
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getPhoneNumber
()))
{
query
.
setParameter
(
"p_phone_number"
,
"%"
+
dto
.
getPhoneNumber
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignName
()))
{
query
.
setParameter
(
"p_campaign_name"
,
dto
.
getCampaignName
().
trim
());
query
.
setParameter
(
"p_campaign_name"
,
"%"
+
dto
.
getCampaignName
().
toUpperCase
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
}
if
(!
DataUtil
.
isNullOrEmpty
(
dto
.
getAgentId
()))
{
query
.
setParameter
(
"p_user_name"
,
dto
.
getAgentId
().
trim
());
query
.
setParameter
(
"p_user_name"
,
"%"
+
dto
.
getAgentId
().
toUpperCase
()
.
replace
(
"\\"
,
"\\\\"
)
.
replaceAll
(
"%"
,
"\\%"
)
.
replaceAll
(
"_"
,
"\\_"
)
+
"%"
);
}
query
.
addScalar
(
"campaignCode"
,
new
StringType
());
query
.
addScalar
(
"campaignName"
,
new
StringType
());
query
.
addScalar
(
"userName"
,
new
StringType
());
query
.
addScalar
(
"phoneNumber"
,
new
Lo
ngType
());
query
.
addScalar
(
"phoneNumber"
,
new
Stri
ngType
());
query
.
addScalar
(
"customerName"
,
new
StringType
());
query
.
addScalar
(
"createTime"
,
new
DateType
());
query
.
addScalar
(
"contactStatus"
,
new
StringType
());
...
...
src/main/java/com/viettel/campaign/repository/impl/TicketRepositoryImpl.java
View file @
9e99b655
...
...
@@ -41,7 +41,7 @@ public class TicketRepositoryImpl implements TicketRepositoryCustom {
for
(
Object
[]
obj
:
data
)
{
TicketDTO
item
=
new
TicketDTO
();
item
.
setTicketId
(((
Long
)
obj
[
0
]
));
item
.
setTicketId
(((
BigDecimal
)
obj
[
0
]).
longValueExact
(
));
item
.
setCreateDate
((
Date
)
obj
[
1
]);
item
.
setSubject
((
String
)
obj
[
2
]);
item
.
setStatusName
((
String
)
obj
[
3
]);
...
...
src/main/java/com/viettel/campaign/repository/impl/UserActionLogRepositoryImpl.java
0 → 100644
View file @
9e99b655
package
com.viettel.campaign.repository.impl
;
import
com.viettel.campaign.repository.UserActionLogRepositoryCustom
;
import
com.viettel.campaign.utils.Constants
;
import
com.viettel.campaign.utils.HibernateUtil
;
import
com.viettel.campaign.utils.SQLBuilder
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.web.dto.UserActionLogDTO
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.hibernate.SQLQuery
;
import
org.hibernate.Session
;
import
org.hibernate.SessionFactory
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* @author anhvd_itsol
*/
@Repository
@Transactional
public
class
UserActionLogRepositoryImpl
implements
UserActionLogRepositoryCustom
{
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
CampaignRepositoryImpl
.
class
);
@Override
public
ResultDTO
insertToUserActionLog
(
UserActionLogDTO
userActionLogDTO
)
{
logger
.
info
(
"Start search campaign::"
);
ResultDTO
result
=
new
ResultDTO
();
SessionFactory
sessionFactory
=
HibernateUtil
.
getSessionFactory
();
Session
session
=
sessionFactory
.
openSession
();
session
.
beginTransaction
();
try
{
StringBuilder
sqlStr
=
new
StringBuilder
();
sqlStr
.
append
(
SQLBuilder
.
getSqlQueryById
(
SQLBuilder
.
SQL_MODULE_CAMPAIGN_MNG
,
"insert-to-user-action-log"
));
SQLQuery
query
=
session
.
createSQLQuery
(
sqlStr
.
toString
());
query
.
setParameter
(
"par_agentId"
,
userActionLogDTO
.
getAgentId
()
==
null
?
""
:
userActionLogDTO
.
getAgentId
());
query
.
setParameter
(
"par_companySiteId"
,
userActionLogDTO
.
getCompanySiteId
());
query
.
setParameter
(
"par_sessionId"
,
userActionLogDTO
.
getSessionId
());
query
.
setParameter
(
"par_startTime"
,
userActionLogDTO
.
getStartTime
());
query
.
setParameter
(
"par_actionType"
,
userActionLogDTO
.
getActionType
());
query
.
setParameter
(
"par_objectId"
,
userActionLogDTO
.
getObjectId
());
query
.
executeUpdate
();
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 @
9e99b655
...
...
@@ -13,6 +13,8 @@ public interface CampaignService {
ResultDTO
findByCampaignCode
(
CampaignRequestDTO
requestDTO
);
ResultDTO
findByCampaignId
(
Long
campaignId
);
ResultDTO
addNewCampaign
(
CampaignDTO
campaignDTO
);
Map
countRecallCustomer
(
Long
companySiteId
,
Long
agentId
);
...
...
src/main/java/com/viettel/campaign/service/CustomerService.java
View file @
9e99b655
package
com.viettel.campaign.service
;
<<<<<<<
HEAD
import
com.viettel.campaign.model.CustomerList
;
=======
import
com.viettel.campaign.web.dto.CustomerContactDTO
;
>>>>>>>
9
df5481c5a6e1402937df9086e0a110b21458e93
import
com.viettel.campaign.web.dto.CustomerDTO
;
import
com.viettel.campaign.web.dto.CustomerListDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
...
...
@@ -40,4 +44,15 @@ public interface CustomerService {
// ------------ customer contact ------------ //
ResultDTO
getCustomerContact
(
Long
customerId
,
Short
contactType
,
String
contact
);
// danh sach khach hang cua chien dich //
ResultDTO
searchCustomerListInfoFromCustomerList
(
int
page
,
int
pageSize
,
String
sort
,
Long
campaignId
,
Long
companySiteId
);
ResultDTO
getCustomerContact
(
CustomerContactDTO
customer
);
// ------------ customer ------------ //
ResultDTO
getCustomerRecall
(
Long
campaignId
,
Long
customerId
);
}
src/main/java/com/viettel/campaign/service/UserActionLogService.java
0 → 100644
View file @
9e99b655
package
com.viettel.campaign.service
;
/**
* @author anhvd_itsol
*/
public
interface
UserActionLogService
{
}
src/main/java/com/viettel/campaign/service/impl/CampaignCompleteCodeServiceImpl.java
View file @
9e99b655
...
...
@@ -2,20 +2,28 @@ package com.viettel.campaign.service.impl;
import
com.viettel.campaign.service.CampaignCompleteCodeService
;
import
com.viettel.campaign.utils.Constants
;
import
com.viettel.campaign.utils.DataUtil
;
import
com.viettel.campaign.utils.HibernateUtil
;
import
com.viettel.campaign.utils.SQLBuilder
;
import
com.viettel.campaign.web.dto.CampaignCompleteCodeDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.mapper.CampaignCompleteCodeMapper
;
import
com.viettel.campaign.model.CampaignCompleteCode
;
import
com.viettel.campaign.repository.CampaignCompleteCodeRepository
;
import
org.hibernate.SQLQuery
;
import
org.hibernate.Session
;
import
org.hibernate.SessionFactory
;
import
org.hibernate.transform.Transformers
;
import
org.hibernate.type.LongType
;
import
org.hibernate.type.ShortType
;
import
org.hibernate.type.StringType
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.*
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -166,51 +174,83 @@ public class CampaignCompleteCodeServiceImpl implements CampaignCompleteCodeServ
return
result
;
}
// @Override
// public ResultDTO findMaxValueCampaignCompleteCode(CampaignCompleteCodeDTO completeCodeDTO) {
// ResultDTO resultDTO = new ResultDTO();
// CampaignCompleteCodeMapper campaignCompleteCodeMapper = new CampaignCompleteCodeMapper();
// try {
// short maxValue = 0;
//// List<CampaignCompleteCode> list = completeCodeRepository.findCampaignCompleteCodesByCompanySiteId(completeCodeDTO.getCompanySiteId());
//// for (int i = 0; i<list.size();i++) {
//// if (list.get(i).getCompleteValue() != null && !list.get(i).getCompleteValue().equals("")) {
//// if (maxValue < Short.parseShort(list.get(i).getCompleteValue())) {
//// maxValue = Short.parseShort(list.get(i).getCompleteValue());
//// }
//// }
//// }
// maxValue = completeCodeRepository.findByMaxCompanySiteId(completeCodeDTO.getCompanySiteId());
// if (maxValue < 4) {
// maxValue = 4;
// }
// maxValue+= 1;
// resultDTO.setData(maxValue);
// resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
// resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
// } catch (Exception e) {
// resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
// resultDTO.setDescription(e.getMessage());
// logger.error(e.getMessage(), e);
// }
// return resultDTO;
// }
@Override
public
ResultDTO
findMaxValueCampaignCompleteCode
(
CampaignCompleteCodeDTO
completeCodeDTO
)
{
ResultDTO
resultDTO
=
new
ResultDTO
();
try
{
short
maxValue
=
0
;
List
<
CampaignCompleteCode
>
list
=
completeCodeRepository
.
findCampaignCompleteCodesByCompanySiteId
(
completeCodeDTO
.
getCompanySiteId
());
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
if
(
list
.
get
(
i
).
getCompleteValue
()
!=
null
&&
!
list
.
get
(
i
).
getCompleteValue
().
equals
(
""
))
{
if
(
maxValue
<
Short
.
parseShort
(
list
.
get
(
i
).
getCompleteValue
()))
{
maxValue
=
Short
.
parseShort
(
list
.
get
(
i
).
getCompleteValue
());
SessionFactory
sessionFactory
=
HibernateUtil
.
getSessionFactory
();
Session
session
=
sessionFactory
.
openSession
();
session
.
beginTransaction
();
if
(
DataUtil
.
isNullOrZero
(
completeCodeDTO
.
getCompanySiteId
()))
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
return
resultDTO
;
}
try
{
StringBuilder
sqlStrBuilder
=
new
StringBuilder
();
sqlStrBuilder
.
append
(
SQLBuilder
.
getSqlQueryById
(
SQLBuilder
.
SQL_MODULE_CAMPAIGN_STATUS_MNG
,
"get-max-value-completevalue"
));
SQLQuery
query
=
session
.
createSQLQuery
(
sqlStrBuilder
.
toString
());
query
.
setParameter
(
"p_site_id"
,
completeCodeDTO
.
getCompanySiteId
());
query
.
addScalar
(
"completeValue"
,
new
StringType
());
query
.
addScalar
(
"companySiteId"
,
new
LongType
());
query
.
setResultTransformer
(
Transformers
.
aliasToBean
(
CampaignCompleteCodeDTO
.
class
));
List
<
CampaignCompleteCodeDTO
>
data
=
query
.
list
();
if
(
data
!=
null
&&
data
.
size
()
>
0
)
{
int
tmp
=
4
;
String
completeValue
=
data
.
get
(
0
).
getCompleteValue
();
if
(
completeValue
!=
null
&&
!
completeValue
.
trim
().
equals
(
""
))
{
tmp
=
Integer
.
parseInt
(
completeValue
)
+
1
;
}
resultDTO
.
setData
(
tmp
);
}
else
{
resultDTO
.
setData
(
null
);
}
maxValue
+=
1
;
resultDTO
.
setData
(
maxValue
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
}
catch
(
Exception
e
)
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
e
.
getMessage
());
}
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
logger
.
error
(
e
.
getMessage
(),
e
);
}
finally
{
session
.
close
();
return
resultDTO
;
}
}
// @Override
// public ResultDTO findMaxValueCampaignCompleteCode(CampaignCompleteCodeDTO completeCodeDTO) {
// ResultDTO result = new ResultDTO();
// CampaignCompleteCodeMapper campaignCompleteCodeMapper = new CampaignCompleteCodeMapper();
// CampaignCompleteCode campaignCompleteCode = new CampaignCompleteCode();
// try{
// short resultmaxValue = completeCodeRepository.findByMaxCompanySiteId(completeCodeDTO.getCompanySiteId());
// campaignCompleteCode.setCompleteValue(String.valueOf(resultmaxValue + 1));
//// if (resultmaxValue < 4) {
//// resultmaxValue =4;
//// }
// result.setData(resultmaxValue);
// result.setErrorCode(Constants.Status.ACTIVE_STR);
// result.setDescription(Constants.Status.ACTIVE_STR);
// }
// catch (Exception e){
// logger.error(e.getMessage(), e);
// result.setErrorCode("-1");
// return result;
// }
// result.setErrorCode("0");
// return result;
// }
}
src/main/java/com/viettel/campaign/service/impl/CampaignServiceImpl.java
View file @
9e99b655
...
...
@@ -3,20 +3,19 @@ package com.viettel.campaign.service.impl;
import
com.viettel.campaign.model.Campaign
;
import
com.viettel.campaign.model.TimeRangeDialMode
;
import
com.viettel.campaign.model.TimeZoneDialMode
;
//import com.viettel.campaign.model.UserActionLog;
import
com.viettel.campaign.repository.CampaignRepository
;
import
com.viettel.campaign.repository.TimeRangeDialModeRepository
;
import
com.viettel.campaign.repository.TimeZoneDialModeRepository
;
//import com.viettel.campaign.repository.UserActionLogRepository;
import
com.viettel.campaign.repository.UserActionLogRepositoryCustom
;
import
com.viettel.campaign.repository.impl.CampaignRepositoryImpl
;
import
com.viettel.campaign.service.CampaignService
;
import
com.viettel.campaign.utils.Constants
;
import
com.viettel.campaign.web.dto.CampaignDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.web.dto.TimeRangeDialModeDTO
;
import
com.viettel.campaign.web.dto.TimeZoneDialModeDTO
;
import
com.viettel.campaign.web.dto.*
;
import
com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.modelmapper.ModelMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -38,6 +37,9 @@ public class CampaignServiceImpl implements CampaignService {
@Autowired
TimeRangeDialModeRepository
timeRangeDialModeRepository
;
@Autowired
UserActionLogRepositoryCustom
userActionLogRepository
;
@Autowired
ModelMapper
modelMapper
;
...
...
@@ -56,6 +58,23 @@ public class CampaignServiceImpl implements CampaignService {
return
campaignRepository
.
findByCampaignCode
(
requestDTO
);
}
@Override
public
ResultDTO
findByCampaignId
(
Long
campaignId
)
{
ResultDTO
result
=
new
ResultDTO
();
Campaign
campaign
=
campaignRepository
.
findByCampaignId
(
campaignId
);
if
(
campaign
!=
null
)
{
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
result
.
setErrorCode
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
result
.
setData
(
campaign
);
}
else
{
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
result
.
setErrorCode
(
Constants
.
ApiErrorDesc
.
ERROR
);
}
return
result
;
}
@Override
public
ResultDTO
addNewCampaign
(
CampaignDTO
campaignDTO
)
{
logger
.
info
(
"=== Start add new campaign "
);
...
...
@@ -72,7 +91,8 @@ public class CampaignServiceImpl implements CampaignService {
Campaign
campaignResult
=
campaignRepository
.
save
(
campaign
);
campaignId
=
campaign
.
getCampaignId
();
//insert sub tables
if
(
campaignDTO
.
getLstTimeRange
().
size
()
>
0
)
{
if
(
campaignDTO
.
getLstTimeRange
().
size
()
>
0
)
{
timeRangeDialModes
=
campaignDTO
.
getLstTimeRange
();
timeRangeDialModes
.
forEach
(
item
->
{
item
.
setCampaignId
(
campaignId
);
...
...
@@ -81,7 +101,7 @@ public class CampaignServiceImpl implements CampaignService {
});
timeRangeDialModeRepository
.
saveAll
(
lstTimeRangeModeToInsert
);
}
if
(
campaignDTO
.
getLstTimeZone
().
size
()
>
0
)
{
if
(
campaignDTO
.
getLstTimeZone
().
size
()
>
0
)
{
timeZoneDialModes
=
campaignDTO
.
getLstTimeZone
();
timeZoneDialModes
.
forEach
(
item
->
{
item
.
setCampaignId
(
campaignId
);
...
...
@@ -149,6 +169,25 @@ public class CampaignServiceImpl implements CampaignService {
entity
.
setUpdateTime
(
new
Date
());
entity
.
setUpdateBy
(
dto
.
getUpdateBy
());
campaignRepository
.
save
(
entity
);
UserActionLogDTO
userActionLog
=
new
UserActionLogDTO
();
userActionLog
.
setAgentId
(
null
);
userActionLog
.
setSessionId
(
dto
.
getSessionId
());
userActionLog
.
setCompanySiteId
(
dto
.
getCompanySiteId
());
userActionLog
.
setDescription
(
null
);
userActionLog
.
setStartTime
(
new
Date
());
userActionLog
.
setEndTime
(
null
);
userActionLog
.
setObjectId
(
entity
.
getCampaignId
());
if
(
dto
.
getStatus
().
equals
((
short
)
-
1
))
{
userActionLog
.
setActionType
((
short
)
2
);
}
else
if
(
dto
.
getStatus
().
equals
((
short
)
5
))
{
userActionLog
.
setActionType
((
short
)
7
);
}
else
if
(
dto
.
getStatus
().
equals
((
short
)
4
))
{
userActionLog
.
setActionType
((
short
)
4
);
}
else
if
(
dto
.
getStatus
().
equals
((
short
)
3
))
{
userActionLog
.
setActionType
((
short
)
5
);
}
userActionLogRepository
.
insertToUserActionLog
(
userActionLog
);
result
.
setData
(
entity
);
result
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
...
...
@@ -167,7 +206,7 @@ public class CampaignServiceImpl implements CampaignService {
private
String
generateCampaignCode
(
String
campaignType
,
Short
chanel
)
{
int
year
=
Calendar
.
getInstance
().
get
(
Calendar
.
YEAR
);
String
maxIndexStr
=
campaignRepository
.
getMaxCampaignIndex
();
if
(
maxIndexStr
!=
null
)
{
if
(
maxIndexStr
!=
null
)
{
Long
maxIndex
=
Long
.
valueOf
(
maxIndexStr
)
+
1
;
String
result
=
campaignType
+
"_"
+
String
.
valueOf
(
chanel
)
+
"_"
+
String
.
valueOf
(
year
)
+
"_"
+
maxIndex
.
toString
();
return
result
;
...
...
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
View file @
9e99b655
package
com.viettel.campaign.service.impl
;
import
com.viettel.campaign.mapper.CustomerListMapper
;
import
com.viettel.campaign.mapper.CustomerMapper
;
import
com.viettel.campaign.model.Customer
;
import
com.viettel.campaign.model.CustomerContact
;
import
com.viettel.campaign.model.CustomerList
;
import
com.viettel.campaign.repository.*
;
import
com.viettel.campaign.service.CustomerService
;
import
com.viettel.campaign.utils.Constants
;
import
com.viettel.campaign.utils.DataUtil
;
import
com.viettel.campaign.utils.HibernateUtil
;
import
com.viettel.campaign.utils.SQLBuilder
;
import
com.viettel.campaign.web.dto.CustomerCustomDTO
;
import
com.viettel.campaign.web.dto.CustomerDTO
;
import
com.viettel.campaign.web.dto.CustomerListDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.mapper.CustomerMapper
;
import
com.viettel.campaign.model.Customer
;
import
com.viettel.campaign.utils.DataUtil
;
import
com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO
;
import
com.viettel.campaign.web.dto.*
;
import
com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO
;
import
com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO
;
import
org.hibernate.SQLQuery
;
import
org.hibernate.Session
;
import
org.hibernate.SessionFactory
;
...
...
@@ -32,7 +29,8 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.persistence.EntityManager
;
import
javax.persistence.Query
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.List
;
@Service
public
class
CustomerServiceImpl
implements
CustomerService
{
...
...
@@ -52,6 +50,9 @@ public class CustomerServiceImpl implements CustomerService {
@Autowired
CampaignCustomerListRepository
campaignCustomerListRepository
;
@Autowired
CampaignCustomerRepository
campaignCustomerRepository
;
@Autowired
CustomerListMappingRepository
customerListMappingRepository
;
...
...
@@ -601,25 +602,74 @@ public class CustomerServiceImpl implements CustomerService {
}
@Override
<<<<<<<
HEAD
public
CustomerList
getLatestCreated
()
{
return
customerListRepository
.
latestCreated
();
}
@Override
public
ResultDTO
getCustomerContact
(
Long
customerId
,
Short
contactType
,
String
contact
)
{
=======
public
ResultDTO
getCustomerContact
(
CustomerContactDTO
customer
)
{
>>>>>>>
9
df5481c5a6e1402937df9086e0a110b21458e93
ResultDTO
result
=
new
ResultDTO
();
List
<
CustomerContact
>
customer
=
customerContactRepository
.
findByCustomerIdAndAndContactTypeAndContact
(
customerId
,
contactType
,
contact
);
try
{
List
<
CustomerContact
>
data
=
customerContactRepository
.
findByCustomerIdAndAndContactTypeAndContact
(
customer
.
getCustomerId
(),
customer
.
getContactType
(),
customer
.
getContact
(),
SQLBuilder
.
buildPageable
(
customer
));
if
(
customer
!=
null
)
{
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
result
.
setDescription
(
"customer contact data"
);
result
.
setListData
(
customer
);
result
.
setListData
(
data
);
result
.
setTotalRow
(
customerContactRepository
.
findByCustomerIdAndAndContactTypeAndContact
(
customer
.
getCustomerId
(),
customer
.
getContactType
(),
customer
.
getContact
(),
null
).
size
());
}
else
{
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
result
.
setDescription
(
"customer contact data null"
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
@Override
public
ResultDTO
getCustomerRecall
(
Long
campaignId
,
Long
customerId
)
{
ResultDTO
result
=
new
ResultDTO
();
try
{
Long
data
=
campaignCustomerRepository
.
getCustomerRecall
(
campaignId
,
customerId
);
if
(
data
!=
null
)
{
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
result
.
setDescription
(
"campaign customer data"
);
result
.
setData
(
data
);
}
else
{
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
result
.
setDescription
(
"campaign customer data null"
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
@Override
public
ResultDTO
searchCustomerListInfoFromCustomerList
(
int
page
,
int
pageSize
,
String
sort
,
Long
campaignId
,
Long
companySiteId
)
{
ResultDTO
resultDTO
=
new
ResultDTO
();
try
{
String
sql
=
SQLBuilder
.
getSqlQueryById
(
SQLBuilder
.
SQL_MODULE_CAMPAIGN_MNG
,
"search-customer-list-info-from-customer-list"
);
Query
query
=
entityManager
.
createNativeQuery
(
sql
);
query
.
setParameter
(
"p_campaign_id"
,
campaignId
);
query
.
setParameter
(
"p_company_site_id"
,
companySiteId
);
resultDTO
.
setListData
(
query
.
getResultList
());
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
}
catch
(
Exception
e
)
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
e
.
getMessage
());
}
return
resultDTO
;
}
}
src/main/java/com/viettel/campaign/service/impl/UserActionLogServiceImpl.java
0 → 100644
View file @
9e99b655
package
com.viettel.campaign.service.impl
;
import
com.viettel.campaign.service.UserActionLogService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* @author anhvd_itsol
*/
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
UserActionLogServiceImpl
implements
UserActionLogService
{
}
src/main/java/com/viettel/campaign/web/dto/CampaignDTO.java
View file @
9e99b655
...
...
@@ -64,4 +64,5 @@ public class CampaignDTO extends BaseDTO {
private
List
<
TimeRangeDialModeDTO
>
lstTimeRange
;
private
List
<
TimeZoneDialModeDTO
>
lstTimeZone
;
private
Short
agentStatus
;
private
String
sessionId
;
}
src/main/java/com/viettel/campaign/web/dto/ContactCustResultDTO.java
View file @
9e99b655
...
...
@@ -23,7 +23,7 @@ public class ContactCustResultDTO extends BaseDTO{
private
Long
agentId
;
private
Long
campaignId
;
private
String
campaignName
;
private
Lo
ng
phoneNumber
;
private
Stri
ng
phoneNumber
;
private
String
customerName
;
private
Long
customerId
;
private
String
contactStatus
;
...
...
src/main/java/com/viettel/campaign/web/dto/CustomerContactDTO.java
View file @
9e99b655
...
...
@@ -7,7 +7,7 @@ import java.util.Date;
@Getter
@Setter
public
class
CustomerContactDTO
{
public
class
CustomerContactDTO
extends
BaseDTO
{
private
Long
contactId
;
private
Long
customerId
;
private
Short
contactType
;
...
...
src/main/java/com/viettel/campaign/web/dto/UserActionLogDTO.java
0 → 100644
View file @
9e99b655
package
com.viettel.campaign.web.dto
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.Date
;
/**
* @author anhvd_itsol
*/
@Getter
@Setter
public
class
UserActionLogDTO
{
private
Long
agentId
;
//userId
private
Long
companySiteId
;
private
String
sessionId
;
private
Date
startTime
;
private
Date
endTime
;
private
Short
actionType
;
private
String
description
;
private
Long
objectId
;
//campaignId
}
src/main/java/com/viettel/campaign/web/rest/CampaignCompleteCodeController.java
View file @
9e99b655
...
...
@@ -63,6 +63,7 @@ public class CampaignCompleteCodeController {
ResultDTO
result
=
new
ResultDTO
();
try
{
result
=
completeCodeService
.
updateCompleteCode
(
completeCodeDTO
);
}
catch
(
Exception
e
)
{
result
.
setErrorCode
(
"-1"
);
LOGGER
.
error
(
e
);
...
...
src/main/java/com/viettel/campaign/web/rest/controller/CampaignController.java
View file @
9e99b655
...
...
@@ -9,12 +9,18 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
<<<<<<<
HEAD
import
org.springframework.cloud.sleuth.instrument.reactor.ReactorSleuth
;
=======
import
org.springframework.http.HttpHeaders
;
>>>>>>>
55
a6b806b604aa92fca10c101776df185d0d67af
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
...
...
@@ -31,10 +37,14 @@ public class CampaignController {
@Autowired
CampaignService
campaignService
;
<<<<<<<
HEAD
@PostMapping
(
"/searchCampaignExecute"
)
=======
@Autowired
CampaignExecuteService
campaignExecuteService
;
@RequestMapping
(
"/searchCampaignExecute"
)
>>>>>>>
55
a6b806b604aa92fca10c101776df185d0d67af
@ResponseBody
public
ResponseEntity
<
ResultDTO
>
searchCampaignExecute
(
@RequestBody
CampaignRequestDTO
requestDto
)
{
ResultDTO
result
=
campaignService
.
searchCampaignExecute
(
requestDto
);
...
...
@@ -64,6 +74,14 @@ public class CampaignController {
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
<<<<<<<
HEAD
@GetMapping
(
"/findByCampaignId"
)
@ResponseBody
public
ResponseEntity
findByCampaignId
(
@RequestParam
(
"campaignId"
)
Long
campaignId
)
{
ResultDTO
result
=
campaignService
.
findByCampaignId
(
campaignId
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
=======
@PostMapping
(
"/searchInteractiveResult"
)
@ResponseBody
public
ResponseEntity
<
ResultDTO
>
searchInteractiveResult
(
@RequestBody
CampaignRequestDTO
dto
)
throws
Exception
{
...
...
@@ -103,8 +121,10 @@ public class CampaignController {
return
new
ResponseEntity
<
byte
[]>(
contentReturn
,
headers
,
HttpStatus
.
OK
);
}
@PostMapping
(
"/changeCampaignStatus"
)
public
ResultDTO
changeCampaignStatus
(
@RequestBody
CampaignDTO
dto
)
{
@RequestMapping
(
value
=
"/changeCampaignStatus"
,
method
=
RequestMethod
.
PUT
)
public
ResultDTO
changeCampaignStatus
(
@RequestBody
CampaignDTO
dto
,
HttpServletRequest
request
)
{
dto
.
setSessionId
(
request
.
getSession
().
getId
());
return
campaignService
.
changeCampaignStatus
(
dto
);
}
>>>>>>>
55
a6b806b604aa92fca10c101776df185d0d67af
}
src/main/java/com/viettel/campaign/web/rest/controller/CustomerController.java
View file @
9e99b655
package
com.viettel.campaign.web.rest.controller
;
import
com.viettel.campaign.web.dto.CustomerContactDTO
;
import
com.viettel.campaign.web.dto.CustomerDTO
;
import
com.viettel.campaign.web.dto.CustomerListDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
...
...
@@ -163,6 +164,7 @@ public class CustomerController {
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
<<<<<<<
HEAD
@GetMapping
(
"/latestCreated"
)
@ResponseBody
public
ResponseEntity
getLatestCreated
()
{
...
...
@@ -172,9 +174,19 @@ public class CustomerController {
}
@GetMapping
(
"/findCustomerContact"
)
=======
@PostMapping
(
"/findCustomerContact"
)
>>>>>>>
9
df5481c5a6e1402937df9086e0a110b21458e93
@ResponseBody
public
ResponseEntity
<
ResultDTO
>
findAllCustomerContact
(
@RequestParam
(
"customerId"
)
Long
customerId
,
@RequestParam
(
"contactType"
)
Short
contactType
,
@RequestParam
(
"contact"
)
String
contact
)
{
ResultDTO
result
=
customerService
.
getCustomerContact
(
customerId
,
contactType
,
contact
);
public
ResponseEntity
<
ResultDTO
>
findAllCustomerContact
(
@RequestBody
CustomerContactDTO
customerContactDTO
)
{
ResultDTO
result
=
customerService
.
getCustomerContact
(
customerContactDTO
);
return
new
ResponseEntity
(
result
,
HttpStatus
.
OK
);
}
@GetMapping
(
"/getCustomerRecall"
)
@ResponseBody
public
ResponseEntity
<
ResultDTO
>
getCustomerRecall
(
@RequestParam
(
"campaignId"
)
Long
campaignId
,
@RequestParam
(
"customerId"
)
Long
customerId
)
{
ResultDTO
result
=
customerService
.
getCustomerRecall
(
campaignId
,
customerId
);
return
new
ResponseEntity
(
result
,
HttpStatus
.
OK
);
}
...
...
@@ -233,4 +245,13 @@ public class CustomerController {
return
new
ResponseEntity
<>(
HttpStatus
.
BAD_REQUEST
);
}
}
@RequestMapping
(
value
=
"/searchCustomerListInfoFromCustomerList"
,
method
=
RequestMethod
.
GET
)
public
ResultDTO
searchCustomerListInfoFromCustomerList
(
@RequestParam
(
"page"
)
int
page
,
@RequestParam
(
"pageSize"
)
int
pageSize
,
@RequestParam
(
"sort"
)
String
sort
,
@RequestParam
(
"campaignId"
)
Long
campaignId
,
@RequestParam
(
"companySiteId"
)
Long
companySiteId
)
{
return
customerService
.
searchCustomerListInfoFromCustomerList
(
page
,
pageSize
,
sort
,
campaignId
,
companySiteId
);
}
}
src/main/resources/i18n/language_en.properties
View file @
9e99b655
#Common
detail
=
Chi ti?t
stt
=
STT
detail
=
Detail
stt
=
No
#Campaign Execute Interactive
campaign.execute.interactive.title
=
Chi ti
?t k?t qu? t??ng t
c
campaign.execute.interactive.campaignCode
=
M chi?n d?ch
campaign.execute.interactive.campaignName
=
Tn chi?n d?ch
campaign.execute.interactive.agentId
=
M t? v?n vin
campaign.execute.interactive.phoneNumber
=
S? ?i?n tho?i
campaign.execute.interactive.customerId
=
M khch hng
campaign.execute.interactive.customerName
=
Tn khch hng
campaign.execute.interactive.c
allTime
=
Th?i gian lin l?c
campaign.execute.interactive.contactStatus
=
Tr?ng thi k?t n?i
campaign.execute.interactive.surveyStatus
=
Tr
?ng thi kh?o s
t
campaign.execute.interactive.status
=
Tr
?ng thi chi?n d?
ch
campaign.execute.interactive.recordStatus
=
Tr
?ng thi b?
n ghi
campaign.execute.interactive.title
=
Chi ti
ết kết quả tương tá
c
campaign.execute.interactive.campaignCode
=
Campaign code
campaign.execute.interactive.campaignName
=
Campaign name
campaign.execute.interactive.agentId
=
Agent id
campaign.execute.interactive.phoneNumber
=
Phone number
campaign.execute.interactive.customerId
=
Customer id
campaign.execute.interactive.customerName
=
Customer name
campaign.execute.interactive.c
reateTime
=
Create time
campaign.execute.interactive.contactStatus
=
Contact status
campaign.execute.interactive.surveyStatus
=
Tr
ạng thái khảo sá
t
campaign.execute.interactive.status
=
Tr
ạng thái chiến dị
ch
campaign.execute.interactive.recordStatus
=
Tr
ạng thái bả
n ghi
src/main/resources/sql/campaign-execute/get-combo-campaign-type.sql
View file @
9e99b655
select
AP_PARAM_ID
apParamId
,
select
PAR_VALUE
apParamId
,
PAR_NAME
parName
from
AP_PARAM
where
PAR_TYPE
=
'CAMPAIGN_TYPE'
and
COMPANY_SITE_ID
=
:
p_company_site_id
src/main/resources/sql/campaign-execute/get-execute-interactive.sql
View file @
9e99b655
...
...
@@ -14,15 +14,10 @@ from contact_cust_result a
left
join
customer
d
on
a
.
customer_id
=
d
.
customer_id
left
join
campaign_complete_code
e
on
a
.
contact_status
=
e
.
complete_value
left
join
campaign_complete_code
f
on
a
.
call_status
=
e
.
complete_value
left
join
campaign
g
on
a
.
campaign_id
=
b
.
campaign_id
left
join
campaign
g
on
a
.
campaign_id
=
g
.
campaign_id
where
a
.
status
<>
0
and
a
.
campaign_id
in
(:
p_list_campaign_id
)
and
a
.
customer_id
like
'%'
||
:
p_customer_id
||
'%'
and
a
.
company_site_id
=
:
p_company_site_id
and
a
.
create_time
>=
to_date
(:
p_date_from
,
'DD/MM/YYYY'
)
and
a
.
create_time
<=
to_date
(:
p_date_to
,
'DD/MM/YYYY'
)
and
a
.
contact_status
in
(:
p_list_contact_status
)
and
a
.
call_status
in
(:
p_list_survey_status
)
and
a
.
status
in
(:
p_list_record_status
)
and
a
.
phone_number
like
'%'
||
:
p_phone_number
||
'%'
and
a
.
duration_call
>=
:
p_call_time_from
and
a
.
duration_call
<=
:
p_call_time_to
src/main/resources/sql/campaign-mng/insert-to-user-action-log.sql
0 → 100644
View file @
9e99b655
INSERT
INTO
"CCMS_FULL"
.
"USER_ACTION_LOG"
(
AGENT_ID
,
COMPANY_SITE_ID
,
SESSION_ID
,
START_TIME
,
END_TIME
,
ACTION_TYPE
,
DESCRIPTION
,
OBJECT_ID
)
VALUES
(
:
par_agentId
,
:
par_companySiteId
,
:
par_sessionId
,
:
par_startTime
,
null
,
:
par_actionType
,
null
,
:
par_objectId
)
src/main/resources/sql/campaign-mng/search-customer-list-info-from-customer-list.sql
0 → 100644
View file @
9e99b655
with
totalCustomer
as
(
select
clm
.
customer_list_id
,
clm
.
company_site_id
,
count
(
clm
.
customer_id
)
total
from
customer_list_mapping
clm
inner
join
customer
c
on
clm
.
customer_id
=
c
.
customer_id
where
c
.
status
=
1
group
by
clm
.
customer_list_id
,
clm
.
company_site_id
),
customerInteractive
as
(
select
customer_list_id
,
company_site_id
,
count
(
customer_id
)
tt
from
campaign_customer
where
campaign_id
=
:
p_campaign_id
and
status
<>
0
group
by
customer_list_id
,
company_site_id
),
customerNotInteractive
as
(
select
customer_list_id
,
company_site_id
,
count
(
customer_id
)
ktt
from
campaign_customer
where
campaign_id
=
:
p_campaign_id
and
status
=
0
and
in_campaign_status
=
1
group
by
customer_list_id
,
company_site_id
)
select
customer_list_code
ma
,
customer_list_name
ten
,
cl
.
company_site_id
,
nvl
(
total
,
0
)
tong
,
nvl
(
tt
,
0
)
tongtt
,
nvl
(
ktt
,
0
)
tongktt
from
customer_list
cl
left
join
totalCustomer
tc
on
(
cl
.
customer_list_id
=
tc
.
customer_list_id
and
cl
.
company_site_id
=
tc
.
company_site_id
)
left
join
customerInteractive
ci
on
(
cl
.
customer_list_id
=
ci
.
customer_list_id
and
cl
.
company_site_id
=
ci
.
company_site_id
)
left
join
customerNotInteractive
cni
on
(
cl
.
customer_list_id
=
cni
.
customer_list_id
and
cl
.
company_site_id
=
cni
.
company_site_id
)
where
cl
.
company_site_id
=
:
p_company_site_id
order
by
customer_list_code
\ No newline at end of file
src/main/resources/sql/campaign-status-mng/get-max-value-completevalue.sql
0 → 100644
View file @
9e99b655
SELECT
max
(
COMPLETE_VALUE
)
completeValue
,
COMPANY_SITE_ID
companySiteId
from
CAMPAIGN_COMPLETE_CODE
where
COMPANY_SITE_ID
=
:
p_site_id
GROUP
BY
COMPANY_SITE_ID
src/main/resources/sql/campaign-status-mng/search-campaign-status-by-params.sql
View file @
9e99b655
...
...
@@ -12,7 +12,8 @@ SELECT
FROM
CAMPAIGN_COMPLETE_CODE
a
LEFT
JOIN
CAMPAIGN
b
ON
a
.
CAMPAIGN_ID
=
b
.
CAMPAIGN_ID
LEFT
JOIN
AP_PARAM
c
ON
a
.
CAMPAIGN_TYPE
=
to_char
(
c
.
AP_PARAM_ID
);
SELECT
max
(
COMPLETE_VALUE
)
,
COMPANY_SITE_ID
from
CAMPAIGN_COMPLETE_CODE
where
COMPANY_SITE_ID
=
:
p_site_id
GROUP
BY
COMPANY_SITE_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