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
e2f94b2d
Commit
e2f94b2d
authored
Aug 13, 2019
by
Vu Duy Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
anhvd commit change
parent
32cf8c0c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
17 deletions
+61
-17
src/main/java/com/viettel/campaign/model/ccms_full/TimeRangeDialMode.java
...m/viettel/campaign/model/ccms_full/TimeRangeDialMode.java
+1
-1
src/main/java/com/viettel/campaign/repository/ccms_full/UserActionLogRepositoryCustom.java
...n/repository/ccms_full/UserActionLogRepositoryCustom.java
+3
-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/impl/CampaignServiceImpl.java
...om/viettel/campaign/service/impl/CampaignServiceImpl.java
+49
-16
src/main/java/com/viettel/campaign/web/rest/CampaignController.java
...ava/com/viettel/campaign/web/rest/CampaignController.java
+6
-0
No files found.
src/main/java/com/viettel/campaign/model/ccms_full/TimeRangeDialMode.java
View file @
e2f94b2d
...
@@ -27,7 +27,7 @@ public class TimeRangeDialMode implements Serializable {
...
@@ -27,7 +27,7 @@ public class TimeRangeDialMode implements Serializable {
@Column
(
name
=
"COMPANY_SITE_ID"
)
@Column
(
name
=
"COMPANY_SITE_ID"
)
private
Long
companySiteId
;
private
Long
companySiteId
;
@Temporal
(
TemporalType
.
DATE
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"START_TIME"
)
@Column
(
name
=
"START_TIME"
)
private
Date
startTime
;
private
Date
startTime
;
...
...
src/main/java/com/viettel/campaign/repository/ccms_full/UserActionLogRepositoryCustom.java
View file @
e2f94b2d
package
com.viettel.campaign.repository.ccms_full
;
package
com.viettel.campaign.repository.ccms_full
;
import
com.viettel.campaign.config.DataSourceQualify
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.web.dto.ResultDTO
;
import
com.viettel.campaign.web.dto.UserActionLogDTO
;
import
com.viettel.campaign.web.dto.UserActionLogDTO
;
import
org.springframework.transaction.annotation.Transactional
;
/**
/**
* @author anhvd_itsol
* @author anhvd_itsol
*/
*/
public
interface
UserActionLogRepositoryCustom
{
public
interface
UserActionLogRepositoryCustom
{
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
ResultDTO
insertToUserActionLog
(
UserActionLogDTO
userActionLogDTO
);
ResultDTO
insertToUserActionLog
(
UserActionLogDTO
userActionLogDTO
);
}
}
src/main/java/com/viettel/campaign/service/CampaignService.java
View file @
e2f94b2d
...
@@ -44,4 +44,6 @@ public interface CampaignService {
...
@@ -44,4 +44,6 @@ public interface CampaignService {
List
<
TimeRangeDialMode
>
getCampaignTimeRangeMode
(
Long
campaignId
,
Long
companySiteId
);
List
<
TimeRangeDialMode
>
getCampaignTimeRangeMode
(
Long
campaignId
,
Long
companySiteId
);
List
<
TimeZoneDialMode
>
getCampaignTimeZoneMode
(
Long
campaignId
,
Long
companySiteId
);
List
<
TimeZoneDialMode
>
getCampaignTimeZoneMode
(
Long
campaignId
,
Long
companySiteId
);
ResultDTO
renewCampaign
(
CampaignDTO
campaignDTO
);
}
}
src/main/java/com/viettel/campaign/service/impl/CampaignServiceImpl.java
View file @
e2f94b2d
...
@@ -15,6 +15,7 @@ import com.viettel.campaign.utils.DataUtil;
...
@@ -15,6 +15,7 @@ import com.viettel.campaign.utils.DataUtil;
import
com.viettel.campaign.utils.WorkBookBuilder
;
import
com.viettel.campaign.utils.WorkBookBuilder
;
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
oracle.jdbc.driver.Const
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.ss.usermodel.*
;
...
@@ -227,20 +228,14 @@ public class CampaignServiceImpl implements CampaignService {
...
@@ -227,20 +228,14 @@ public class CampaignServiceImpl implements CampaignService {
userActionLog
.
setObjectId
(
entity
.
getCampaignId
());
userActionLog
.
setObjectId
(
entity
.
getCampaignId
());
if
(
dto
.
getStatus
().
equals
((
short
)
-
1
))
{
if
(
dto
.
getStatus
().
equals
((
short
)
-
1
))
{
userActionLog
.
setActionType
((
short
)
2
);
userActionLog
.
setActionType
((
short
)
2
);
}
}
else
if
(
dto
.
getStatus
().
equals
((
short
)
1
))
{
else
if
(
dto
.
getStatus
().
equals
((
short
)
4
))
{
userActionLog
.
setActionType
((
short
)
3
);
userActionLog
.
setActionType
((
short
)
7
);
}
else
if
(
dto
.
getStatus
().
equals
((
short
)
2
))
{
}
userActionLog
.
setActionType
((
short
)
5
);
else
if
(
dto
.
getStatus
().
equals
((
short
)
3
))
{
}
else
if
(
dto
.
getStatus
().
equals
((
short
)
3
))
{
userActionLog
.
setActionType
((
short
)
4
);
userActionLog
.
setActionType
((
short
)
4
);
}
else
if
(
dto
.
getStatus
().
equals
((
short
)
2
))
{
}
else
if
(
dto
.
getStatus
().
equals
((
short
)
5
))
{
userActionLog
.
setActionType
((
short
)
7
);
}
else
if
(
dto
.
getStatus
().
equals
((
short
)
4
))
{
}
else
if
(
dto
.
getStatus
().
equals
((
short
)
4
))
{
userActionLog
.
setActionType
((
short
)
4
);
userActionLog
.
setActionType
((
short
)
7
);
}
else
if
(
dto
.
getStatus
().
equals
((
short
)
3
))
{
userActionLog
.
setActionType
((
short
)
5
);
}
}
userActionLogRepository
.
insertToUserActionLog
(
userActionLog
);
userActionLogRepository
.
insertToUserActionLog
(
userActionLog
);
...
@@ -275,7 +270,7 @@ public class CampaignServiceImpl implements CampaignService {
...
@@ -275,7 +270,7 @@ public class CampaignServiceImpl implements CampaignService {
XSSFWorkbook
workbook
=
new
XSSFWorkbook
();
XSSFWorkbook
workbook
=
new
XSSFWorkbook
();
Sheet
sheet
;
Sheet
sheet
;
CellStyle
styleTitle
=
WorkBookBuilder
.
buildDefaultStyleTitle
(
workbook
);
CellStyle
styleTitle
=
WorkBookBuilder
.
buildDefaultStyleTitle
(
workbook
);
CellStyle
styleRowHeader
=
WorkBookBuilder
.
buildDefaultStyleRowHeader
(
workbook
);
CellStyle
styleRowHeader
=
WorkBookBuilder
.
buildDefaultStyleRowHeader
(
workbook
);
CellStyle
styleRow
=
WorkBookBuilder
.
buildDefaultStyleRow
(
workbook
);
CellStyle
styleRow
=
WorkBookBuilder
.
buildDefaultStyleRow
(
workbook
);
...
@@ -339,15 +334,53 @@ public class CampaignServiceImpl implements CampaignService {
...
@@ -339,15 +334,53 @@ public class CampaignServiceImpl implements CampaignService {
}
}
@Override
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
List
<
TimeRangeDialMode
>
getCampaignTimeRangeMode
(
Long
campaignId
,
Long
companySiteId
)
{
public
List
<
TimeRangeDialMode
>
getCampaignTimeRangeMode
(
Long
campaignId
,
Long
companySiteId
)
{
return
timeRangeDialModeRepository
.
findTimeRangeDialModeByCampaignIdAndCompanySiteId
(
campaignId
,
companySiteId
);
return
timeRangeDialModeRepository
.
findTimeRangeDialModeByCampaignIdAndCompanySiteId
(
campaignId
,
companySiteId
);
}
}
@Override
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
List
<
TimeZoneDialMode
>
getCampaignTimeZoneMode
(
Long
campaignId
,
Long
companySiteId
)
{
public
List
<
TimeZoneDialMode
>
getCampaignTimeZoneMode
(
Long
campaignId
,
Long
companySiteId
)
{
return
timeZoneDialModeRepository
.
findTimeZoneDialModeByCampaignIdAndCompanySiteId
(
campaignId
,
companySiteId
);
return
timeZoneDialModeRepository
.
findTimeZoneDialModeByCampaignIdAndCompanySiteId
(
campaignId
,
companySiteId
);
}
}
@Override
@Transactional
(
DataSourceQualify
.
CCMS_FULL
)
public
ResultDTO
renewCampaign
(
CampaignDTO
campaignDTO
)
{
ResultDTO
resultDTO
=
new
ResultDTO
();
try
{
Campaign
entity
=
campaignRepository
.
findCampaignByCampaignIdAndCompanySiteId
(
campaignDTO
.
getCampaignId
(),
campaignDTO
.
getCompanySiteId
());
if
(
entity
!=
null
)
{
entity
.
setStatus
(
campaignDTO
.
getStatus
().
longValue
());
entity
.
setUpdateTime
(
new
Date
());
entity
.
setUpdateBy
(
campaignDTO
.
getUpdateBy
());
entity
.
setEndTime
(
campaignDTO
.
getEndTime
());
campaignRepository
.
save
(
entity
);
UserActionLogDTO
userActionLog
=
new
UserActionLogDTO
();
userActionLog
.
setAgentId
(
null
);
userActionLog
.
setSessionId
(
campaignDTO
.
getSessionId
());
userActionLog
.
setCompanySiteId
(
campaignDTO
.
getCompanySiteId
());
userActionLog
.
setDescription
(
null
);
userActionLog
.
setStartTime
(
new
Date
());
userActionLog
.
setEndTime
(
null
);
userActionLog
.
setObjectId
(
entity
.
getCampaignId
());
userActionLog
.
setActionType
((
short
)
6
);
userActionLogRepository
.
insertToUserActionLog
(
userActionLog
);
resultDTO
.
setData
(
entity
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
SUCCESS
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
SUCCESS
);
}
}
catch
(
Exception
ex
)
{
logger
.
error
(
ex
.
getMessage
(),
ex
);
resultDTO
.
setErrorCode
(
Constants
.
ApiErrorCode
.
ERROR
);
resultDTO
.
setDescription
(
Constants
.
ApiErrorDesc
.
ERROR
);
}
return
resultDTO
;
}
private
String
generateCampaignCode
(
String
campaignType
,
Short
chanel
)
{
private
String
generateCampaignCode
(
String
campaignType
,
Short
chanel
)
{
int
year
=
Calendar
.
getInstance
().
get
(
Calendar
.
YEAR
);
int
year
=
Calendar
.
getInstance
().
get
(
Calendar
.
YEAR
);
String
maxIndexStr
=
campaignRepositoryCustom
.
getMaxCampaignIndex
();
String
maxIndexStr
=
campaignRepositoryCustom
.
getMaxCampaignIndex
();
...
@@ -361,9 +394,9 @@ public class CampaignServiceImpl implements CampaignService {
...
@@ -361,9 +394,9 @@ public class CampaignServiceImpl implements CampaignService {
public
String
getCampaignTypeName
(
List
<
ApParam
>
lstApParams
,
String
type
)
{
public
String
getCampaignTypeName
(
List
<
ApParam
>
lstApParams
,
String
type
)
{
String
name
=
""
;
String
name
=
""
;
if
(!
DataUtil
.
isNullOrEmpty
(
type
))
{
if
(!
DataUtil
.
isNullOrEmpty
(
type
))
{
for
(
int
i
=
0
;
i
<
lstApParams
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
lstApParams
.
size
();
i
++)
{
if
(
type
.
equals
(
lstApParams
.
get
(
i
).
getParValue
()))
{
if
(
type
.
equals
(
lstApParams
.
get
(
i
).
getParValue
()))
{
name
=
lstApParams
.
get
(
i
).
getParName
();
name
=
lstApParams
.
get
(
i
).
getParName
();
break
;
break
;
}
}
...
...
src/main/java/com/viettel/campaign/web/rest/CampaignController.java
View file @
e2f94b2d
...
@@ -175,4 +175,10 @@ public class CampaignController {
...
@@ -175,4 +175,10 @@ public class CampaignController {
return
timeZoneDialModeRepository
.
findTimeZoneDialModeByCampaignIdAndCompanySiteId
(
campaignId
,
companySiteId
);
return
timeZoneDialModeRepository
.
findTimeZoneDialModeByCampaignIdAndCompanySiteId
(
campaignId
,
companySiteId
);
}
}
@RequestMapping
(
value
=
"/renewCampaign"
,
method
=
RequestMethod
.
PUT
)
public
ResponseEntity
<
ResultDTO
>
renewCampaign
(
@RequestBody
CampaignDTO
campaignDTO
)
{
ResultDTO
result
=
campaignService
.
renewCampaign
(
campaignDTO
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
}
}
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