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
9a9fed56
Commit
9a9fed56
authored
Sep 12, 2019
by
Tu Bach
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://git.myitsol.com/hanv/service-campaign
parents
82799e42
5e715b1e
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
610 additions
and
187 deletions
+610
-187
pom.xml
pom.xml
+12
-0
src/main/java/com/viettel/campaign/job/CampaignJob.java
src/main/java/com/viettel/campaign/job/CampaignJob.java
+2
-0
src/main/java/com/viettel/campaign/repository/ccms_full/CampaignCfgRepository.java
.../campaign/repository/ccms_full/CampaignCfgRepository.java
+3
-0
src/main/java/com/viettel/campaign/repository/ccms_full/CustomerListRepository.java
...campaign/repository/ccms_full/CustomerListRepository.java
+3
-0
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignRepositoryImpl.java
...ign/repository/ccms_full/impl/CampaignRepositoryImpl.java
+19
-16
src/main/java/com/viettel/campaign/service/CampaignCfgService.java
...java/com/viettel/campaign/service/CampaignCfgService.java
+1
-1
src/main/java/com/viettel/campaign/service/impl/CampaignCfgServiceImpl.java
...viettel/campaign/service/impl/CampaignCfgServiceImpl.java
+33
-19
src/main/java/com/viettel/campaign/service/impl/CampaignServiceImpl.java
...om/viettel/campaign/service/impl/CampaignServiceImpl.java
+2
-2
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
...om/viettel/campaign/service/impl/CustomerServiceImpl.java
+363
-137
src/main/java/com/viettel/campaign/service/impl/ScenarioQuestionServiceImpl.java
...el/campaign/service/impl/ScenarioQuestionServiceImpl.java
+1
-0
src/main/java/com/viettel/campaign/utils/Constants.java
src/main/java/com/viettel/campaign/utils/Constants.java
+2
-0
src/main/java/com/viettel/campaign/utils/TimeZoneUtils.java
src/main/java/com/viettel/campaign/utils/TimeZoneUtils.java
+157
-0
src/main/java/com/viettel/campaign/web/dto/CampaignDTO.java
src/main/java/com/viettel/campaign/web/dto/CampaignDTO.java
+3
-0
src/main/java/com/viettel/campaign/web/dto/request_dto/CampaignCfgRequestDTO.java
...l/campaign/web/dto/request_dto/CampaignCfgRequestDTO.java
+1
-1
src/main/java/com/viettel/campaign/web/dto/request_dto/SearchCustomerRequestDTO.java
...ampaign/web/dto/request_dto/SearchCustomerRequestDTO.java
+1
-0
src/main/java/com/viettel/campaign/web/rest/CampaignCfgController.java
.../com/viettel/campaign/web/rest/CampaignCfgController.java
+2
-2
src/main/resources/i18n/language_en.properties
src/main/resources/i18n/language_en.properties
+3
-5
src/main/resources/i18n/language_vi.properties
src/main/resources/i18n/language_vi.properties
+2
-4
No files found.
pom.xml
View file @
9a9fed56
...
@@ -162,6 +162,18 @@
...
@@ -162,6 +162,18 @@
<version>
2.1.0
</version>
<version>
2.1.0
</version>
</dependency>
</dependency>
<dependency>
<groupId>
net.javacrumbs.shedlock
</groupId>
<artifactId>
shedlock-spring
</artifactId>
<version>
2.2.0
</version>
</dependency>
<dependency>
<groupId>
net.javacrumbs.shedlock
</groupId>
<artifactId>
shedlock-provider-redis-spring
</artifactId>
<version>
2.2.0
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
src/main/java/com/viettel/campaign/job/CampaignJob.java
View file @
9a9fed56
...
@@ -4,6 +4,7 @@ import com.viettel.campaign.model.ccms_full.*;
...
@@ -4,6 +4,7 @@ import com.viettel.campaign.model.ccms_full.*;
import
com.viettel.campaign.service.*
;
import
com.viettel.campaign.service.*
;
import
com.viettel.campaign.utils.DateTimeUtil
;
import
com.viettel.campaign.utils.DateTimeUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
net.javacrumbs.shedlock.core.SchedulerLock
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
...
@@ -41,6 +42,7 @@ public class CampaignJob {
...
@@ -41,6 +42,7 @@ public class CampaignJob {
// @Scheduled(fixedRate = 5000)
// @Scheduled(fixedRate = 5000)
// @Transactional( propagation = Propagation.REQUIRED)
// @Transactional( propagation = Propagation.REQUIRED)
@SchedulerLock
(
name
=
"testTimer"
,
lockAtMostFor
=
20
*
1000
,
lockAtLeastFor
=
20
*
1000
)
public
void
process
()
{
public
void
process
()
{
log
.
info
(
Thread
.
currentThread
().
getName
()
+
" The Task executed at "
+
dateFormat
.
format
(
new
Date
()));
log
.
info
(
Thread
.
currentThread
().
getName
()
+
" The Task executed at "
+
dateFormat
.
format
(
new
Date
()));
List
<
ProcessConfig
>
list
=
processConfigService
.
findAll
();
List
<
ProcessConfig
>
list
=
processConfigService
.
findAll
();
...
...
src/main/java/com/viettel/campaign/repository/ccms_full/CampaignCfgRepository.java
View file @
9a9fed56
...
@@ -13,6 +13,9 @@ import java.util.List;
...
@@ -13,6 +13,9 @@ import java.util.List;
@Repository
@Repository
public
interface
CampaignCfgRepository
extends
JpaRepository
<
CampaignCfg
,
Long
>
{
public
interface
CampaignCfgRepository
extends
JpaRepository
<
CampaignCfg
,
Long
>
{
@Query
(
"select c from CampaignCfg c where c.companySiteId=:p_company_site_id and c.status = 1"
)
List
<
CampaignCfg
>
findByCampaignCompleteCodeId
(
@Param
(
"p_company_site_id"
)
Long
p_company_site_id
);
@Query
(
"select c from CampaignCfg c where c.campaignCompleteCodeId in (:p_ids) and c.companySiteId=:p_company_site_id and c.status = 1"
)
@Query
(
"select c from CampaignCfg c where c.campaignCompleteCodeId in (:p_ids) and c.companySiteId=:p_company_site_id and c.status = 1"
)
List
<
CampaignCfg
>
findAllCampaignCfg
(
@Param
(
"p_ids"
)
List
<
Long
>
p_ids
,
@Param
(
"p_company_site_id"
)
Long
p_company_site_id
);
List
<
CampaignCfg
>
findAllCampaignCfg
(
@Param
(
"p_ids"
)
List
<
Long
>
p_ids
,
@Param
(
"p_company_site_id"
)
Long
p_company_site_id
);
...
...
src/main/java/com/viettel/campaign/repository/ccms_full/CustomerListRepository.java
View file @
9a9fed56
...
@@ -14,6 +14,9 @@ public interface CustomerListRepository extends JpaRepository<CustomerList, Long
...
@@ -14,6 +14,9 @@ public interface CustomerListRepository extends JpaRepository<CustomerList, Long
CustomerList
findByCustomerListCode
(
String
customerListCode
);
CustomerList
findByCustomerListCode
(
String
customerListCode
);
@Query
(
"select c from CustomerList c where c.customerListId in (:p_ids) and c.companySiteId=:p_company_site_id and c.status = 1"
)
List
<
CustomerList
>
findAllCustomerList
(
@Param
(
"p_ids"
)
List
<
Long
>
p_ids
,
@Param
(
"p_company_site_id"
)
Long
p_company_site_id
);
@Modifying
@Modifying
@Query
(
"update CustomerList c set c.status = 0 where c.customerListId=:p_customer_list_id and c.companySiteId=:p_company_site_id"
)
@Query
(
"update CustomerList c set c.status = 0 where c.customerListId=:p_customer_list_id and c.companySiteId=:p_company_site_id"
)
int
deleteCustomerList
(
@Param
(
"p_customer_list_id"
)
Long
p_customer_list_id
,
@Param
(
"p_company_site_id"
)
Long
p_company_site_id
);
int
deleteCustomerList
(
@Param
(
"p_customer_list_id"
)
Long
p_customer_list_id
,
@Param
(
"p_company_site_id"
)
Long
p_company_site_id
);
...
...
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignRepositoryImpl.java
View file @
9a9fed56
...
@@ -4,10 +4,7 @@ import com.viettel.campaign.config.DataSourceQualify;
...
@@ -4,10 +4,7 @@ import com.viettel.campaign.config.DataSourceQualify;
import
com.viettel.campaign.model.ccms_full.CampaignCustomer
;
import
com.viettel.campaign.model.ccms_full.CampaignCustomer
;
import
com.viettel.campaign.repository.ccms_full.CampaignCustomerRepository
;
import
com.viettel.campaign.repository.ccms_full.CampaignCustomerRepository
;
import
com.viettel.campaign.repository.ccms_full.CampaignRepositoryCustom
;
import
com.viettel.campaign.repository.ccms_full.CampaignRepositoryCustom
;
import
com.viettel.campaign.utils.Constants
;
import
com.viettel.campaign.utils.*
;
import
com.viettel.campaign.utils.DataUtil
;
import
com.viettel.campaign.utils.HibernateUtil
;
import
com.viettel.campaign.utils.SQLBuilder
;
import
com.viettel.campaign.web.dto.*
;
import
com.viettel.campaign.web.dto.*
;
import
com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO
;
import
com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
...
@@ -29,10 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -29,10 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.persistence.EntityManager
;
import
javax.persistence.EntityManager
;
import
javax.persistence.PersistenceContext
;
import
javax.persistence.PersistenceContext
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Repository
@Repository
public
class
CampaignRepositoryImpl
implements
CampaignRepositoryCustom
{
public
class
CampaignRepositoryImpl
implements
CampaignRepositoryCustom
{
...
@@ -52,6 +46,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
...
@@ -52,6 +46,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
@Override
@Override
public
ResultDTO
search
(
CampaignRequestDTO
requestDto
)
{
public
ResultDTO
search
(
CampaignRequestDTO
requestDto
)
{
TimeZone
tzClient
=
TimeZoneUtils
.
getZoneMinutes
((
long
)
requestDto
.
getTimezoneOffset
());
logger
.
info
(
"Start search campaign::"
);
logger
.
info
(
"Start search campaign::"
);
ResultDTO
result
=
new
ResultDTO
();
ResultDTO
result
=
new
ResultDTO
();
...
@@ -131,16 +126,16 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
...
@@ -131,16 +126,16 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
sb
.
append
(
" AND a.STATUS IN (:p_statuses) "
);
sb
.
append
(
" AND a.STATUS IN (:p_statuses) "
);
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getFromDateFr
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getFromDateFr
()))
{
sb
.
append
(
" AND
TO_DATE(a.START_TIME, 'DD-MM-RR') >= TO_DATE(:p_frDateFr, 'YYYYMMDD
')"
);
sb
.
append
(
" AND
a.START_TIME >= TO_DATE(:p_frDateFr, 'DD/MM/YYYY HH24:MI:SS
')"
);
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getToDateFr
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getToDateFr
()))
{
sb
.
append
(
" AND
TO_DATE(a.START_TIME, 'DD-MM-RR') <= TO_DATE(:p_toDateFr, 'YYYYMMDD
')"
);
sb
.
append
(
" AND
a.START_TIME <= TO_DATE(:p_toDateFr, 'DD/MM/YYYY HH24:MI:SS
')"
);
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getFromDateTo
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getFromDateTo
()))
{
sb
.
append
(
" AND
TO_DATE(a.END_TIME, 'DD-MM-RR') >= TO_DATE(:p_frDateTo, 'YYYYMMDD
')"
);
sb
.
append
(
" AND
a.END_TIME >= TO_DATE(:p_frDateTo, 'DD/MM/YYYY HH24:MI:SS
')"
);
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getToDateTo
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getToDateTo
()))
{
sb
.
append
(
" AND
TO_DATE(a.END_TIME, 'DD-MM-RR') <= TO_DATE(:p_toDateTo, 'YYYYMMDD
')"
);
sb
.
append
(
" AND
a.END_TIME <= TO_DATE(:p_toDateTo, 'DD/MM/YYYY HH24:MI:SS
')"
);
}
}
if
(!
DataUtil
.
isNullOrZero
(
requestDto
.
getNumOfCusFr
()))
{
if
(!
DataUtil
.
isNullOrZero
(
requestDto
.
getNumOfCusFr
()))
{
sb
.
append
(
" AND a.CUSTOMER_NUMBER >= :p_cusNumFr"
);
sb
.
append
(
" AND a.CUSTOMER_NUMBER >= :p_cusNumFr"
);
...
@@ -185,16 +180,16 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
...
@@ -185,16 +180,16 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
query
.
setParameterList
(
"p_statuses"
,
statuses
);
query
.
setParameterList
(
"p_statuses"
,
statuses
);
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getFromDateFr
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getFromDateFr
()))
{
query
.
setParameter
(
"p_frDateFr"
,
requestDto
.
getFromDateFr
(
));
query
.
setParameter
(
"p_frDateFr"
,
TimeZoneUtils
.
toDateStringWithTimeZone
(
DateTimeUtil
.
parseDate
(
"YYYYMMdd"
,
requestDto
.
getFromDateFr
()),
tzClient
));
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getFromDateTo
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getFromDateTo
()))
{
query
.
setParameter
(
"p_frDateTo"
,
requestDto
.
getFromDateTo
(
));
query
.
setParameter
(
"p_frDateTo"
,
TimeZoneUtils
.
toDateStringWithTimeZone
(
DateTimeUtil
.
parseDate
(
"YYYYMMdd"
,
requestDto
.
getFromDateTo
()),
tzClient
));
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getToDateFr
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getToDateFr
()))
{
query
.
setParameter
(
"p_toDateFr"
,
requestDto
.
getToDateFr
(
));
query
.
setParameter
(
"p_toDateFr"
,
TimeZoneUtils
.
toDateStringWithTimeZone
(
DateTimeUtil
.
parseDate
(
"YYYYMMdd"
,
requestDto
.
getToDateFr
()),
tzClient
));
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getToDateTo
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getToDateTo
()))
{
query
.
setParameter
(
"p_toDateTo"
,
requestDto
.
getToDateTo
(
));
query
.
setParameter
(
"p_toDateTo"
,
TimeZoneUtils
.
toDateStringWithTimeZone
(
DateTimeUtil
.
parseDate
(
"YYYYMMdd"
,
requestDto
.
getToDateTo
()),
tzClient
));
}
}
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getTypes
()))
{
if
(!
DataUtil
.
isNullOrEmpty
(
requestDto
.
getTypes
()))
{
String
[]
types
=
requestDto
.
getTypes
().
split
(
","
);
String
[]
types
=
requestDto
.
getTypes
().
split
(
","
);
...
@@ -247,10 +242,18 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
...
@@ -247,10 +242,18 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
query
.
setMaxResults
(
pageable
.
getPageSize
());
query
.
setMaxResults
(
pageable
.
getPageSize
());
}
}
List
<
CampaignDTO
>
data
=
query
.
list
();
List
<
CampaignDTO
>
data
=
query
.
list
();
data
.
forEach
(
item
->
{
item
.
setStartTime
(
DateTimeUtil
.
parseDate
(
"dd/MM/yyyy HH:mm:ss"
,
TimeZoneUtils
.
toDateStringWithTimeZone
(
item
.
getStartTime
(),
tzClient
)));
item
.
setEndTime
(
DateTimeUtil
.
parseDate
(
"dd/MM/yyyy HH:mm:ss"
,
TimeZoneUtils
.
toDateStringWithTimeZone
(
item
.
getEndTime
(),
tzClient
)));
});
Page
<
CampaignDTO
>
dataPage
=
new
PageImpl
<>(
data
,
pageable
,
count
);
Page
<
CampaignDTO
>
dataPage
=
new
PageImpl
<>(
data
,
pageable
,
count
);
result
.
setData
(
dataPage
);
result
.
setData
(
dataPage
);
}
else
{
}
else
{
List
<
CampaignDTO
>
dataExport
=
query
.
list
();
List
<
CampaignDTO
>
dataExport
=
query
.
list
();
dataExport
.
forEach
(
item
->
{
item
.
setStartTime
(
DateTimeUtil
.
parseDate
(
"dd/MM/yyyy HH:mm:ss"
,
TimeZoneUtils
.
toDateStringWithTimeZone
(
item
.
getStartTime
(),
tzClient
)));
item
.
setEndTime
(
DateTimeUtil
.
parseDate
(
"dd/MM/yyyy HH:mm:ss"
,
TimeZoneUtils
.
toDateStringWithTimeZone
(
item
.
getEndTime
(),
tzClient
)));
});
result
.
setData
(
dataExport
);
result
.
setData
(
dataExport
);
}
}
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
...
...
src/main/java/com/viettel/campaign/service/CampaignCfgService.java
View file @
9a9fed56
...
@@ -20,7 +20,7 @@ public interface CampaignCfgService {
...
@@ -20,7 +20,7 @@ public interface CampaignCfgService {
ResultDTO
deleteList
(
CampaignCfgRequestDTO
campaignCfgRequestDTO
);
ResultDTO
deleteList
(
CampaignCfgRequestDTO
campaignCfgRequestDTO
);
ResultDTO
deleteById
(
Long
id
);
ResultDTO
deleteById
(
CampaignCfgRequestDTO
campaignCfgRequestDTO
);
ResultDTO
findMaxValueCampaignCompleteCode
(
CampaignCfgDTO
completeCodeDTO
);
ResultDTO
findMaxValueCampaignCompleteCode
(
CampaignCfgDTO
completeCodeDTO
);
...
...
src/main/java/com/viettel/campaign/service/impl/CampaignCfgServiceImpl.java
View file @
9a9fed56
...
@@ -167,12 +167,6 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
...
@@ -167,12 +167,6 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
try
{
try
{
if
(
completeCodeDTO
!=
null
)
{
if
(
completeCodeDTO
!=
null
)
{
// insert
// compCode = compCodeMapper.toPersistenceBean(completeCodeDTO);
// compCode = completeCodeRepository.save(compCode);
//
// resultDTO.setErrorCode("0");
// resultDTO.setDescription("Complete Code: " + compCode.getCampaignCompleteCodeId() + " created!");
CampaignCfg
cl
=
new
CampaignCfg
();
CampaignCfg
cl
=
new
CampaignCfg
();
cl
.
setStatus
((
short
)
1
);
cl
.
setStatus
((
short
)
1
);
cl
.
setCreateBy
(
String
.
valueOf
(
userId
));
cl
.
setCreateBy
(
String
.
valueOf
(
userId
));
...
@@ -241,14 +235,23 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
...
@@ -241,14 +235,23 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
deleteCompleteCode
(
CampaignCfgRequestDTO
completeCodeDTO
)
{
public
ResultDTO
deleteCompleteCode
(
CampaignCfgRequestDTO
completeCodeDTO
)
{
ResultDTO
resultDTO
=
new
ResultDTO
();
ResultDTO
resultDTO
=
new
ResultDTO
();
List
<
Long
>
listId
=
new
ArrayList
<>();
listId
.
add
(
completeCodeDTO
.
getCampaignCompleteCodeID
());
try
{
try
{
// delete
// delete
if
(
completeCodeDTO
!=
null
)
{
if
(
completeCodeDTO
!=
null
)
{
completeCodeRepository
.
deleteCampaignCompleteCodeBy
(
completeCodeDTO
.
getCampaignCompleteCodeID
(),
completeCodeDTO
.
getCompanySiteId
());
// completeCodeRepository.deleteCampaignCompleteCodeBy(completeCodeDTO.getCampaignCompleteCodeID(), completeCodeDTO.getCompanySiteId());
if
(
completeCodeRepository
.
findAllCampaignCfg
(
listId
,
completeCodeDTO
.
getCompanySiteId
()).
size
()
>
0
)
{
completeCodeRepository
.
deleteCampaignCompleteCodeBy
(
completeCodeDTO
.
getCampaignCompleteCodeID
(),
completeCodeDTO
.
getCompanySiteId
());
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
}
else
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
}
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
}
else
{
}
else
{
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
...
@@ -256,6 +259,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
...
@@ -256,6 +259,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// e.printStackTrace();
// e.printStackTrace();
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
return
resultDTO
;
return
resultDTO
;
...
@@ -284,26 +288,36 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
...
@@ -284,26 +288,36 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// e.printStackTrace();
// e.printStackTrace();
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
return
resultDTO
;
return
resultDTO
;
}
}
@Override
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
deleteById
(
Long
id
)
{
public
ResultDTO
deleteById
(
CampaignCfgRequestDTO
completeCodeDTO
)
{
ResultDTO
result
=
new
ResultDTO
();
ResultDTO
result
=
new
ResultDTO
();
try
{
try
{
completeCodeRepository
.
deleteById
(
id
);
if
(
completeCodeDTO
!=
null
)
{
result
.
setErrorCode
(
Constants
.
Status
.
ACTIVE_STR
);
if
(
completeCodeRepository
.
findAllCampaignCfg
(
completeCodeDTO
.
getListId
(),
completeCodeDTO
.
getCompanySiteId
()).
size
()
>
0
)
{
result
.
setDescription
(
Constants
.
Status
.
ACTIVE_STR
);
completeCodeRepository
.
deletedList
(
completeCodeDTO
.
getListId
(),
completeCodeDTO
.
getCompanySiteId
());
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
result
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
}
else
{
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
result
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
}
}
else
{
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
result
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
result
.
setErrorCode
(
"-1"
);
// e.printStackTrace(
);
return
result
;
logger
.
error
(
e
.
getMessage
(),
e
)
;
}
}
result
.
setErrorCode
(
"0"
);
return
result
;
return
result
;
}
}
...
...
src/main/java/com/viettel/campaign/service/impl/CampaignServiceImpl.java
View file @
9a9fed56
...
@@ -357,7 +357,7 @@ public class CampaignServiceImpl implements CampaignService {
...
@@ -357,7 +357,7 @@ public class CampaignServiceImpl implements CampaignService {
entity
.
setUpdateBy
(
campaignDTO
.
getUpdateBy
());
entity
.
setUpdateBy
(
campaignDTO
.
getUpdateBy
());
entity
.
setEndTime
(
campaignDTO
.
getEndTime
());
entity
.
setEndTime
(
campaignDTO
.
getEndTime
());
campaignRepository
.
save
(
entity
);
//
campaignRepository.save(entity);
UserActionLogDTO
userActionLog
=
new
UserActionLogDTO
();
UserActionLogDTO
userActionLog
=
new
UserActionLogDTO
();
userActionLog
.
setAgentId
(
null
);
userActionLog
.
setAgentId
(
null
);
...
@@ -368,7 +368,7 @@ public class CampaignServiceImpl implements CampaignService {
...
@@ -368,7 +368,7 @@ public class CampaignServiceImpl implements CampaignService {
userActionLog
.
setEndTime
(
null
);
userActionLog
.
setEndTime
(
null
);
userActionLog
.
setObjectId
(
entity
.
getCampaignId
());
userActionLog
.
setObjectId
(
entity
.
getCampaignId
());
userActionLog
.
setActionType
((
short
)
6
);
userActionLog
.
setActionType
((
short
)
6
);
userActionLogRepository
.
insertToUserActionLog
(
userActionLog
);
//
userActionLogRepository.insertToUserActionLog(userActionLog);
resultDTO
.
setData
(
entity
);
resultDTO
.
setData
(
entity
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
...
...
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
View file @
9a9fed56
This diff is collapsed.
Click to expand it.
src/main/java/com/viettel/campaign/service/impl/ScenarioQuestionServiceImpl.java
View file @
9a9fed56
...
@@ -69,6 +69,7 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
...
@@ -69,6 +69,7 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
ResultDTO
resultDTO
=
new
ResultDTO
();
ResultDTO
resultDTO
=
new
ResultDTO
();
List
<
ScenarioAnswerDTO
>
lstAnswers
=
new
ArrayList
<>();
List
<
ScenarioAnswerDTO
>
lstAnswers
=
new
ArrayList
<>();
List
<
ScenarioAnswer
>
lstAnswersToInsert
=
new
ArrayList
<>();
List
<
ScenarioAnswer
>
lstAnswersToInsert
=
new
ArrayList
<>();
scenarioQuestionDTO
.
setQuestion
(
scenarioQuestionDTO
.
getQuestion
().
trim
());
try
{
try
{
ScenarioQuestion
scenarioQuestion
=
modelMapper
.
map
(
scenarioQuestionDTO
,
ScenarioQuestion
.
class
);
ScenarioQuestion
scenarioQuestion
=
modelMapper
.
map
(
scenarioQuestionDTO
,
ScenarioQuestion
.
class
);
...
...
src/main/java/com/viettel/campaign/utils/Constants.java
View file @
9a9fed56
...
@@ -7,10 +7,12 @@ public class Constants {
...
@@ -7,10 +7,12 @@ public class Constants {
public
interface
ApiErrorCode
{
public
interface
ApiErrorCode
{
String
ERROR
=
"01"
;
String
ERROR
=
"01"
;
String
SUCCESS
=
"00"
;
String
SUCCESS
=
"00"
;
String
DELETE_ERROR
=
"02"
;
}
}
public
interface
ApiErrorDesc
{
public
interface
ApiErrorDesc
{
String
ERROR
=
"ERROR"
;
String
ERROR
=
"ERROR"
;
String
SUCCESS
=
"SUCCESS"
;
String
SUCCESS
=
"SUCCESS"
;
String
DELETE_ERROR
=
"DELETE_ERROR"
;
}
}
public
interface
FileType
{
public
interface
FileType
{
String
pdf
=
"pdf"
;
String
pdf
=
"pdf"
;
...
...
src/main/java/com/viettel/campaign/utils/TimeZoneUtils.java
0 → 100644
View file @
9a9fed56
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
com.viettel.campaign.utils
;
import
org.apache.log4j.Logger
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.TimeZone
;
import
java.util.concurrent.TimeUnit
;
import
java.util.logging.Level
;
/**
*
* @author phamky
*/
public
class
TimeZoneUtils
{
private
static
Long
getTimeZone
(
TimeZone
tz
)
{
return
TimeUnit
.
MILLISECONDS
.
toHours
(
tz
.
getRawOffset
());
}
private
static
Long
getTimeZoneToMinutes
(
TimeZone
tz
)
{
return
TimeUnit
.
MILLISECONDS
.
toMinutes
(
tz
.
getRawOffset
());
}
public
static
String
toQueryTimeZoneZero
(
Date
date
){
String
dateStr
=
toDateStringWithTimeZoneZero
(
date
);
return
"to_date( '"
+
dateStr
+
"', 'DD/MM/YYYY HH24:MI:SS')"
;
}
public
static
String
changeTimeZoneString
(
String
dateStr
,
TimeZone
tz
){
try
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"dd/MM/yyyy HH:mm:ss"
);
Date
date
=
sdf
.
parse
(
dateStr
);
sdf
.
setTimeZone
(
tz
);
return
sdf
.
format
(
date
);
}
catch
(
ParseException
ex
)
{
}
return
""
;
}
public
static
String
changeTimeZoneStringPattern
(
String
dateStr
,
TimeZone
tz
,
String
pattern
){
try
{
SimpleDateFormat
sdf1
=
new
SimpleDateFormat
(
"dd/MM/yyyy HH:mm:ss"
);
Date
date
=
sdf1
.
parse
(
dateStr
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
pattern
);
sdf
.
setTimeZone
(
tz
);
return
sdf
.
format
(
date
);
}
catch
(
ParseException
ex
)
{
}
return
""
;
}
public
static
String
toDateStringWithTimeZoneZero
(
Date
date
){
TimeZone
tz
=
getZone
(
0
l
);
return
toDateStringWithTimeZone
(
date
,
tz
);
}
public
static
String
toDateStringWithTimeZonePattern
(
Date
date
,
long
tz
,
String
pattern
){
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
pattern
);
sdf
.
setTimeZone
(
getZone
(
tz
));
return
sdf
.
format
(
date
);
}
// public static String toHourStringWithTimeZonePattern(Long hour, long tz){
// SimpleDateFormat sdf = new SimpleDateFormat(pattern);
// sdf.setTimeZone(getZone(tz));
// return sdf.format(date);
// }
public
static
String
toDateStringWithTimeZonePattern
(
Date
date
,
TimeZone
tz
,
String
pattern
){
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
pattern
);
sdf
.
setTimeZone
(
tz
);
return
sdf
.
format
(
date
);
}
public
static
String
toDateStringWithTimeZone
(
Date
date
,
TimeZone
tz
){
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"dd/MM/yyyy HH:mm:ss"
);
sdf
.
setTimeZone
(
tz
);
return
sdf
.
format
(
date
);
}
public
static
TimeZone
getZone
(
Long
timeZone
){
if
(
timeZone
==
null
){
//timezone is null, return default
return
TimeZone
.
getDefault
();
}
String
[]
ids
=
TimeZone
.
getAvailableIDs
();
for
(
String
id
:
ids
)
{
TimeZone
tz
=
TimeZone
.
getTimeZone
(
id
);
if
(
getTimeZone
(
tz
).
equals
(
timeZone
)){
//zone need change
return
tz
;
}
}
return
TimeZone
.
getDefault
();
}
public
static
TimeZone
getZoneMinutes
(
Long
timeZone
){
if
(
timeZone
==
null
){
//timezone is null, return default
return
TimeZone
.
getDefault
();
}
String
[]
ids
=
TimeZone
.
getAvailableIDs
();
for
(
String
id
:
ids
)
{
TimeZone
tz
=
TimeZone
.
getTimeZone
(
id
);
if
(
getTimeZoneToMinutes
(
tz
).
equals
(
timeZone
)){
//zone need change
return
tz
;
}
}
return
TimeZone
.
getDefault
();
}
public
static
Date
changeTimeZone
(
Date
date
,
Long
timeZone
){
if
(
timeZone
==
null
){
//timezone is null, do not change timezone
return
date
;
}
String
[]
ids
=
TimeZone
.
getAvailableIDs
();
for
(
String
id
:
ids
)
{
TimeZone
tz
=
TimeZone
.
getTimeZone
(
id
);
if
(
getTimeZone
(
tz
).
equals
(
timeZone
)){
//zone need change
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
df
.
setTimeZone
(
tz
);
try
{
SimpleDateFormat
df2
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
newDate
=
df2
.
parse
(
df
.
format
(
date
));
System
.
out
.
println
(
df2
.
format
(
newDate
));
return
newDate
;
}
catch
(
ParseException
ex
)
{
}
}
}
return
date
;
}
public
static
void
main
(
String
args
[]){
Date
date
=
new
Date
();
System
.
out
.
println
(
changeTimeZone
(
date
,
-
6
l
));
System
.
out
.
println
(
changeTimeZone
(
date
,
0
l
));
System
.
out
.
println
(
getZone
(
0
l
));
}
}
src/main/java/com/viettel/campaign/web/dto/CampaignDTO.java
View file @
9a9fed56
...
@@ -66,4 +66,7 @@ public class CampaignDTO extends BaseDTO {
...
@@ -66,4 +66,7 @@ public class CampaignDTO extends BaseDTO {
private
String
sessionId
;
private
String
sessionId
;
private
Long
numOfInteractedCus
;
private
Long
numOfInteractedCus
;
private
Long
numOfNotInteractedCus
;
private
Long
numOfNotInteractedCus
;
//timezone to get true date
private
Double
timezone
;
}
}
src/main/java/com/viettel/campaign/web/dto/request_dto/CampaignCfgRequestDTO.java
View file @
9a9fed56
...
@@ -10,5 +10,5 @@ public class CampaignCfgRequestDTO {
...
@@ -10,5 +10,5 @@ public class CampaignCfgRequestDTO {
List
<
Long
>
listId
;
List
<
Long
>
listId
;
Long
companySiteId
;
Long
companySiteId
;
Long
campaignCompleteCodeID
;
Long
campaignCompleteCodeID
;
String
completeValue
;
}
}
src/main/java/com/viettel/campaign/web/dto/request_dto/SearchCustomerRequestDTO.java
View file @
9a9fed56
...
@@ -12,4 +12,5 @@ public class SearchCustomerRequestDTO extends BaseDTO {
...
@@ -12,4 +12,5 @@ public class SearchCustomerRequestDTO extends BaseDTO {
String
convertedDateFrom
;
String
convertedDateFrom
;
String
convertedDateTo
;
String
convertedDateTo
;
String
companySiteId
;
String
companySiteId
;
Integer
timezoneOffset
;
}
}
src/main/java/com/viettel/campaign/web/rest/CampaignCfgController.java
View file @
9a9fed56
...
@@ -106,9 +106,9 @@ public class CampaignCfgController {
...
@@ -106,9 +106,9 @@ public class CampaignCfgController {
@PostMapping
(
"/deleteById"
)
@PostMapping
(
"/deleteById"
)
@ResponseBody
@ResponseBody
public
ResultDTO
deleteById
(
@Request
Param
(
"id"
)
Long
id
){
public
ResultDTO
deleteById
(
@Request
Body
@Valid
CampaignCfgRequestDTO
campaignCfgRequestDTO
){
ResultDTO
resultDTO
=
new
ResultDTO
();
ResultDTO
resultDTO
=
new
ResultDTO
();
resultDTO
=
completeCodeService
.
deleteById
(
id
);
resultDTO
=
completeCodeService
.
deleteById
(
campaignCfgRequestDTO
);
return
resultDTO
;
return
resultDTO
;
}
}
...
...
src/main/resources/i18n/language_en.properties
View file @
9a9fed56
...
@@ -87,15 +87,13 @@ customer.cusType.vip = VIP
...
@@ -87,15 +87,13 @@ customer.cusType.vip = VIP
customer.cusType.blacklist
=
Blacklist
customer.cusType.blacklist
=
Blacklist
customer.yes
=
Yes
customer.yes
=
Yes
customer.not
=
No
customer.not
=
No
customer.noData
=
Template empty
customer.nameRequired
=
Full name required;
customer.nameRequired
=
Full name required;
customer.emailMax100
=
Email must less than 100 character;
customer.invalidRecord
=
Invalid Record, required one more contact information;
customer.invalidRecord
=
Invalid Record, required one more contact information;
customer.onlyNumber
=
Phone contain number only;
customer.onlyNumber
=
Phone contain number only;
customer.importSuccess
=
Import Successful
customer.importFailed
=
Import Failed
customer.errorValidate
=
Error while validating
customer.errorValidate
=
Error while validating
customer.phoneMax50
=
Mobile phone must less than 50 character;
customer.phoneMax50
=
Mobile phone must less than 50 characters;
customer.phone8to15
=
Mobile phone from 8 to 15 characters;
customer.3phone
=
Max 3 mobile phone;
customer.phoneExists
=
Mobile phone exists;
customer.phoneExists
=
Mobile phone exists;
customer.notMatch
=
not match regexp validation
customer.notMatch
=
not match regexp validation
customer.notGreaterThan
=
not greater than
customer.notGreaterThan
=
not greater than
...
...
src/main/resources/i18n/language_vi.properties
View file @
9a9fed56
...
@@ -89,15 +89,13 @@ customer.cusType.vip = VIP
...
@@ -89,15 +89,13 @@ customer.cusType.vip = VIP
customer.cusType.blacklist
=
Blacklist
customer.cusType.blacklist
=
Blacklist
customer.yes
=
Có
customer.yes
=
Có
customer.not
=
Không
customer.not
=
Không
customer.noData
=
Template không có dữ liệu
customer.nameRequired
=
Họ và tên không được để trống;
customer.nameRequired
=
Họ và tên không được để trống;
customer.emailMax100
=
Email không được quá 100 kí tự;
customer.invalidRecord
=
Bắt buộc nhập 1 trong 3 thông tin liên lạc(Số điện thoại chính, Số điện thoại phụ, Email);
customer.invalidRecord
=
Bắt buộc nhập 1 trong 3 thông tin liên lạc(Số điện thoại chính, Số điện thoại phụ, Email);
customer.onlyNumber
=
Số điện thoại chỉ được nhập số;
customer.onlyNumber
=
Số điện thoại chỉ được nhập số;
customer.importSuccess
=
Import dữ liệu thành công
customer.importFailed
=
Import dữ liệu thất bại
customer.errorValidate
=
Validate dữ liệu lỗi
customer.errorValidate
=
Validate dữ liệu lỗi
customer.phoneMax50
=
Số điện thoại không được quá 50 kí tự;
customer.phoneMax50
=
Số điện thoại không được quá 50 kí tự;
customer.phone8to15
=
Số điện thoại chỉ được từ 8 đến 15 kí tự;
customer.3phone
=
Tối đa chỉ được nhập 3 số điện thoại;
customer.phoneExists
=
Số điện thoại chính đã tồn tại;
customer.phoneExists
=
Số điện thoại chính đã tồn tại;
customer.notMatch
=
không đúng định dạng
customer.notMatch
=
không đúng định dạng
customer.notGreaterThan
=
không được lớn hơn
customer.notGreaterThan
=
không được lớn hơn
...
...
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