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
8890ea24
Commit
8890ea24
authored
Aug 26, 2019
by
Tu Bach
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into tubn
parents
7a345766
0193956c
Changes
14
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
334 additions
and
185 deletions
+334
-185
pom.xml
pom.xml
+2
-2
src/main/java/com/viettel/campaign/filter/CorsFilter.java
src/main/java/com/viettel/campaign/filter/CorsFilter.java
+21
-22
src/main/java/com/viettel/campaign/job/CampaignJob.java
src/main/java/com/viettel/campaign/job/CampaignJob.java
+63
-63
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignExecuteRepositoryImp.java
...pository/ccms_full/impl/CampaignExecuteRepositoryImp.java
+6
-5
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignRepositoryImpl.java
...ign/repository/ccms_full/impl/CampaignRepositoryImpl.java
+3
-3
src/main/java/com/viettel/campaign/service/CustomerService.java
...in/java/com/viettel/campaign/service/CustomerService.java
+2
-0
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
...om/viettel/campaign/service/impl/CustomerServiceImpl.java
+83
-52
src/main/java/com/viettel/campaign/service/impl/ScenarioServiceImpl.java
...om/viettel/campaign/service/impl/ScenarioServiceImpl.java
+105
-24
src/main/java/com/viettel/campaign/utils/Config.java
src/main/java/com/viettel/campaign/utils/Config.java
+2
-1
src/main/java/com/viettel/campaign/web/rest/CustomerController.java
...ava/com/viettel/campaign/web/rest/CustomerController.java
+22
-11
src/main/java/com/viettel/campaign/web/rest/ScenarioController.java
...ava/com/viettel/campaign/web/rest/ScenarioController.java
+1
-1
src/main/resources/application.yml
src/main/resources/application.yml
+5
-1
src/main/resources/i18n/language_en.properties
src/main/resources/i18n/language_en.properties
+10
-0
src/main/resources/i18n/language_vi.properties
src/main/resources/i18n/language_vi.properties
+9
-0
No files found.
pom.xml
View file @
8890ea24
...
@@ -49,8 +49,8 @@
...
@@ -49,8 +49,8 @@
<dependency>
<dependency>
<groupId>
com.oracle
</groupId>
<groupId>
com.oracle
</groupId>
<artifactId>
ojdbc7
</artifactId>
<artifactId>
ojdbc7
</artifactId>
<scope>
system
</scope
>
<!-- <scope>system</scope>--
>
<systemPath>
${project.basedir}/lib/ojdbc7.jar
</systemPath
>
<!-- <systemPath>${project.basedir}/lib/ojdbc7.jar</systemPath>--
>
<version>
1.0
</version>
<version>
1.0
</version>
</dependency>
</dependency>
<dependency>
<dependency>
...
...
src/main/java/com/viettel/campaign/filter/CorsFilter.java
View file @
8890ea24
...
@@ -2,7 +2,6 @@ package com.viettel.campaign.filter;
...
@@ -2,7 +2,6 @@ package com.viettel.campaign.filter;
import
com.viettel.campaign.utils.RedisUtil
;
import
com.viettel.campaign.utils.RedisUtil
;
import
com.viettel.econtact.filter.UserSession
;
import
com.viettel.econtact.filter.UserSession
;
import
org.apache.log4j.Logger
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.servlet.*
;
import
javax.servlet.*
;
...
@@ -31,27 +30,27 @@ public class CorsFilter implements Filter {
...
@@ -31,27 +30,27 @@ public class CorsFilter implements Filter {
HttpServletRequest
request
=
(
HttpServletRequest
)
req
;
HttpServletRequest
request
=
(
HttpServletRequest
)
req
;
chain
.
doFilter
(
req
,
resp
);
// chain.doFilter(req, response
);
//
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
if
(
"OPTIONS"
.
equalsIgnoreCase
(
request
.
getMethod
()))
{
//
chain.doFilter(req, resp);
chain
.
doFilter
(
req
,
resp
);
//
return;
return
;
//
}
}
//
if ("/".equals(request.getRequestURI())) {
if
(
"/"
.
equals
(
request
.
getRequestURI
()))
{
//
chain.doFilter(req, resp);
chain
.
doFilter
(
req
,
resp
);
//
return;
return
;
//
}
}
//
String xAuthToken = request.getHeader("X-Auth-Token");
String
xAuthToken
=
request
.
getHeader
(
"X-Auth-Token"
);
//
if (xAuthToken == null || "".equals(xAuthToken)) {
if
(
xAuthToken
==
null
||
""
.
equals
(
xAuthToken
))
{
//
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is null.");
response
.
sendError
(
HttpServletResponse
.
SC_UNAUTHORIZED
,
"The token is null."
);
//
return;
return
;
//
}
}
//
Object obj = RedisUtil.getInstance().get(xAuthToken);
Object
obj
=
RedisUtil
.
getInstance
().
get
(
xAuthToken
);
//
if (obj instanceof UserSession) {
if
(
obj
instanceof
UserSession
)
{
//
chain.doFilter(req, resp);
chain
.
doFilter
(
req
,
resp
);
//
} else {
}
else
{
//
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is invalid.");
response
.
sendError
(
HttpServletResponse
.
SC_UNAUTHORIZED
,
"The token is invalid."
);
//
}
}
}
}
@Override
@Override
...
...
src/main/java/com/viettel/campaign/job/CampaignJob.java
View file @
8890ea24
...
@@ -42,69 +42,69 @@ public class CampaignJob {
...
@@ -42,69 +42,69 @@ public class CampaignJob {
// @Scheduled(fixedRate = 5000)
// @Scheduled(fixedRate = 5000)
// @Transactional( propagation = Propagation.REQUIRED)
// @Transactional( propagation = Propagation.REQUIRED)
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
();
//
//
list.parallelStream().forEach(p -> {
list
.
parallelStream
().
forEach
(
p
->
{
//
boolean isExecute = DateTimeUtil.isRun(p.getConfigValue(), p.getLastProcess());
boolean
isExecute
=
DateTimeUtil
.
isRun
(
p
.
getConfigValue
(),
p
.
getLastProcess
());
//
switch (p.getConfigCode()){
switch
(
p
.
getConfigCode
()){
//
case CUSTOMER_INACTIVE_DUARATION:
case
CUSTOMER_INACTIVE_DUARATION:
//
if(isExecute){
if
(
isExecute
){
//
List<Customer> customers = customerService.findAllByCondition(p.getSiteId(), new Date());
List
<
Customer
>
customers
=
customerService
.
findAllByCondition
(
p
.
getSiteId
(),
new
Date
());
//
updateCustomer(customers);
updateCustomer
(
customers
);
//
updateCustomerTime(customers);
updateCustomerTime
(
customers
);
//
log.info("Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}", p.getSiteId());
log
.
info
(
"Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}"
,
p
.
getSiteId
());
//
p.setLastProcess(new Date());
p
.
setLastProcess
(
new
Date
());
//
processConfigService.update(p);
processConfigService
.
update
(
p
);
//
}
}
//
break;
break
;
//
case CRON_EXPRESSION_CHECK_START:
case
CRON_EXPRESSION_CHECK_START:
//
// process
// process
//
if(isExecute){
if
(
isExecute
){
//
List<Long> status = new ArrayList<>();
List
<
Long
>
status
=
new
ArrayList
<>();
//
status.add(1L);
status
.
add
(
1L
);
//
status.add(1L);
status
.
add
(
1L
);
//
List<Campaign> campaigns = campaignService.findCampaignByCompanySiteIdAndStartTimeIsLessThanEqualAndStatusIn(p.getSiteId(), new Date(), status);
List
<
Campaign
>
campaigns
=
campaignService
.
findCampaignByCompanySiteIdAndStartTimeIsLessThanEqualAndStatusIn
(
p
.
getSiteId
(),
new
Date
(),
status
);
//
campaigns.parallelStream().forEach(campaign -> {
campaigns
.
parallelStream
().
forEach
(
campaign
->
{
//
log.info("Chuyen trang thai chien dich ... #{} ... tu Du thao sang Trien khai", campaign.getCampaignId());
log
.
info
(
"Chuyen trang thai chien dich ... #{} ... tu Du thao sang Trien khai"
,
campaign
.
getCampaignId
());
//
campaign.setProcessStatus(1);
campaign
.
setProcessStatus
(
1
);
//
campaign.setStatus(2L);
campaign
.
setStatus
(
2L
);
//
campaign.setCampaignStart(new Date());
campaign
.
setCampaignStart
(
new
Date
());
//
campaignService.updateProcess(campaign);
campaignService
.
updateProcess
(
campaign
);
//
//write log
//write log
//
saveLog(campaign, 1);
saveLog
(
campaign
,
1
);
//
});
});
//
//
log.info("Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}", p.getSiteId());
log
.
info
(
"Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}"
,
p
.
getSiteId
());
//
p.setLastProcess(new Date());
p
.
setLastProcess
(
new
Date
());
//
processConfigService.update(p);
processConfigService
.
update
(
p
);
//
}
}
//
break;
break
;
//
case CRON_EXPRESSION_CHECK_END:
case
CRON_EXPRESSION_CHECK_END:
//
// process
// process
//
if(isExecute){
if
(
isExecute
){
//
List<Long> status = new ArrayList<>();
List
<
Long
>
status
=
new
ArrayList
<>();
//
status.add(2L);
status
.
add
(
2L
);
//
status.add(3L);
status
.
add
(
3L
);
//
List<Campaign> campaigns = campaignService.findCampaignByCompanySiteIdAndEndTimeIsLessThanEqualAndStatusIn(p.getSiteId(), new Date(), status);
List
<
Campaign
>
campaigns
=
campaignService
.
findCampaignByCompanySiteIdAndEndTimeIsLessThanEqualAndStatusIn
(
p
.
getSiteId
(),
new
Date
(),
status
);
//
campaigns.parallelStream().forEach(campaign -> {
campaigns
.
parallelStream
().
forEach
(
campaign
->
{
//
log.info("Chuyen trang thai chien dich ... #{} ... sang Ket thuc", campaign.getCampaignId());
log
.
info
(
"Chuyen trang thai chien dich ... #{} ... sang Ket thuc"
,
campaign
.
getCampaignId
());
//
campaign.setStatus(4L);
campaign
.
setStatus
(
4L
);
//
campaign.setCampaignEnd(new Date());
campaign
.
setCampaignEnd
(
new
Date
());
//
campaignService.updateProcess(campaign);
campaignService
.
updateProcess
(
campaign
);
//
//write log
//write log
//
saveLog(campaign, 2);
saveLog
(
campaign
,
2
);
//
});
});
//
//
log.info("Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}", p.getSiteId());
log
.
info
(
"Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}"
,
p
.
getSiteId
());
//
p.setLastProcess(new Date());
p
.
setLastProcess
(
new
Date
());
//
processConfigService.update(p);
processConfigService
.
update
(
p
);
//
}
}
//
break;
break
;
//
default:
default
:
//
// update last check time
// update last check time
//
}
}
//
});
});
}
}
...
...
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignExecuteRepositoryImp.java
View file @
8890ea24
...
@@ -149,7 +149,7 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
...
@@ -149,7 +149,7 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
sql
.
append
(
" f.complete_name surveyStatus,"
);
sql
.
append
(
" f.complete_name surveyStatus,"
);
sql
.
append
(
" g.status status,"
);
sql
.
append
(
" g.status status,"
);
sql
.
append
(
" a.status recordStatus,"
);
sql
.
append
(
" a.status recordStatus,"
);
sql
.
append
(
"
(a.end_time - a.start_call)*24*60
callTime"
);
sql
.
append
(
"
nvl((a.end_time - a.start_call)*24*60, 0)
callTime"
);
sql
.
append
(
" from contact_cust_result a"
);
sql
.
append
(
" from contact_cust_result a"
);
sql
.
append
(
" left join campaign b on a.campaign_id = b.campaign_id"
);
sql
.
append
(
" left join campaign b on a.campaign_id = b.campaign_id"
);
sql
.
append
(
" left join vsa_users c on a.agent_id = c.user_id"
);
sql
.
append
(
" left join vsa_users c on a.agent_id = c.user_id"
);
...
@@ -175,6 +175,7 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
...
@@ -175,6 +175,7 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
sql
.
append
(
" select a.*, rownum row_ from data_temp a"
);
sql
.
append
(
" select a.*, rownum row_ from data_temp a"
);
sql
.
append
(
" where a.callTime >= :p_call_time_from"
);
sql
.
append
(
" where a.callTime >= :p_call_time_from"
);
sql
.
append
(
" and a.callTime <= :p_call_time_to"
);
sql
.
append
(
" and a.callTime <= :p_call_time_to"
);
sql
.
append
(
" order by a.createTime desc"
);
sql
.
append
(
" ),"
);
sql
.
append
(
" ),"
);
sql
.
append
(
" count_total as ("
);
sql
.
append
(
" count_total as ("
);
sql
.
append
(
" select count(*) totalRow from data"
);
sql
.
append
(
" select count(*) totalRow from data"
);
...
@@ -195,8 +196,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
...
@@ -195,8 +196,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
query
.
setParameter
(
"p_call_time_to"
,
dto
.
getCallTimeTo
());
query
.
setParameter
(
"p_call_time_to"
,
dto
.
getCallTimeTo
());
query
.
setParameter
(
"p_list_campaign_code"
,
dto
.
getCampaignCode
());
query
.
setParameter
(
"p_list_campaign_code"
,
dto
.
getCampaignCode
());
query
.
setParameter
(
"p_phone_number"
,
dto
.
getPhoneNumber
());
query
.
setParameter
(
"p_phone_number"
,
dto
.
getPhoneNumber
());
query
.
setParameter
(
"p_campaign_name"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignName
())
?
null
:
dto
.
getCampaignName
().
toUpperCase
());
query
.
setParameter
(
"p_campaign_name"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignName
())
?
null
:
dto
.
getCampaignName
().
t
rim
().
t
oUpperCase
());
query
.
setParameter
(
"p_user_name"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getAgentId
())
?
null
:
dto
.
getAgentId
().
toUpperCase
());
query
.
setParameter
(
"p_user_name"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getAgentId
())
?
null
:
dto
.
getAgentId
().
t
rim
().
t
oUpperCase
());
query
.
setParameter
(
"p_page_number"
,
dto
.
getPage
());
query
.
setParameter
(
"p_page_number"
,
dto
.
getPage
());
query
.
setParameter
(
"p_page_size"
,
dto
.
getPageSize
());
query
.
setParameter
(
"p_page_size"
,
dto
.
getPageSize
());
...
@@ -342,8 +343,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
...
@@ -342,8 +343,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
query
.
setParameter
(
"p_call_time_to"
,
dto
.
getCallTimeTo
());
query
.
setParameter
(
"p_call_time_to"
,
dto
.
getCallTimeTo
());
query
.
setParameter
(
"p_list_campaign_code"
,
dto
.
getCampaignCode
());
query
.
setParameter
(
"p_list_campaign_code"
,
dto
.
getCampaignCode
());
query
.
setParameter
(
"p_phone_number"
,
dto
.
getPhoneNumber
());
query
.
setParameter
(
"p_phone_number"
,
dto
.
getPhoneNumber
());
query
.
setParameter
(
"p_campaign_name"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignName
())
?
null
:
dto
.
getCampaignName
().
toUpperCase
());
query
.
setParameter
(
"p_campaign_name"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getCampaignName
())
?
null
:
dto
.
getCampaignName
().
t
rim
().
t
oUpperCase
());
query
.
setParameter
(
"p_user_name"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getAgentId
())
?
null
:
dto
.
getAgentId
().
toUpperCase
());
query
.
setParameter
(
"p_user_name"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getAgentId
())
?
null
:
dto
.
getAgentId
().
t
rim
().
t
oUpperCase
());
query
.
setParameter
(
"p_page_number"
,
dto
.
getPage
());
query
.
setParameter
(
"p_page_number"
,
dto
.
getPage
());
query
.
setParameter
(
"p_page_size"
,
dto
.
getPageSize
());
query
.
setParameter
(
"p_page_size"
,
dto
.
getPageSize
());
...
...
src/main/java/com/viettel/campaign/repository/ccms_full/impl/CampaignRepositoryImpl.java
View file @
8890ea24
...
@@ -309,7 +309,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
...
@@ -309,7 +309,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
"ORDER BY START_TIME DESC"
);
"ORDER BY START_TIME DESC"
);
SQLQuery
query
=
session
.
createSQLQuery
(
sb
.
toString
());
SQLQuery
query
=
session
.
createSQLQuery
(
sb
.
toString
());
query
.
setParameter
(
"p_company_site_id"
,
requestDto
.
getCompanySiteId
());
query
.
setParameter
(
"p_company_site_id"
,
requestDto
.
getCompanySiteId
());
query
.
setParameter
(
"p_code"
,
DataUtil
.
isNullOrEmpty
(
requestDto
.
getCampaignCode
())
?
null
:
requestDto
.
getCampaignCode
().
toUpperCase
());
query
.
setParameter
(
"p_code"
,
DataUtil
.
isNullOrEmpty
(
requestDto
.
getCampaignCode
())
?
null
:
requestDto
.
getCampaignCode
().
t
rim
().
t
oUpperCase
());
query
.
addScalar
(
"campaignId"
,
new
LongType
());
query
.
addScalar
(
"campaignId"
,
new
LongType
());
query
.
addScalar
(
"campaignCode"
,
new
StringType
());
query
.
addScalar
(
"campaignCode"
,
new
StringType
());
...
@@ -742,8 +742,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
...
@@ -742,8 +742,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
SQLQuery
query
=
session
.
createSQLQuery
(
sb
.
toString
());
SQLQuery
query
=
session
.
createSQLQuery
(
sb
.
toString
());
query
.
setParameter
(
"p_company_site_id"
,
dto
.
getCompanySiteId
());
query
.
setParameter
(
"p_company_site_id"
,
dto
.
getCompanySiteId
());
query
.
setParameter
(
"p_campaign_id"
,
dto
.
getCampaignId
());
query
.
setParameter
(
"p_campaign_id"
,
dto
.
getCampaignId
());
query
.
setParameter
(
"p_cus_list_code"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getCustListCode
())
?
null
:
dto
.
getCustListCode
().
toUpperCase
());
query
.
setParameter
(
"p_cus_list_code"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getCustListCode
())
?
null
:
dto
.
getCustListCode
().
t
rim
().
t
oUpperCase
());
query
.
setParameter
(
"p_cus_list_name"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getCustListName
())
?
null
:
dto
.
getCustListName
().
toUpperCase
());
query
.
setParameter
(
"p_cus_list_name"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getCustListName
())
?
null
:
dto
.
getCustListName
().
t
rim
().
t
oUpperCase
());
query
.
setParameter
(
"p_to_date"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getCustListCode
())
?
null
:
dto
.
getCreateTimeTo
());
query
.
setParameter
(
"p_to_date"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getCustListCode
())
?
null
:
dto
.
getCreateTimeTo
());
query
.
setParameter
(
"p_from_date"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getCustListCode
())
?
null
:
dto
.
getCreateTimeFr
());
query
.
setParameter
(
"p_from_date"
,
DataUtil
.
isNullOrEmpty
(
dto
.
getCustListCode
())
?
null
:
dto
.
getCreateTimeFr
());
query
.
setParameter
(
"p_page_number"
,
dto
.
getPage
());
query
.
setParameter
(
"p_page_number"
,
dto
.
getPage
());
...
...
src/main/java/com/viettel/campaign/service/CustomerService.java
View file @
8890ea24
...
@@ -34,6 +34,8 @@ public interface CustomerService {
...
@@ -34,6 +34,8 @@ public interface CustomerService {
ResultDTO
getAllCustomerList
(
int
page
,
int
pageSize
,
String
sort
,
Long
companySiteId
);
ResultDTO
getAllCustomerList
(
int
page
,
int
pageSize
,
String
sort
,
Long
companySiteId
);
// THÍM NÀO MERGE CONFLICT THÌ GIỮ LẠI HỘ E CÁI METHOD NÀY VỚI
// VIẾT ĐI VIẾT LẠI 4 LẦN RỒI ĐẤY
ResultDTO
createCustomerList
(
CustomerListDTO
customerListDTO
,
String
userName
);
ResultDTO
createCustomerList
(
CustomerListDTO
customerListDTO
,
String
userName
);
ResultDTO
updateCustomerList
(
CustomerListDTO
customerListDTO
);
ResultDTO
updateCustomerList
(
CustomerListDTO
customerListDTO
);
...
...
src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
View file @
8890ea24
This diff is collapsed.
Click to expand it.
src/main/java/com/viettel/campaign/service/impl/ScenarioServiceImpl.java
View file @
8890ea24
This diff is collapsed.
Click to expand it.
src/main/java/com/viettel/campaign/utils/Config.java
View file @
8890ea24
...
@@ -16,6 +16,7 @@ public class Config {
...
@@ -16,6 +16,7 @@ public class Config {
public
static
final
String
APP_CONF_FILE_PATH
=
System
.
getProperty
(
"user.dir"
)
+
File
.
separator
+
"etc"
+
File
.
separator
+
"app.conf"
;
public
static
final
String
APP_CONF_FILE_PATH
=
System
.
getProperty
(
"user.dir"
)
+
File
.
separator
+
"etc"
+
File
.
separator
+
"app.conf"
;
public
static
final
String
LOG_CONF_FILE_PATH
=
System
.
getProperty
(
"user.dir"
)
+
File
.
separator
+
"etc"
+
File
.
separator
+
"log.conf"
;
public
static
final
String
LOG_CONF_FILE_PATH
=
System
.
getProperty
(
"user.dir"
)
+
File
.
separator
+
"etc"
+
File
.
separator
+
"log.conf"
;
public
static
final
String
EXCEL_DIR
=
System
.
getProperty
(
"user.dir"
)
+
File
.
separator
+
"etc"
;
public
static
String
amcd_xmlrpc_url
;
public
static
String
amcd_xmlrpc_url
;
public
static
int
num_client_amcd_xmlprc
;
public
static
int
num_client_amcd_xmlprc
;
...
@@ -60,7 +61,7 @@ public class Config {
...
@@ -60,7 +61,7 @@ public class Config {
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
Logger
.
getLogger
(
Config
.
class
.
getName
()).
error
(
ex
.
getMessage
(),
ex
);
Logger
.
getLogger
(
Config
.
class
.
getName
()).
error
(
ex
.
getMessage
(),
ex
);
}
}
//
PassTranformer.setInputKey("Ipcc#987654321#@!");
PassTranformer
.
setInputKey
(
"Ipcc#987654321#@!"
);
// rabbitConnection = properties.getProperty("rabbit_connection_string");
// rabbitConnection = properties.getProperty("rabbit_connection_string");
// fbGatewayUser = PassTranformer.decrypt(properties.getProperty("rabbit_user", "").trim());
// fbGatewayUser = PassTranformer.decrypt(properties.getProperty("rabbit_user", "").trim());
...
...
src/main/java/com/viettel/campaign/web/rest/CustomerController.java
View file @
8890ea24
...
@@ -5,6 +5,7 @@ import com.viettel.campaign.model.ccms_full.CustomizeFieldObject;
...
@@ -5,6 +5,7 @@ import com.viettel.campaign.model.ccms_full.CustomizeFieldObject;
import
com.viettel.campaign.model.ccms_full.CustomizeFields
;
import
com.viettel.campaign.model.ccms_full.CustomizeFields
;
import
com.viettel.campaign.service.CustomerService
;
import
com.viettel.campaign.service.CustomerService
;
import
com.viettel.campaign.utils.BundleUtils
;
import
com.viettel.campaign.utils.BundleUtils
;
import
com.viettel.campaign.utils.Config
;
import
com.viettel.campaign.utils.Constants
;
import
com.viettel.campaign.utils.Constants
;
import
com.viettel.campaign.utils.RedisUtil
;
import
com.viettel.campaign.utils.RedisUtil
;
import
com.viettel.campaign.web.dto.*
;
import
com.viettel.campaign.web.dto.*
;
...
@@ -108,13 +109,16 @@ public class CustomerController {
...
@@ -108,13 +109,16 @@ public class CustomerController {
@PostMapping
(
"/createCustomerList"
)
@PostMapping
(
"/createCustomerList"
)
@ResponseBody
@ResponseBody
public
ResultDTO
createCustomerList
(
@RequestBody
@Valid
CustomerListDTO
customerListDTO
,
HttpServletRequest
request
)
{
public
ResultDTO
createCustomerList
(
@RequestBody
@Valid
CustomerListDTO
customerListDTO
,
HttpServletRequest
request
)
{
ResultDTO
result
=
new
ResultDTO
();
// THÍM NÀO MERGE CONFLICT THÌ GIỮ LẠI HỘ E CÁI METHOD NÀY VỚI
// VIẾT ĐI VIẾT LẠI 4 LẦN RỒI ĐẤY
String
xAuthToken
=
request
.
getHeader
(
"X-Auth-Token"
);
String
xAuthToken
=
request
.
getHeader
(
"X-Auth-Token"
);
UserSession
userSession
=
(
UserSession
)
RedisUtil
.
getInstance
().
get
(
xAuthToken
);
UserSession
userSession
=
(
UserSession
)
RedisUtil
.
getInstance
().
get
(
xAuthToken
);
if
(
userSession
==
null
)
{
result
=
customerService
.
createCustomerList
(
customerListDTO
,
userSession
.
getUserName
());
userSession
=
new
UserSession
();
return
result
;
userSession
.
setSiteId
(
customerListDTO
.
getCompanySiteId
());
userSession
.
setUserName
(
"its4"
);
}
return
customerService
.
createCustomerList
(
customerListDTO
,
userSession
.
getUserName
());
}
}
@PostMapping
(
"/updateCustomerList"
)
@PostMapping
(
"/updateCustomerList"
)
...
@@ -187,12 +191,17 @@ public class CustomerController {
...
@@ -187,12 +191,17 @@ public class CustomerController {
@PostMapping
(
value
=
"/importFile"
)
@PostMapping
(
value
=
"/importFile"
)
public
ResponseEntity
<?>
importFile
(
@RequestParam
(
"file"
)
MultipartFile
file
,
public
ResponseEntity
<?>
importFile
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@RequestParam
(
"customerListId"
)
Lo
ng
customerListId
,
@RequestParam
(
"customerListId"
)
Stri
ng
customerListId
,
@RequestHeader
(
"X-Auth-Token"
)
String
authToken
)
{
HttpServletRequest
request
)
{
LOGGER
.
info
(
"------------IMPORT FILE TEMPLATE--------------"
);
LOGGER
.
info
(
"------------IMPORT FILE TEMPLATE--------------"
);
Locale
locale
=
new
Locale
(
"vi"
,
"VN"
);
Locale
locale
=
new
Locale
(
"vi"
,
"VN"
);
try
{
try
{
UserSession
userSession
=
(
UserSession
)
RedisUtil
.
getInstance
().
get
(
authToken
);
UserSession
userSession
=
(
UserSession
)
RedisUtil
.
getInstance
().
get
(
request
.
getHeader
(
"X-Auth-Token"
));
if
(
userSession
==
null
)
{
userSession
=
new
UserSession
();
userSession
.
setSiteId
(
662691L
);
userSession
.
setUserName
(
"its3"
);
}
if
(
file
.
isEmpty
())
{
if
(
file
.
isEmpty
())
{
return
new
ResponseEntity
<>(
BundleUtils
.
getLangString
(
"customer.fileNotSelected"
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
BundleUtils
.
getLangString
(
"customer.fileNotSelected"
),
HttpStatus
.
OK
);
}
}
...
@@ -201,7 +210,7 @@ public class CustomerController {
...
@@ -201,7 +210,7 @@ public class CustomerController {
}
}
String
path
=
saveUploadFile
(
file
);
String
path
=
saveUploadFile
(
file
);
List
<
CustomizeFields
>
dynamicHeaders
=
customerService
.
getDynamicHeader
(
userSession
.
getCompanySiteId
());
List
<
CustomizeFields
>
dynamicHeaders
=
customerService
.
getDynamicHeader
(
userSession
.
getCompanySiteId
());
Map
<
String
,
Object
>
map
=
customerService
.
readAndValidateCustomer
(
path
,
dynamicHeaders
,
userSession
,
customerListId
);
Map
<
String
,
Object
>
map
=
customerService
.
readAndValidateCustomer
(
path
,
dynamicHeaders
,
userSession
,
Long
.
parseLong
(
customerListId
)
);
File
fileExport
=
(
File
)
map
.
get
(
"file"
);
File
fileExport
=
(
File
)
map
.
get
(
"file"
);
String
message
=
(
String
)
map
.
get
(
"message"
);
String
message
=
(
String
)
map
.
get
(
"message"
);
return
ResponseEntity
.
ok
()
return
ResponseEntity
.
ok
()
...
@@ -239,11 +248,13 @@ public class CustomerController {
...
@@ -239,11 +248,13 @@ public class CustomerController {
String
currentTime
=
new
SimpleDateFormat
(
"yyyy_MM_dd_hh_mm_ss"
).
format
(
new
Date
());
String
currentTime
=
new
SimpleDateFormat
(
"yyyy_MM_dd_hh_mm_ss"
).
format
(
new
Date
());
String
fileName
=
FilenameUtils
.
getBaseName
(
file
.
getOriginalFilename
())
+
"_"
+
currentTime
+
"."
+
FilenameUtils
.
getExtension
(
file
.
getOriginalFilename
());
String
fileName
=
FilenameUtils
.
getBaseName
(
file
.
getOriginalFilename
())
+
"_"
+
currentTime
+
"."
+
FilenameUtils
.
getExtension
(
file
.
getOriginalFilename
());
byte
[]
content
=
file
.
getBytes
();
byte
[]
content
=
file
.
getBytes
();
File
uploadFolder
=
new
File
(
BundleUtils
.
getGlobalConfig
(
"import.uploadFolder"
));
// File uploadFolder = new File(BundleUtils.getGlobalConfig("import.uploadFolder"));
File
uploadFolder
=
new
File
(
Config
.
EXCEL_DIR
);
if
(!
uploadFolder
.
exists
())
{
if
(!
uploadFolder
.
exists
())
{
uploadFolder
.
mkdir
();
uploadFolder
.
mkdir
();
}
}
Path
path
=
Paths
.
get
(
BundleUtils
.
getGlobalConfig
(
"import.uploadFolder"
),
fileName
);
// Path path = Paths.get(BundleUtils.getGlobalConfig("import.uploadFolder"), fileName);
Path
path
=
Paths
.
get
(
Config
.
EXCEL_DIR
,
fileName
);
Files
.
write
(
path
,
content
);
Files
.
write
(
path
,
content
);
return
path
.
toString
();
return
path
.
toString
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/viettel/campaign/web/rest/ScenarioController.java
View file @
8890ea24
...
@@ -122,7 +122,7 @@ public class ScenarioController {
...
@@ -122,7 +122,7 @@ public class ScenarioController {
String
message
=
(
String
)
map
.
get
(
"message"
);
String
message
=
(
String
)
map
.
get
(
"message"
);
return
ResponseEntity
.
ok
()
return
ResponseEntity
.
ok
()
.
header
(
"Content-Type"
,
Constants
.
MIME_TYPE
.
EXCEL_XLSX
)
.
header
(
"Content-Type"
,
Constants
.
MIME_TYPE
.
EXCEL_XLSX
)
.
header
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment; filename=
template_import_customer
.xlsx"
)
.
header
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment; filename=
import_scenario_result
.xlsx"
)
.
header
(
"Message"
,
message
)
.
header
(
"Message"
,
message
)
.
body
(
Files
.
readAllBytes
(
fileExport
.
toPath
()));
.
body
(
Files
.
readAllBytes
(
fileExport
.
toPath
()));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
src/main/resources/application.yml
View file @
8890ea24
...
@@ -11,6 +11,11 @@ spring:
...
@@ -11,6 +11,11 @@ spring:
ddl-auto
:
none
ddl-auto
:
none
naming
:
naming
:
physical-strategy
:
org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
physical-strategy
:
org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
servlet
:
multipart
:
enabled
:
true
max-file-size
:
3MB
max-request-size
:
3MB
# kafka:
# kafka:
# consumer:
# consumer:
# bootstrap-servers: 192.168.1.201:9092
# bootstrap-servers: 192.168.1.201:9092
...
@@ -40,4 +45,3 @@ datasource-property:
...
@@ -40,4 +45,3 @@ datasource-property:
src/main/resources/i18n/language_en.properties
View file @
8890ea24
...
@@ -108,6 +108,7 @@ customer.emailExists=Email exists;
...
@@ -108,6 +108,7 @@ customer.emailExists=Email exists;
common.fileNotSelected
=
Please select a file
common.fileNotSelected
=
Please select a file
common.fileInvalidFormat
=
File invalid
common.fileInvalidFormat
=
File invalid
common.invalidTemplate
=
Template invalid format
#IMPORT SCENARIO TEMPLATE
#IMPORT SCENARIO TEMPLATE
scenario.template.title
=
IMPORT QUESTIONS
scenario.template.title
=
IMPORT QUESTIONS
...
@@ -125,3 +126,12 @@ scenario.template.result=Result
...
@@ -125,3 +126,12 @@ scenario.template.result=Result
scenario.template.singleChoice
=
SingleChoice
scenario.template.singleChoice
=
SingleChoice
scenario.template.multiChoice
=
MultiChoice
scenario.template.multiChoice
=
MultiChoice
scenario.template.text
=
Text
scenario.template.text
=
Text
scenario.questionCode.required
=
"Question index is required"
scenario.questionType.required
=
"Question type is required"
scenario.question.required
=
"Question content is required"
scenario.answer.required
=
"Answer is required for SingleChoice or MultiChoice question"
scenario.hashInput.required
=
"Has input is required"
scenario.required.required
=
"Require is required"
scenario.default.required
=
"Default is required"
src/main/resources/i18n/language_vi.properties
View file @
8890ea24
...
@@ -110,6 +110,7 @@ customer.emailExists=Email đã tồn tại;
...
@@ -110,6 +110,7 @@ customer.emailExists=Email đã tồn tại;
common.fileNotSelected
=
Bạn chưa chọn file
common.fileNotSelected
=
Bạn chưa chọn file
common.fileInvalidFormat
=
File không hợp lệ
common.fileInvalidFormat
=
File không hợp lệ
common.invalidTemplate
=
Template sai định dạng
#IMPORT SCENARIO TEMPLATE
#IMPORT SCENARIO TEMPLATE
scenario.template.title
=
IMPORT CÂU HỎI
scenario.template.title
=
IMPORT CÂU HỎI
...
@@ -128,6 +129,14 @@ scenario.template.singleChoice=SingleChoice
...
@@ -128,6 +129,14 @@ scenario.template.singleChoice=SingleChoice
scenario.template.multiChoice
=
MultiChoice
scenario.template.multiChoice
=
MultiChoice
scenario.template.text
=
Text
scenario.template.text
=
Text
scenario.questionCode.required
=
"Mã câu hỏi bắt buộc nhập"
scenario.questionType.required
=
"Loại câu hỏi bắt buộc nhập"
scenario.question.required
=
"Câu hỏi bắt buộc nhập"
scenario.answer.required
=
"Câu trả lời cho câu hỏi SingleChoice, MultiChoice bắt buộc nhập"
scenario.hashInput.required
=
"Trường Nhập text bắt buộc nhập"
scenario.required.required
=
"Trường Bắt buộc bắt buộc nhập"
scenario.default.required
=
"Trường Mặc định bắt buộc nhập"
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