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
63ddc8fc
Commit
63ddc8fc
authored
Aug 29, 2019
by
Nguyen Ha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix sonar
parent
adbc0add
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
109 additions
and
94 deletions
+109
-94
src/main/java/com/viettel/campaign/service/impl/CampaignExecuteServiceImp.java
...ttel/campaign/service/impl/CampaignExecuteServiceImp.java
+109
-94
No files found.
src/main/java/com/viettel/campaign/service/impl/CampaignExecuteServiceImp.java
View file @
63ddc8fc
...
@@ -24,6 +24,9 @@ import org.springframework.data.domain.PageRequest;
...
@@ -24,6 +24,9 @@ import org.springframework.data.domain.PageRequest;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.IOException
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.SecureRandom
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
...
@@ -33,6 +36,8 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
...
@@ -33,6 +36,8 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
CampaignExecuteServiceImp
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
CampaignExecuteServiceImp
.
class
);
private
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
Constants
.
DATE_FORMAT
.
FOMART_DATE_TYPE_1
);
private
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
Constants
.
DATE_FORMAT
.
FOMART_DATE_TYPE_1
);
private
Random
rand
=
SecureRandom
.
getInstanceStrong
();
@Autowired
@Autowired
ModelMapper
modelMapper
;
ModelMapper
modelMapper
;
...
@@ -66,6 +71,9 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
...
@@ -66,6 +71,9 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
@Autowired
@Autowired
CampaignCustomerListColumnRepository
campaignCustomerListColumnRepository
;
CampaignCustomerListColumnRepository
campaignCustomerListColumnRepository
;
public
CampaignExecuteServiceImp
()
throws
NoSuchAlgorithmException
{
}
//<editor-fold: hungtt>
//<editor-fold: hungtt>
@Override
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
...
@@ -119,14 +127,15 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
...
@@ -119,14 +127,15 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
@Override
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
XSSFWorkbook
exportInteractiveResult
(
CampaignRequestDTO
dto
)
{
public
XSSFWorkbook
exportInteractiveResult
(
CampaignRequestDTO
dto
)
throws
IOException
{
Locale
locale
=
Locale
.
forLanguageTag
(
"vi"
);
Locale
locale
=
Locale
.
forLanguageTag
(
"vi"
);
List
<
ContactCustResultDTO
>
list
=
campaignExecuteRepository
.
getExcelInteractiveResult
(
dto
);
List
<
ContactCustResultDTO
>
list
=
campaignExecuteRepository
.
getExcelInteractiveResult
(
dto
);
XSSFWorkbook
workbook
=
n
ew
XSSFWorkbook
()
;
XSSFWorkbook
workbook
=
n
ull
;
Sheet
sheet
;
Sheet
sheet
;
try
{
// create font style
// create font style
workbook
=
new
XSSFWorkbook
();
Font
defaultFont
=
workbook
.
createFont
();
Font
defaultFont
=
workbook
.
createFont
();
defaultFont
.
setFontHeightInPoints
((
short
)
13
);
defaultFont
.
setFontHeightInPoints
((
short
)
13
);
defaultFont
.
setFontName
(
"Times New Roman"
);
defaultFont
.
setFontName
(
"Times New Roman"
);
...
@@ -217,6 +226,12 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
...
@@ -217,6 +226,12 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
++
rowIndex
;
++
rowIndex
;
++
count
;
++
count
;
}
}
}
catch
(
Exception
e
){
}
finally
{
if
(
workbook
!=
null
)
workbook
.
close
();
}
return
workbook
;
return
workbook
;
}
}
...
@@ -493,13 +508,13 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
...
@@ -493,13 +508,13 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
@Override
@Override
public
ResultDTO
getCallStatus
(
CampaignRequestDTO
dto
)
{
public
ResultDTO
getCallStatus
(
CampaignRequestDTO
dto
)
{
ResultDTO
result
=
new
ResultDTO
();
ResultDTO
result
=
new
ResultDTO
();
Random
r
=
new
Random
();
//
Random r = new Random();
String
[]
arr
=
{
"ACCEPT"
,
"REJECT"
,
"MISSING"
};
String
[]
arr
=
{
"ACCEPT"
,
"REJECT"
,
"MISSING"
};
if
(
dto
!=
null
)
{
if
(
dto
!=
null
)
{
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
result
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
result
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
result
.
setData
(
arr
[
r
.
nextInt
(
arr
.
length
)]);
result
.
setData
(
arr
[
this
.
rand
.
nextInt
(
arr
.
length
)]);
}
else
{
}
else
{
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
result
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
result
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
result
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
...
...
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